Skip to content

Commit ce4277e

Browse files
github/workflows: simplify npm cache setup (#3404)
1 parent 13530ce commit ce4277e

File tree

1 file changed

+13
-68
lines changed

1 file changed

+13
-68
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,9 @@ jobs:
1313
- name: Setup Node.js
1414
uses: actions/setup-node@v2
1515
with:
16+
cache: npm
1617
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
1718

18-
- name: Cache Node.js modules
19-
uses: actions/cache@v2
20-
with:
21-
path: ~/.npm
22-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
23-
restore-keys: |
24-
${{ runner.OS }}-node-
25-
2619
- name: Install Dependencies
2720
run: npm ci
2821

@@ -65,16 +58,17 @@ jobs:
6558
- name: Setup Node.js
6659
uses: actions/setup-node@v2
6760
with:
61+
cache: npm
6862
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
6963

7064
- name: Run npm install
71-
run: npm install --package-lock-only --engine-strict --strict-peer-deps
65+
run: npm install --engine-strict --strict-peer-deps
7266

7367
- name: Check that package-lock.json is in sync with package.json
7468
run: git diff --exit-code package-lock.json
7569

7670
- name: Check that package-lock.json doesn't have conflicts
77-
run: npm ls --package-lock-only --depth 999
71+
run: npm ls --depth 999
7872

7973
integrationTests:
8074
name: Run integration tests
@@ -87,9 +81,9 @@ jobs:
8781
uses: actions/setup-node@v2
8882
with:
8983
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
84+
# We install bunch of packages during integration tests without locking them
85+
# so we skip cache action to not pollute cache for other jobs.
9086

91-
# We install bunch of packages during integration tests without locking them
92-
# so we skip cache action to not pollute cache for other jobs.
9387
- name: Install Dependencies
9488
run: npm ci
9589

@@ -106,16 +100,9 @@ jobs:
106100
- name: Setup Node.js
107101
uses: actions/setup-node@v2
108102
with:
103+
cache: npm
109104
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
110105

111-
- name: Cache Node.js modules
112-
uses: actions/cache@v2
113-
with:
114-
path: ~/.npm
115-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
116-
restore-keys: |
117-
${{ runner.OS }}-node-
118-
119106
- name: Install Dependencies
120107
run: npm ci
121108

@@ -132,16 +119,9 @@ jobs:
132119
- name: Setup Node.js
133120
uses: actions/setup-node@v2
134121
with:
122+
cache: npm
135123
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
136124

137-
- name: Cache Node.js modules
138-
uses: actions/cache@v2
139-
with:
140-
path: ~/.npm
141-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
142-
restore-keys: |
143-
${{ runner.OS }}-node-
144-
145125
- name: Install Dependencies
146126
run: npm ci
147127

@@ -168,16 +148,9 @@ jobs:
168148
- name: Setup Node.js v${{ matrix.node_version_to_setup }}
169149
uses: actions/setup-node@v2
170150
with:
151+
cache: npm
171152
node-version: ${{ matrix.node_version_to_setup }}
172153

173-
- name: Cache Node.js modules
174-
uses: actions/cache@v2
175-
with:
176-
path: ~/.npm
177-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
178-
restore-keys: |
179-
${{ runner.OS }}-node-
180-
181154
- name: Install Dependencies
182155
run: npm ci
183156

@@ -196,16 +169,9 @@ jobs:
196169
- name: Setup Node.js
197170
uses: actions/setup-node@v2
198171
with:
172+
cache: npm
199173
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
200174

201-
- name: Cache Node.js modules
202-
uses: actions/cache@v2
203-
with:
204-
path: ~/.npm
205-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
206-
restore-keys: |
207-
${{ runner.OS }}-node-
208-
209175
- name: Install Dependencies
210176
run: npm ci
211177

@@ -224,16 +190,9 @@ jobs:
224190
- name: Setup Node.js
225191
uses: actions/setup-node@v2
226192
with:
193+
cache: npm
227194
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
228195

229-
- name: Cache Node.js modules
230-
uses: actions/cache@v2
231-
with:
232-
path: ~/.npm
233-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
234-
restore-keys: |
235-
${{ runner.OS }}-node-
236-
237196
- name: Install Dependencies
238197
run: npm ci
239198

@@ -264,16 +223,9 @@ jobs:
264223
- name: Setup Node.js
265224
uses: actions/setup-node@v2
266225
with:
226+
cache: npm
267227
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
268228

269-
- name: Cache Node.js modules
270-
uses: actions/cache@v2
271-
with:
272-
path: ~/.npm
273-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
274-
restore-keys: |
275-
${{ runner.OS }}-node-
276-
277229
- name: Install Dependencies
278230
run: npm ci
279231

@@ -300,16 +252,9 @@ jobs:
300252
- name: Setup Node.js
301253
uses: actions/setup-node@v2
302254
with:
255+
cache: npm
303256
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
304257

305-
- name: Cache Node.js modules
306-
uses: actions/cache@v2
307-
with:
308-
path: ~/.npm
309-
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
310-
restore-keys: |
311-
${{ runner.OS }}-node-
312-
313258
- name: Install Dependencies
314259
run: npm ci
315260

0 commit comments

Comments
 (0)