Skip to content

Commit c7cb7ba

Browse files
priyagupta108aparnajyothi-y
authored andcommitted
Limit automatic caching to npm, update workflows and documentation (actions#1374)
* default to auto-caching only for npm package manager and documentation update * refactor: enhance package manager detection for auto-caching * add devEngines.packageManager detection logic for npm auto-caching * chore: bump version to 6.0.0 and update documentation * docs: update README and action.yml for npm caching logic clarification * chore: update Node.js version in workflows * chore: update Node.js versions in versions.yml * chore: update rc Node.js version in versions.yml * chore: switch macos-13 runner to macos-latest-large in workflow * docs: update README and advanced usage documentation
1 parent 983032a commit c7cb7ba

File tree

12 files changed

+327
-176
lines changed

12 files changed

+327
-176
lines changed

.github/workflows/check-dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
name: Check dist/
1717
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
1818
with:
19-
node-version: '20.x'
19+
node-version: '24.x'

.github/workflows/e2e-cache.yml

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
22-
node-version: [18, 20, 22, 24]
21+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
22+
node-version: [20, 22, 24]
2323
steps:
2424
- uses: actions/checkout@v5
2525
- name: Clean global cache
@@ -41,8 +41,8 @@ jobs:
4141
strategy:
4242
fail-fast: false
4343
matrix:
44-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
45-
node-version: [18, 20, 22, 24]
44+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
45+
node-version: [20, 22, 24]
4646
steps:
4747
- uses: actions/checkout@v5
4848
- name: Install pnpm
@@ -74,8 +74,8 @@ jobs:
7474
strategy:
7575
fail-fast: false
7676
matrix:
77-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
78-
node-version: [18, 20, 24]
77+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
78+
node-version: [20, 22, 24]
7979
steps:
8080
- uses: actions/checkout@v5
8181
- name: Yarn version
@@ -106,8 +106,8 @@ jobs:
106106
strategy:
107107
fail-fast: false
108108
matrix:
109-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
110-
node-version: [18, 20, 22, 24]
109+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
110+
node-version: [20, 22, 24]
111111
steps:
112112
- uses: actions/checkout@v5
113113
- name: Update yarn
@@ -139,7 +139,7 @@ jobs:
139139
name: Test yarn subprojects
140140
strategy:
141141
matrix:
142-
node-version: [18, 20, 22, 24]
142+
node-version: [20, 22, 24]
143143
runs-on: ubuntu-latest
144144

145145
steps:
@@ -166,7 +166,7 @@ jobs:
166166
name: Test yarn subprojects all locally managed
167167
strategy:
168168
matrix:
169-
node-version: [18, 20, 22, 24]
169+
node-version: [20, 22, 24]
170170
runs-on: ubuntu-latest
171171

172172
steps:
@@ -193,7 +193,7 @@ jobs:
193193
name: Test yarn subprojects some locally managed
194194
strategy:
195195
matrix:
196-
node-version: [18, 20, 22, 24]
196+
node-version: [20, 22, 24]
197197
runs-on: ubuntu-latest
198198

199199
steps:
@@ -220,7 +220,7 @@ jobs:
220220
name: Test yarn subprojects managed by git
221221
strategy:
222222
matrix:
223-
node-version: [18, 20, 22, 24]
223+
node-version: [20, 22, 24]
224224
runs-on: ubuntu-latest
225225

226226
steps:
@@ -244,14 +244,14 @@ jobs:
244244
sub2/*.lock
245245
sub3/*.lock
246246
247-
node-npm-package-manager-cache:
248-
name: Test enabling cache if package manager field is present (Node ${{ matrix.node-version }}, ${{ matrix.os }})
247+
node-npm-packageManager-auto-cache:
248+
name: Test auto cache with top-level packageManager
249249
runs-on: ${{ matrix.os }}
250250
strategy:
251251
fail-fast: false
252252
matrix:
253-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
254-
node-version: [18, 20, 22]
253+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
254+
node-version: [20, 22, 24]
255255
steps:
256256
- uses: actions/checkout@v5
257257
- name: Create package.json with packageManager field
@@ -268,3 +268,37 @@ jobs:
268268
- name: Verify node and npm
269269
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
270270
shell: bash
271+
272+
node-npm-devEngines-auto-cache:
273+
name: Test auto cache with devEngines.packageManager
274+
runs-on: ${{ matrix.os }}
275+
strategy:
276+
fail-fast: false
277+
matrix:
278+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
279+
node-version: [20, 22, 24]
280+
steps:
281+
- uses: actions/checkout@v5
282+
- name: Create package.json with devEngines field
283+
run: |
284+
echo '{
285+
"name": "test-project",
286+
"version": "1.0.0",
287+
"devEngines": {
288+
"packageManager": {
289+
"name": "npm",
290+
"onFail": "error"
291+
}
292+
}
293+
}' > package.json
294+
- name: Clean global cache
295+
run: npm cache clean --force
296+
- name: Setup Node with caching enabled
297+
uses: ./
298+
with:
299+
node-version: ${{ matrix.node-version }}
300+
- name: Install dependencies
301+
run: npm install
302+
- name: Verify node and npm
303+
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
304+
shell: bash

.github/workflows/proxy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
- uses: actions/checkout@v5
2929
- name: Clear tool cache
3030
run: rm -rf $RUNNER_TOOL_CACHE/*
31-
- name: Setup node 14
31+
- name: Setup node 24
3232
uses: ./
3333
with:
34-
node-version: 14.x
34+
node-version: 24.x
3535
- name: Verify node and npm
36-
run: __tests__/verify-node.sh 14
36+
run: __tests__/verify-node.sh 24
3737

3838
test-bypass-proxy:
3939
runs-on: ubuntu-latest
@@ -44,9 +44,9 @@ jobs:
4444
- uses: actions/checkout@v5
4545
- name: Clear tool cache
4646
run: rm -rf $RUNNER_TOOL_CACHE/*
47-
- name: Setup node 11
47+
- name: Setup node 24
4848
uses: ./
4949
with:
50-
node-version: 11
50+
node-version: 24
5151
- name: Verify node and npm
52-
run: __tests__/verify-node.sh 11
52+
run: __tests__/verify-node.sh 24

.github/workflows/versions.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
13-
node-version: [18, 20, 22, 24]
12+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
13+
node-version: [20, 22, 24]
1414
steps:
1515
- uses: actions/checkout@v5
1616
- name: Setup Node
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
fail-fast: false
2828
matrix:
29-
os: [ubuntu-latest, windows-latest, macos-13]
29+
os: [ubuntu-latest, windows-latest, macos-latest-large]
3030
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
3131
steps:
3232
- uses: actions/checkout@v5
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
51+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
5252
node-version:
5353
[
5454
'20-v8-canary',
@@ -73,8 +73,8 @@ jobs:
7373
strategy:
7474
fail-fast: false
7575
matrix:
76-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
77-
node-version: [20-nightly, 21-nightly, 18.0.0-nightly]
76+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
77+
node-version: [20-nightly, 25-nightly, 24.0.0-nightly]
7878
steps:
7979
- uses: actions/checkout@v5
8080
- name: Setup Node
@@ -93,8 +93,8 @@ jobs:
9393
strategy:
9494
fail-fast: false
9595
matrix:
96-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
97-
node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
96+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
97+
node-version: [20.0.0-rc.1, 22.14.0-rc.1, 24.0.0-rc.4]
9898
steps:
9999
- uses: actions/checkout@v5
100100
- name: Setup Node
@@ -113,8 +113,8 @@ jobs:
113113
strategy:
114114
fail-fast: false
115115
matrix:
116-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
117-
node-version: [18.20.0, 20.10.0, 22.0.0]
116+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
117+
node-version: [20.10.0, 22.0.0, 24.9.0]
118118
steps:
119119
- uses: actions/checkout@v5
120120
- name: Setup Node
@@ -130,8 +130,8 @@ jobs:
130130
strategy:
131131
fail-fast: false
132132
matrix:
133-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
134-
node-version: [18, 20, 22, 24]
133+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
134+
node-version: [20, 22, 24]
135135
steps:
136136
- uses: actions/checkout@v5
137137
- name: Setup Node and check latest
@@ -148,7 +148,7 @@ jobs:
148148
strategy:
149149
fail-fast: false
150150
matrix:
151-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
151+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
152152
node-version-file:
153153
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
154154
steps:
@@ -165,7 +165,7 @@ jobs:
165165
strategy:
166166
fail-fast: false
167167
matrix:
168-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
168+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
169169
steps:
170170
- uses: actions/checkout@v5
171171
- name: Setup node from node version file
@@ -180,7 +180,7 @@ jobs:
180180
strategy:
181181
fail-fast: false
182182
matrix:
183-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
183+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
184184
steps:
185185
- uses: actions/checkout@v5
186186
- name: Setup node from node version file
@@ -195,7 +195,7 @@ jobs:
195195
strategy:
196196
fail-fast: false
197197
matrix:
198-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
198+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
199199
node-version: [17, 19]
200200
steps:
201201
- uses: actions/checkout@v5
@@ -212,7 +212,7 @@ jobs:
212212
strategy:
213213
fail-fast: false
214214
matrix:
215-
os: [ubuntu-latest, windows-latest, macos-13]
215+
os: [ubuntu-latest, windows-latest, macos-latest-large]
216216
steps:
217217
- uses: actions/checkout@v5
218218
# test old versions which didn't have npm and layout different
@@ -242,7 +242,7 @@ jobs:
242242
strategy:
243243
fail-fast: false
244244
matrix:
245-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
245+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
246246
node-version: [current, latest, node]
247247
steps:
248248
- name: Get node version

0 commit comments

Comments
 (0)