Compare commits

...

3 Commits

Author SHA1 Message Date
Raphaël
eef922ffd1
Merge 7d1c5630d8 into eff380dfbc 2024-05-24 10:06:21 +02:00
HarithaVattikuti
eff380dfbc
Fix macos latest check failures (#1041)
* Update latest node versions

* Update latest node versions

* Update test data

* Update test data

* Update test data

* Update test data

* Update test data

* macos lts failure fix

* Update macos-13
2024-05-22 08:12:24 -05:00
Raphaël
7d1c5630d8
Explicitly exit the process to not wait for hanging promises
See https://github.com/actions/setup-node/issues/878
2023-11-27 16:08:54 +01:00
14 changed files with 62 additions and 27 deletions

View File

@ -19,7 +19,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Clean global cache - name: Clean global cache
@ -42,7 +42,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install pnpm - name: Install pnpm
@ -75,7 +75,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [14, 16] node-version: [18, 20]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Yarn version - name: Yarn version
@ -107,7 +107,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Update yarn - name: Update yarn
@ -139,7 +139,7 @@ jobs:
name: Test yarn subprojects name: Test yarn subprojects
strategy: strategy:
matrix: matrix:
node-version: [12, 14, 16] node-version: [18, 20, 22]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -166,7 +166,7 @@ jobs:
name: Test yarn subprojects all locally managed name: Test yarn subprojects all locally managed
strategy: strategy:
matrix: matrix:
node-version: [12, 14, 16] node-version: [18, 20, 22]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -193,7 +193,7 @@ jobs:
name: Test yarn subprojects some locally managed name: Test yarn subprojects some locally managed
strategy: strategy:
matrix: matrix:
node-version: [12, 14, 16] node-version: [18, 20, 22]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -220,7 +220,7 @@ jobs:
name: Test yarn subprojects managed by git name: Test yarn subprojects managed by git
strategy: strategy:
matrix: matrix:
node-version: [12, 14, 16] node-version: [18, 20, 22]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@ -18,7 +18,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
@ -34,7 +34,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-13]
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1] node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -43,7 +43,7 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
check-latest: true check-latest: true
- if: runner.os != 'Windows' - if: runner.os != 'Windows' && runner.os != 'macOS'
name: Verify node and npm name: Verify node and npm
run: | run: |
. "$NVM_DIR/nvm.sh" . "$NVM_DIR/nvm.sh"
@ -83,7 +83,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: node-version:
[16.0.0-nightly20210420a0261d231c, 17-nightly, 18.0.0-nightly] [20.11.0-nightly202312211a0be537da, 21-nightly, 18.0.0-nightly]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
@ -103,7 +103,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0] node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
@ -123,7 +123,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10.15, 12.16.0, 14.2.0, 16.3.0] node-version: [18.20.0, 20.10.0, 22.0.0]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
@ -140,7 +140,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [10, 12, 14] node-version: [18, 20, 22]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node and check latest - name: Setup Node and check latest
@ -167,7 +167,7 @@ jobs:
with: with:
node-version-file: '__tests__/data/${{ matrix.node-version-file }}' node-version-file: '__tests__/data/${{ matrix.node-version-file }}'
- name: Verify node - name: Verify node
run: __tests__/verify-node.sh 14 run: __tests__/verify-node.sh 20
version-file-volta: version-file-volta:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -182,7 +182,7 @@ jobs:
with: with:
node-version-file: '__tests__/data/package-volta.json' node-version-file: '__tests__/data/package-volta.json'
- name: Verify node - name: Verify node
run: __tests__/verify-node.sh 16 run: __tests__/verify-node.sh 20
version-file-volta-extends: version-file-volta-extends:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -197,7 +197,7 @@ jobs:
with: with:
node-version-file: '__tests__/data/package-volta-extends.json' node-version-file: '__tests__/data/package-volta-extends.json'
- name: Verify node - name: Verify node
run: __tests__/verify-node.sh 16 run: __tests__/verify-node.sh 20
node-dist: node-dist:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -205,7 +205,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [11, 13] node-version: [17, 19]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup Node from dist - name: Setup Node from dist
@ -221,7 +221,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-13]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# test old versions which didn't have npm and layout different # test old versions which didn't have npm and layout different
@ -237,10 +237,10 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup node 14 x86 from dist - name: Setup node 20 x86 from dist
uses: ./ uses: ./
with: with:
node-version: '14' node-version: '20'
architecture: 'x86' architecture: 'x86'
- name: Verify node - name: Verify node
run: __tests__/verify-arch.sh "ia32" run: __tests__/verify-arch.sh "ia32"

View File

@ -46,6 +46,7 @@ describe('setup-node', () => {
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance;
let getJsonSpy: jest.SpyInstance; let getJsonSpy: jest.SpyInstance;
let processExitSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -63,6 +64,9 @@ describe('setup-node', () => {
archSpy = jest.spyOn(osm, 'arch'); archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']); archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync'); execSpy = jest.spyOn(cp, 'execSync');
processExitSpy = jest
.spyOn(process, 'exit')
.mockImplementation((() => {}) as () => never);
// @actions/tool-cache // @actions/tool-cache
findSpy = jest.spyOn(tc, 'find'); findSpy = jest.spyOn(tc, 'find');

View File

@ -1 +1 @@
v14 v20

View File

@ -1 +1 @@
nodejs 14.0.0 nodejs 20.0.0

View File

@ -1 +1 @@
node 14.0.0 node 20.0.0

View File

@ -3,6 +3,6 @@
"node": "^14.0.0" "node": "^14.0.0"
}, },
"volta": { "volta": {
"node": "16.0.0" "node": "20.0.0"
} }
} }

View File

@ -1,5 +1,5 @@
{ {
"engines": { "engines": {
"node": "^14.0.0" "node": "^20.0.0"
} }
} }

View File

@ -38,6 +38,8 @@ describe('main tests', () => {
let setupNodeJsSpy: jest.SpyInstance; let setupNodeJsSpy: jest.SpyInstance;
let processExitSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
inputs = {}; inputs = {};
@ -76,6 +78,10 @@ describe('main tests', () => {
setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs'); setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs');
setupNodeJsSpy.mockImplementation(() => {}); setupNodeJsSpy.mockImplementation(() => {});
processExitSpy = jest
.spyOn(process, 'exit')
.mockImplementation((() => {}) as () => never);
}); });
afterEach(() => { afterEach(() => {
@ -237,6 +243,12 @@ describe('main tests', () => {
`::error::The specified node version file at: ${versionFilePath} does not exist${osm.EOL}` `::error::The specified node version file at: ${versionFilePath} does not exist${osm.EOL}`
); );
}); });
it('should call process.exit() explicitly after running', async () => {
await main.run();
expect(processExitSpy).toHaveBeenCalled();
});
}); });
describe('cache on GHES', () => { describe('cache on GHES', () => {

View File

@ -46,6 +46,7 @@ describe('setup-node', () => {
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance;
let getJsonSpy: jest.SpyInstance; let getJsonSpy: jest.SpyInstance;
let processExitSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -64,6 +65,9 @@ describe('setup-node', () => {
archSpy = jest.spyOn(osm, 'arch'); archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']); archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync'); execSpy = jest.spyOn(cp, 'execSync');
processExitSpy = jest
.spyOn(process, 'exit')
.mockImplementation((() => {}) as () => never);
// @actions/tool-cache // @actions/tool-cache
findSpy = jest.spyOn(tc, 'find'); findSpy = jest.spyOn(tc, 'find');

View File

@ -46,6 +46,7 @@ describe('setup-node', () => {
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance;
let getJsonSpy: jest.SpyInstance; let getJsonSpy: jest.SpyInstance;
let processExitSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -63,6 +64,9 @@ describe('setup-node', () => {
archSpy = jest.spyOn(osm, 'arch'); archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']); archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync'); execSpy = jest.spyOn(cp, 'execSync');
processExitSpy = jest
.spyOn(process, 'exit')
.mockImplementation((() => {}) as () => never);
// @actions/tool-cache // @actions/tool-cache
findSpy = jest.spyOn(tc, 'find'); findSpy = jest.spyOn(tc, 'find');

View File

@ -41,6 +41,7 @@ describe('setup-node', () => {
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance;
let getJsonSpy: jest.SpyInstance; let getJsonSpy: jest.SpyInstance;
let processExitSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -58,6 +59,9 @@ describe('setup-node', () => {
archSpy = jest.spyOn(osm, 'arch'); archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']); archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync'); execSpy = jest.spyOn(cp, 'execSync');
processExitSpy = jest
.spyOn(process, 'exit')
.mockImplementation((() => {}) as () => never);
// @actions/tool-cache // @actions/tool-cache
findSpy = jest.spyOn(tc, 'find'); findSpy = jest.spyOn(tc, 'find');

3
dist/setup/index.js vendored
View File

@ -94261,6 +94261,9 @@ function run() {
catch (err) { catch (err) {
core.setFailed(err.message); core.setFailed(err.message);
} }
// Explicit process.exit() to not wait for hanging promises,
// see https://github.com/actions/setup-node/issues/878
process.exit();
}); });
} }
exports.run = run; exports.run = run;

View File

@ -76,6 +76,10 @@ export async function run() {
} catch (err) { } catch (err) {
core.setFailed((err as Error).message); core.setFailed((err as Error).message);
} }
// Explicit process.exit() to not wait for hanging promises,
// see https://github.com/actions/setup-node/issues/878
process.exit();
} }
function resolveVersionInput(): string { function resolveVersionInput(): string {