@@ -34,18 +34,65 @@ jobs:
3434 git config --global user.name "npm CLI robot"
3535 - name : Setup Node
3636 uses : actions/setup-node@v3
37+ id : node
3738 with :
38- node-version : 18.x
39+ node-version : 20.x
40+ check-latest : contains('20.x', '.x')
3941 cache : npm
40- check-latest : true
42+
43+ # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
44+ - name : Update Windows npm
45+ if : |
46+ matrix.platform.os == 'windows-latest' && (
47+ startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
48+ )
49+ run : |
50+ curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
51+ tar xf npm-7.5.4.tgz
52+ cd package
53+ node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
54+ cd ..
55+ rmdir /s /q package
56+
57+ # Start on Node 10 because we dont test on anything lower
58+ - name : Install npm@7 on Node 10
59+ shell : bash
60+ if : startsWith(steps.node.outputs.node-version, 'v10.')
61+ id : npm-7
62+ run : |
63+ npm i --prefer-online --no-fund --no-audit -g npm@7
64+ echo "updated=true" >> "$GITHUB_OUTPUT"
65+
66+ - name : Install npm@8 on Node 12
67+ shell : bash
68+ if : startsWith(steps.node.outputs.node-version, 'v12.')
69+ id : npm-8
70+ run : |
71+ npm i --prefer-online --no-fund --no-audit -g npm@8
72+ echo "updated=true" >> "$GITHUB_OUTPUT"
73+
74+ - name : Install npm@9 on Node 14/16/18.0
75+ shell : bash
76+ if : startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
77+ id : npm-9
78+ run : |
79+ npm i --prefer-online --no-fund --no-audit -g npm@9
80+ echo "updated=true" >> "$GITHUB_OUTPUT"
81+
82+ - name : Install npm@latest on Node
83+ if : ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
84+ run : npm i --prefer-online --no-fund --no-audit -g npm@latest
85+
86+ - name : npm Version
87+ run : npm -v
4188 - name : Check Git Status
4289 run : node scripts/git-dirty.js
4390 - name : Reset Deps
4491 run : node scripts/resetdeps.js
4592 - name : Lint
46- run : node . run lint --ignore-scripts -w libnpmfund
93+ run : npm run lint --ignore-scripts -w libnpmfund
4794 - name : Post Lint
48- run : node . run postlint --ignore-scripts -w libnpmfund
95+ run : npm run postlint --ignore-scripts -w libnpmfund
4996
5097 test :
5198 name : Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
70117 - 16.x
71118 - 18.0.0
72119 - 18.x
120+ - 20.x
73121 runs-on : ${{ matrix.platform.os }}
74122 defaults :
75123 run :
@@ -83,17 +131,64 @@ jobs:
83131 git config --global user.name "npm CLI robot"
84132 - name : Setup Node
85133 uses : actions/setup-node@v3
134+ id : node
86135 with :
87136 node-version : ${{ matrix.node-version }}
137+ check-latest : contains(matrix.node-version, '.x')
88138 cache : npm
89- check-latest : true
139+
140+ # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
141+ - name : Update Windows npm
142+ if : |
143+ matrix.platform.os == 'windows-latest' && (
144+ startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
145+ )
146+ run : |
147+ curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
148+ tar xf npm-7.5.4.tgz
149+ cd package
150+ node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
151+ cd ..
152+ rmdir /s /q package
153+
154+ # Start on Node 10 because we dont test on anything lower
155+ - name : Install npm@7 on Node 10
156+ shell : bash
157+ if : startsWith(steps.node.outputs.node-version, 'v10.')
158+ id : npm-7
159+ run : |
160+ npm i --prefer-online --no-fund --no-audit -g npm@7
161+ echo "updated=true" >> "$GITHUB_OUTPUT"
162+
163+ - name : Install npm@8 on Node 12
164+ shell : bash
165+ if : startsWith(steps.node.outputs.node-version, 'v12.')
166+ id : npm-8
167+ run : |
168+ npm i --prefer-online --no-fund --no-audit -g npm@8
169+ echo "updated=true" >> "$GITHUB_OUTPUT"
170+
171+ - name : Install npm@9 on Node 14/16/18.0
172+ shell : bash
173+ if : startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
174+ id : npm-9
175+ run : |
176+ npm i --prefer-online --no-fund --no-audit -g npm@9
177+ echo "updated=true" >> "$GITHUB_OUTPUT"
178+
179+ - name : Install npm@latest on Node
180+ if : ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
181+ run : npm i --prefer-online --no-fund --no-audit -g npm@latest
182+
183+ - name : npm Version
184+ run : npm -v
90185 - name : Check Git Status
91186 run : node scripts/git-dirty.js
92187 - name : Reset Deps
93188 run : node scripts/resetdeps.js
94189 - name : Add Problem Matcher
95190 run : echo "::add-matcher::.github/matchers/tap.json"
96191 - name : Test
97- run : node . test --ignore-scripts -w libnpmfund
192+ run : npm test --ignore-scripts -w libnpmfund
98193 - name : Check Git Status
99194 run : node scripts/git-dirty.js
0 commit comments