Skip to content

Commit a518b42

Browse files
Remove install job, use setup-node's yarn cache (#4202)
## Context We're already using the yarn cache in `setup-node`, so `yarn install` is cheap. Caching `node_modules` is extra work and possibly even slower. ## Changes Remove `install` step that manually caches `node_modules`. Just run `yarn install` in jobs where it's needed.
1 parent 4627bed commit a518b42

File tree

2 files changed

+31
-131
lines changed

2 files changed

+31
-131
lines changed

.github/workflows/main-test.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,22 @@ name: Main Tests
33
on:
44
push:
55
branches: [main]
6-
jobs:
7-
install:
8-
name: Install
9-
runs-on: ubuntu-latest
106

11-
steps:
12-
- name: Cancel Previous Runs
13-
uses: styfle/cancel-workflow-action@0.12.1
14-
with:
15-
access_token: ${{ github.token }}
16-
- name: Checkout Code
17-
uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
19-
with:
20-
node-version-file: '.node-version'
21-
cache: yarn
22-
- name: Cache node modules
23-
id: cache-modules
24-
uses: actions/cache@v4
25-
with:
26-
path: |
27-
**/node_modules
28-
key: modules-${{ github.sha }}
29-
- uses: actions/cache@v4
30-
with:
31-
path: |
32-
~/.cache/Cypress
33-
key: cypress-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
34-
- run: yarn install --immutable
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
3510

11+
jobs:
3612
jest:
3713
name: Jest Unit Tests
3814
runs-on: ubuntu-latest
39-
needs: [install]
4015
steps:
4116
- uses: actions/checkout@v4
4217
- uses: actions/setup-node@v4
4318
with:
4419
node-version-file: '.node-version'
45-
46-
- id: cache-modules
47-
uses: actions/cache@v4
48-
with:
49-
path: |
50-
**/node_modules
51-
key: modules-${{ github.sha }}
20+
cache: yarn
21+
- run: yarn install --immutable
5222
- run: yarn test --coverage
5323
- uses: codecov/codecov-action@v4
5424
with:

.github/workflows/pr.yml

Lines changed: 25 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,21 @@ on:
33
pull_request:
44
types: [opened, synchronize]
55

6-
jobs:
7-
install:
8-
name: Install
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Cancel Previous Runs
13-
uses: styfle/cancel-workflow-action@0.12.1
14-
with:
15-
access_token: ${{ github.token }}
16-
- name: Checkout Code
17-
uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
19-
with:
20-
node-version-file: '.node-version'
21-
cache: yarn
22-
- name: Cache node modules
23-
id: cache-modules
24-
uses: actions/cache@v4
25-
with:
26-
path: |
27-
**/node_modules
28-
key: modules-${{ github.sha }}
29-
- uses: actions/cache@v4
30-
with:
31-
path: |
32-
~/.cache/Cypress
33-
key: cypress-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
34-
- run: yarn install --immutable
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
359

10+
jobs:
3611
build:
3712
name: Build
3813
runs-on: ubuntu-latest
39-
needs: [install]
4014
steps:
4115
- uses: actions/checkout@v4
4216
- uses: actions/setup-node@v4
4317
with:
4418
node-version-file: '.node-version'
45-
- id: cache-modules
46-
uses: actions/cache@v4
47-
with:
48-
path: |
49-
**/node_modules
50-
key: modules-${{ github.sha }}
51-
19+
cache: yarn
20+
- run: yarn install --immutable
5221
- run: yarn build
5322
- uses: actions/cache@v4
5423
with:
@@ -58,52 +27,37 @@ jobs:
5827
cspell:
5928
name: CSpell
6029
runs-on: ubuntu-latest
61-
needs: [install]
6230
steps:
6331
- uses: actions/checkout@v4
6432
- uses: actions/setup-node@v4
6533
with:
6634
node-version-file: '.node-version'
67-
- id: cache-modules
68-
uses: actions/cache@v4
69-
with:
70-
path: |
71-
**/node_modules
72-
key: modules-${{ github.sha }}
35+
cache: yarn
36+
- run: yarn install --immutable
7337
- run: yarn lint-cspell
7438

7539
prettier:
7640
name: Prettier
7741
runs-on: ubuntu-latest
78-
needs: [install]
7942
steps:
8043
- uses: actions/checkout@v4
8144
- uses: actions/setup-node@v4
8245
with:
8346
node-version-file: '.node-version'
84-
- id: cache-modules
85-
uses: actions/cache@v4
86-
with:
87-
path: |
88-
**/node_modules
89-
key: modules-${{ github.sha }}
47+
cache: yarn
48+
- run: yarn install --immutable
9049
- run: yarn pretty-check
9150

9251
jest:
9352
name: Jest Unit & Integration Tests
9453
runs-on: ubuntu-latest
95-
needs: [install]
9654
steps:
9755
- uses: actions/checkout@v4
9856
- uses: actions/setup-node@v4
9957
with:
10058
node-version-file: '.node-version'
101-
- id: cache-modules
102-
uses: actions/cache@v4
103-
with:
104-
path: |
105-
**/node_modules
106-
key: modules-${{ github.sha }}
59+
cache: yarn
60+
- run: yarn install --immutable
10761
- run: yarn test --coverage
10862
- uses: codecov/codecov-action@v4
10963
with:
@@ -121,12 +75,8 @@ jobs:
12175
- uses: actions/setup-node@v4
12276
with:
12377
node-version-file: '.node-version'
124-
- id: cache-modules
125-
uses: actions/cache@v4
126-
with:
127-
path: |
128-
**/node_modules
129-
key: modules-${{ github.sha }}
78+
cache: yarn
79+
- run: yarn install --immutable
13080
- uses: actions/cache@v4
13181
with:
13282
key: build-${{ github.sha }}
@@ -142,12 +92,8 @@ jobs:
14292
- uses: actions/setup-node@v4
14393
with:
14494
node-version-file: '.node-version'
145-
- id: cache-modules
146-
uses: actions/cache@v4
147-
with:
148-
path: |
149-
**/node_modules
150-
key: modules-${{ github.sha }}
95+
cache: yarn
96+
- run: yarn install --immutable
15197
- uses: actions/cache@v4
15298
with:
15399
key: build-${{ github.sha }}
@@ -163,12 +109,8 @@ jobs:
163109
- uses: actions/setup-node@v4
164110
with:
165111
node-version-file: '.node-version'
166-
- id: cache-modules
167-
uses: actions/cache@v4
168-
with:
169-
path: |
170-
**/node_modules
171-
key: modules-${{ github.sha }}
112+
cache: yarn
113+
- run: yarn install --immutable
172114
- uses: actions/cache@v4
173115
with:
174116
key: build-${{ github.sha }}
@@ -181,12 +123,11 @@ jobs:
181123
needs: [build]
182124
steps:
183125
- uses: actions/checkout@v4
184-
- id: cache-modules
185-
uses: actions/cache@v4
126+
- uses: actions/setup-node@v4
186127
with:
187-
path: |
188-
**/node_modules
189-
key: modules-${{ github.sha }}
128+
node-version-file: '.node-version'
129+
cache: yarn
130+
- run: yarn install --immutable
190131
- uses: actions/cache@v4
191132
with:
192133
key: build-${{ github.sha }}
@@ -227,12 +168,8 @@ jobs:
227168
- uses: actions/setup-node@v4
228169
with:
229170
node-version-file: '.node-version'
230-
- id: cache-modules
231-
uses: actions/cache@v4
232-
with:
233-
path: |
234-
**/node_modules
235-
key: modules-${{ github.sha }}
171+
cache: yarn
172+
- run: yarn install --immutable
236173
- uses: actions/cache@v4
237174
with:
238175
key: build-${{ github.sha }}
@@ -279,19 +216,12 @@ jobs:
279216
license-check:
280217
name: Check Licenses
281218
runs-on: ubuntu-latest
282-
needs: [install]
283-
284219
steps:
285220
- uses: actions/checkout@v4
286221
- uses: actions/setup-node@v4
287222
with:
288223
node-version-file: '.node-version'
289-
- id: cache-modules
290-
uses: actions/cache@v4
291-
with:
292-
path: |
293-
**/node_modules
294-
key: modules-${{ github.sha }}
224+
cache: yarn
295225
- run: yarn install --immutable
296226
- name: License Check
297227
run: yarn license-check

0 commit comments

Comments
 (0)