Skip to content

Commit a59203d

Browse files
author
Thomas Aribart
committed
wip
1 parent d604f0a commit a59203d

4 files changed

Lines changed: 92 additions & 15 deletions

File tree

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: ${{ inputs.typescript-version }}
2023

2124
- name: Run lint
2225
run: |

.github/workflows/test-pr.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ 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+
needs: build
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 30
2443
outputs:
2544
affected-packages: ${{ steps.get-affected-packages-paths.outputs.affected-packages }}
2645
steps:
@@ -30,36 +49,34 @@ jobs:
3049
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
3150
fetch-depth: 0
3251

33-
- name: Install node_modules
34-
uses: ./.github/actions/install-node-modules
35-
36-
- name: Package
37-
uses: ./.github/actions/package
38-
3952
- name: Get affected packages paths
4053
id: get-affected-packages-paths
4154
uses: ./.github/actions/get-affected-packages-paths
4255
with:
4356
base-branch: ${{ github.base_ref }}
4457

4558
library-lint-and-tests:
46-
name: 🎯 Run Tests
47-
needs: build
59+
name: 🎯 Run tests
60+
needs: [build, get-affected-packages]
4861
runs-on: ubuntu-latest
49-
if: join(fromJson(needs.build.outputs.affected-packages)) != ''
62+
if: join(fromJson(needs.get-affected-packages.outputs.affected-packages)) != ''
5063
timeout-minutes: 30
5164
strategy:
5265
fail-fast: false
5366
matrix:
54-
AFFECTED_LIB: ${{ fromJson(needs.build.outputs.affected-packages) }}
67+
AFFECTED_LIB: ${{ fromJson(needs.get-affected-packages.outputs.affected-packages) }}
68+
typescript-version:
69+
['default', '~4.6.4', '~4.7.4', '~4.8.3', '~4.9.5', '~5.0.4']
5570
steps:
5671
- uses: actions/checkout@v3
5772
with:
5873
ref: ${{ github.event.pull_request.head.sha }}
74+
5975
- name: Run tests
6076
uses: ./.github/actions/lint-and-tests
6177
with:
6278
path: ${{ matrix.AFFECTED_LIB }}
79+
typescript-version: ${{ matrix.typescript-version }}
6380

6481
validate-pr:
6582
name: ✅ Validate the PR
@@ -73,6 +90,7 @@ jobs:
7390
echo "build failed"
7491
exit 1
7592
fi
93+
7694
- name: Validate tests
7795
run: |
7896
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)