Skip to content

Commit 2028fbc

Browse files
Limit automatic caching to npm, update workflows and documentation (#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 1342781 commit 2028fbc

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
@@ -17,8 +17,8 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
21-
node-version: [18, 20, 22, 24]
20+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
21+
node-version: [20, 22, 24]
2222
steps:
2323
- uses: actions/checkout@v5
2424
- name: Setup Node
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
fail-fast: false
3636
matrix:
37-
os: [ubuntu-latest, windows-latest, macos-13]
37+
os: [ubuntu-latest, windows-latest, macos-latest-large]
3838
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
3939
steps:
4040
- uses: actions/checkout@v5
@@ -56,7 +56,7 @@ jobs:
5656
strategy:
5757
fail-fast: false
5858
matrix:
59-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
59+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
6060
node-version:
6161
[
6262
'20-v8-canary',
@@ -81,8 +81,8 @@ jobs:
8181
strategy:
8282
fail-fast: false
8383
matrix:
84-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
85-
node-version: [20-nightly, 21-nightly, 18.0.0-nightly]
84+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
85+
node-version: [20-nightly, 25-nightly, 24.0.0-nightly]
8686
steps:
8787
- uses: actions/checkout@v5
8888
- name: Setup Node
@@ -101,8 +101,8 @@ jobs:
101101
strategy:
102102
fail-fast: false
103103
matrix:
104-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
105-
node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
104+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
105+
node-version: [20.0.0-rc.1, 22.14.0-rc.1, 24.0.0-rc.4]
106106
steps:
107107
- uses: actions/checkout@v5
108108
- name: Setup Node
@@ -121,8 +121,8 @@ jobs:
121121
strategy:
122122
fail-fast: false
123123
matrix:
124-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
125-
node-version: [18.20.0, 20.10.0, 22.0.0]
124+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
125+
node-version: [20.10.0, 22.0.0, 24.9.0]
126126
steps:
127127
- uses: actions/checkout@v5
128128
- name: Setup Node
@@ -138,8 +138,8 @@ jobs:
138138
strategy:
139139
fail-fast: false
140140
matrix:
141-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
142-
node-version: [18, 20, 22, 24]
141+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
142+
node-version: [20, 22, 24]
143143
steps:
144144
- uses: actions/checkout@v5
145145
- name: Setup Node and check latest
@@ -156,7 +156,7 @@ jobs:
156156
strategy:
157157
fail-fast: false
158158
matrix:
159-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
159+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
160160
node-version-file:
161161
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
162162
steps:
@@ -173,7 +173,7 @@ jobs:
173173
strategy:
174174
fail-fast: false
175175
matrix:
176-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
176+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
177177
steps:
178178
- uses: actions/checkout@v5
179179
- name: Setup node from node version file
@@ -188,7 +188,7 @@ jobs:
188188
strategy:
189189
fail-fast: false
190190
matrix:
191-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
191+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
192192
steps:
193193
- uses: actions/checkout@v5
194194
- name: Setup node from node version file
@@ -203,7 +203,7 @@ jobs:
203203
strategy:
204204
fail-fast: false
205205
matrix:
206-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
206+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
207207
node-version: [17, 19]
208208
steps:
209209
- uses: actions/checkout@v5
@@ -220,7 +220,7 @@ jobs:
220220
strategy:
221221
fail-fast: false
222222
matrix:
223-
os: [ubuntu-latest, windows-latest, macos-13]
223+
os: [ubuntu-latest, windows-latest, macos-latest-large]
224224
steps:
225225
- uses: actions/checkout@v5
226226
# test old versions which didn't have npm and layout different
@@ -250,7 +250,7 @@ jobs:
250250
strategy:
251251
fail-fast: false
252252
matrix:
253-
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
253+
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
254254
node-version: [current, latest, node]
255255
steps:
256256
- name: Get node version

0 commit comments

Comments
 (0)