Skip to content

Commit fa71bc6

Browse files
authored
Fix CI yml location & improve perf (#379)
* Fix CI yml location * Cache node_modules * Install deps for both linux and windows
1 parent a8ea6b8 commit fa71bc6

5 files changed

Lines changed: 91 additions & 28 deletions

File tree

.github/workflows/ci.yml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,42 @@ env:
1010
node-version: '22.x'
1111

1212
jobs:
13+
install-deps:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-22.04, windows-latest]
17+
runs-on: ${{ matrix.os }}
18+
name: Install Dependencies
19+
steps:
20+
- name: Check out repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ env.node-version }}
27+
cache: yarn
28+
cache-dependency-path: '**/yarn.lock'
29+
30+
- name: Install deps
31+
run: yarn install --prefer-offline --frozen-lockfile
32+
33+
- name: Cache node_modules
34+
uses: actions/cache@v4
35+
id: cache-node-modules
36+
with:
37+
path: |
38+
node_modules
39+
packages/*/node_modules
40+
tools/*/node_modules
41+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
42+
restore-keys: |
43+
node-modules-${{ runner.os }}-
44+
1345
precheck:
1446
name: Check jobs to run
1547
runs-on: ubuntu-24.04
48+
needs: install-deps
1649
outputs:
1750
affected-typescript-resolver-files: ${{ steps.affected.outputs.typescript-resolver-files }}
1851
affected-typescript-resolver-files-e2e: ${{ steps.affected.outputs.typescript-resolver-files-e2e }}
@@ -28,11 +61,17 @@ jobs:
2861
uses: actions/setup-node@v4
2962
with:
3063
node-version: ${{ env.node-version }}
31-
cache: yarn
32-
cache-dependency-path: '**/yarn.lock'
3364

34-
- name: Install deps
35-
run: yarn install --prefer-offline
65+
- name: Restore node_modules cache
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
node_modules
70+
packages/*/node_modules
71+
tools/*/node_modules
72+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
73+
restore-keys: |
74+
node-modules-${{ runner.os }}-
3675
3776
- name: Check affected projects
3877
id: affected
@@ -44,21 +83,21 @@ jobs:
4483
cat $GITHUB_OUTPUT
4584
4685
typescript-resolver-files:
47-
needs: precheck
86+
needs: [install-deps, precheck]
4887
if: ${{ needs.precheck.outputs.affected-typescript-resolver-files == 'true' }}
49-
uses: ./.github/workflows/projects/typescript-resolver-files.yml
88+
uses: ./.github/workflows/typescript-resolver-files.yml
5089

5190
typescript-resolver-files-e2e:
52-
needs: precheck
91+
needs: [install-deps, precheck]
5392
if: ${{ needs.precheck.outputs.affected-typescript-resolver-files == 'true' || needs.precheck.outputs.affected-typescript-resolver-files-e2e == 'true' }}
54-
uses: ./.github/workflows/projects/typescript-resolver-files-e2e.yml
93+
uses: ./.github/workflows/typescript-resolver-files-e2e.yml
5594

5695
operation-location-migration:
57-
needs: precheck
96+
needs: [install-deps, precheck]
5897
if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' }}
59-
uses: ./.github/workflows/projects/operation-location-migration.yml
98+
uses: ./.github/workflows/operation-location-migration.yml
6099

61100
operation-location-migration-e2e:
62-
needs: precheck
101+
needs: [install-deps, precheck]
63102
if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' || needs.precheck.outputs.affected-operation-location-migration-e2e == 'true' }}
64-
uses: ./.github/workflows/projects/operation-location-migration-e2e.yml
103+
uses: ./.github/workflows/operation-location-migration-e2e.yml

.github/workflows/projects/operation-location-migration-e2e.yml renamed to .github/workflows/operation-location-migration-e2e.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ jobs:
2424
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
27-
cache: yarn
28-
cache-dependency-path: '**/yarn.lock'
2927

30-
- name: Install deps
31-
run: yarn install --prefer-offline
28+
- name: Restore node_modules cache
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
node_modules
33+
packages/*/node_modules
34+
tools/*/node_modules
35+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
36+
restore-keys: |
37+
node-modules-${{ runner.os }}-
3238
3339
- name: e2e
3440
run: yarn nx e2e operation-location-migration-e2e

.github/workflows/projects/operation-location-migration.yml renamed to .github/workflows/operation-location-migration.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: ${{ matrix.node-version }}
22-
cache: yarn
23-
cache-dependency-path: '**/yarn.lock'
2422

25-
- name: Install deps
26-
run: yarn install --prefer-offline
23+
- name: Restore node_modules cache
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
node_modules
28+
packages/*/node_modules
29+
tools/*/node_modules
30+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
node-modules-${{ runner.os }}-
2733
2834
- name: Lint
2935
run: yarn nx lint operation-location-migration

.github/workflows/projects/typescript-resolver-files-e2e.yml renamed to .github/workflows/typescript-resolver-files-e2e.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ jobs:
2424
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
27-
cache: yarn
28-
cache-dependency-path: '**/yarn.lock'
2927

30-
- name: Install deps
31-
run: yarn install --prefer-offline
28+
- name: Restore node_modules cache
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
node_modules
33+
packages/*/node_modules
34+
tools/*/node_modules
35+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
36+
restore-keys: |
37+
node-modules-${{ runner.os }}-
3238
3339
- name: e2e
3440
run: yarn nx e2e typescript-resolver-files-e2e

.github/workflows/projects/typescript-resolver-files.yml renamed to .github/workflows/typescript-resolver-files.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,17 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: ${{ matrix.node-version }}
22-
cache: yarn
23-
cache-dependency-path: '**/yarn.lock'
2422

25-
- name: Install deps
26-
run: yarn install --prefer-offline
23+
- name: Restore node_modules cache
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
node_modules
28+
packages/*/node_modules
29+
tools/*/node_modules
30+
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
node-modules-${{ runner.os }}-
2733
2834
- name: Lint
2935
run: yarn nx lint typescript-resolver-files

0 commit comments

Comments
 (0)