Skip to content

Commit 74ad0db

Browse files
author
Thomas Aribart
committed
wip
1 parent d604f0a commit 74ad0db

File tree

4 files changed

+91
-15
lines changed

4 files changed

+91
-15
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Install Node Dependencies
2+
description: Install dependencies using yarn
3+
inputs:
4+
typescript-version:
5+
description: TS version to use
6+
default: 'default'
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Use Node.js
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: ${{ env.NODE_VERSION }}
15+
16+
- name: Get yarn cache directory path
17+
id: yarn-cache-dir-path
18+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
19+
shell: bash
20+
21+
- name: Sync yarn cache
22+
uses: actions/cache@v3
23+
with:
24+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
25+
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-yarn-
28+
29+
- name: Sync node_modules cache
30+
id: sync-node-modules-cache
31+
uses: actions/cache@v3
32+
with:
33+
path: '**/node_modules'
34+
key: ${{ runner.os }}-modules-${{ inputs.typescript-version }}-${{ hashFiles('./yarn.lock') }}
35+
36+
- name: Install node_modules
37+
run: if [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn install --immutable; fi
38+
shell: bash
39+
40+
- name: Override TS with specified version
41+
run: if [ '${{ inputs.typescript-version }}' != 'default' ] && [ '${{ steps.sync-node-modules-cache.outputs.cache-hit }}' != 'true' ]; then yarn add --dev typescript@${{ inputs.typescript-version }}; fi
42+
shell: bash
43+
44+
- name: Sync packages cache
45+
id: sync-packages-cache
46+
uses: actions/cache@v3
47+
with:
48+
path: |
49+
node_modules/@castore/**/dist
50+
key: ts-${{ inputs.typescript-version }}-${{ hashFiles('./packages/**') }}-${{ hashFiles('./demo/**') }}
51+
52+
- name: Package
53+
run: if [ '${{ steps.sync-packages-cache.outputs.cache-hit }}' != 'true' ]; then yarn package; fi
54+
shell: bash

.github/actions/lint-and-tests/action.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ inputs:
44
path:
55
required: true
66
description: Path to the directory to lint and test
7+
typescript-version:
8+
description: TS version to use
9+
default: 'default'
10+
711
runs:
812
using: composite
913
steps:
@@ -12,11 +16,10 @@ runs:
1216
with:
1317
node-version: ${{ env.NODE_VERSION }}
1418

15-
- name: Install node_modules
16-
uses: ./.github/actions/install-node-modules
17-
18-
- name: Package
19-
uses: ./.github/actions/package
19+
- name: Install node_modules & package
20+
uses: ./.github/actions/install-node-modules-and-package
21+
with:
22+
typescript-version: ${{ matrix.typescript-version }}
2023

2124
- name: Run lint
2225
run: |

.github/workflows/test-pr.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ jobs:
2121
name: 🏗 Build Project
2222
runs-on: ubuntu-latest
2323
timeout-minutes: 30
24+
strategy:
25+
matrix:
26+
typescript-version:
27+
['default', '~4.6.4', '~4.7.4', '~4.8.3', '~4.9.5', '~5.0.4']
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
ref: ${{ github.event.pull_request.head.sha }}
32+
33+
- name: Install node_modules & package
34+
uses: ./.github/actions/install-node-modules-and-package
35+
with:
36+
typescript-version: ${{ matrix.typescript-version }}
37+
38+
get-affected-packages:
39+
name: 🔎 Get affected packages
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 30
2442
outputs:
2543
affected-packages: ${{ steps.get-affected-packages-paths.outputs.affected-packages }}
2644
steps:
@@ -30,36 +48,34 @@ jobs:
3048
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
3149
fetch-depth: 0
3250

33-
- name: Install node_modules
34-
uses: ./.github/actions/install-node-modules
35-
36-
- name: Package
37-
uses: ./.github/actions/package
38-
3951
- name: Get affected packages paths
4052
id: get-affected-packages-paths
4153
uses: ./.github/actions/get-affected-packages-paths
4254
with:
4355
base-branch: ${{ github.base_ref }}
4456

4557
library-lint-and-tests:
46-
name: 🎯 Run Tests
47-
needs: build
58+
name: 🎯 Run tests
59+
needs: [build, get-affected-packages]
4860
runs-on: ubuntu-latest
49-
if: join(fromJson(needs.build.outputs.affected-packages)) != ''
61+
if: join(fromJson(needs.get-affected-packages.outputs.affected-packages)) != ''
5062
timeout-minutes: 30
5163
strategy:
5264
fail-fast: false
5365
matrix:
54-
AFFECTED_LIB: ${{ fromJson(needs.build.outputs.affected-packages) }}
66+
AFFECTED_LIB: ${{ fromJson(needs.get-affected-packages.outputs.affected-packages) }}
67+
typescript-version:
68+
['default', '~4.6.4', '~4.7.4', '~4.8.3', '~4.9.5', '~5.0.4']
5569
steps:
5670
- uses: actions/checkout@v3
5771
with:
5872
ref: ${{ github.event.pull_request.head.sha }}
73+
5974
- name: Run tests
6075
uses: ./.github/actions/lint-and-tests
6176
with:
6277
path: ${{ matrix.AFFECTED_LIB }}
78+
typescript-version: ${{ matrix.typescript-version }}
6379

6480
validate-pr:
6581
name: ✅ Validate the PR
@@ -73,6 +89,7 @@ jobs:
7389
echo "build failed"
7490
exit 1
7591
fi
92+
7693
- name: Validate tests
7794
run: |
7895
if [[ ${{ needs.library-lint-and-tests.result }} = "failure" ]]; then

packages/core/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ export type {
7171
EventStoreNotificationMessage,
7272
EventStoreStateCarryingMessage,
7373
} from './messaging';
74+
75+
console.log('youhou');

0 commit comments

Comments
 (0)