mirror of
https://gitea.com/actions/setup-node.git
synced 2025-09-01 08:29:10 +08:00
Compare commits
16 Commits
update-tem
...
v3.8.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1a4442cacd | ||
![]() |
6e9e44895f | ||
![]() |
e52912ef25 | ||
![]() |
ac16ae42d7 | ||
![]() |
5a8d9111e3 | ||
![]() |
9e956a555c | ||
![]() |
7da2a7eb0c | ||
![]() |
2a017f350d | ||
![]() |
72c43c2d8f | ||
![]() |
d3ace34546 | ||
![]() |
acbf0586b1 | ||
![]() |
f1744b62b7 | ||
![]() |
2651591c72 | ||
![]() |
5e21ff4d9b | ||
![]() |
bea5baf987 | ||
![]() |
d82f92a0eb |
6
.github/workflows/e2e-cache.yml
vendored
6
.github/workflows/e2e-cache.yml
vendored
@@ -98,8 +98,8 @@ jobs:
|
|||||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
node-yarn2-depencies-caching:
|
node-yarn3-depencies-caching:
|
||||||
name: Test yarn 2 (Node ${{ matrix.node-version}}, ${{ matrix.os }})
|
name: Test yarn 3 (Node ${{ matrix.node-version}}, ${{ matrix.os }})
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
||||||
@@ -111,7 +111,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Update yarn
|
- name: Update yarn
|
||||||
run: yarn set version berry
|
run: yarn set version 3.6.4
|
||||||
- name: Yarn version
|
- name: Yarn version
|
||||||
run: yarn --version
|
run: yarn --version
|
||||||
- name: Generate simple .yarnrc.yml
|
- name: Generate simple .yarnrc.yml
|
||||||
|
2
.licenses/npm/@actions/cache.dep.yml
generated
2
.licenses/npm/@actions/cache.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/cache"
|
name: "@actions/cache"
|
||||||
version: 3.2.1
|
version: 3.2.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions cache lib
|
summary: Actions cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||||
|
2
.licenses/npm/@actions/core.dep.yml
generated
2
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: "@actions/core"
|
||||||
version: 1.10.0
|
version: 1.10.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
32
.licenses/npm/@actions/http-client-2.2.0.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client-2.2.0.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/http-client"
|
||||||
|
version: 2.2.0
|
||||||
|
type: npm
|
||||||
|
summary: Actions Http Client
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
30
.licenses/npm/@fastify/busboy.dep.yml
generated
Normal file
30
.licenses/npm/@fastify/busboy.dep.yml
generated
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
name: "@fastify/busboy"
|
||||||
|
version: 2.0.0
|
||||||
|
type: npm
|
||||||
|
summary: A streaming parser for HTML form data for node.js
|
||||||
|
homepage:
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |-
|
||||||
|
Copyright Brian White. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
notices: []
|
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: semver
|
name: semver
|
||||||
version: 5.7.0
|
version: 5.7.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: The semantic version parser used by npm.
|
summary: The semantic version parser used by npm.
|
||||||
homepage: https://github.com/npm/node-semver#readme
|
homepage:
|
||||||
license: isc
|
license: isc
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
2
.licenses/npm/signal-exit.dep.yml
generated
2
.licenses/npm/signal-exit.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: signal-exit
|
name: signal-exit
|
||||||
version: 3.0.2
|
version: 3.0.7
|
||||||
type: npm
|
type: npm
|
||||||
summary: when you want to fire an event no matter how a process exits.
|
summary: when you want to fire an event no matter how a process exits.
|
||||||
homepage: https://github.com/tapjs/signal-exit
|
homepage: https://github.com/tapjs/signal-exit
|
||||||
|
34
.licenses/npm/undici.dep.yml
generated
Normal file
34
.licenses/npm/undici.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: undici
|
||||||
|
version: 5.26.5
|
||||||
|
type: npm
|
||||||
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
|
homepage: https://undici.nodejs.org
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: MIT
|
||||||
|
notices: []
|
@@ -92,6 +92,9 @@ describe('run', () => {
|
|||||||
|
|
||||||
it('Package manager is not valid, skip caching', async () => {
|
it('Package manager is not valid, skip caching', async () => {
|
||||||
inputs['cache'] = 'yarn3';
|
inputs['cache'] = 'yarn3';
|
||||||
|
getStateSpy.mockImplementation(key =>
|
||||||
|
key === State.CachePackageManager ? inputs['cache'] : ''
|
||||||
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
@@ -108,7 +111,9 @@ describe('run', () => {
|
|||||||
it('should not save cache for yarn1', async () => {
|
it('should not save cache for yarn1', async () => {
|
||||||
inputs['cache'] = 'yarn';
|
inputs['cache'] = 'yarn';
|
||||||
getStateSpy.mockImplementation(key =>
|
getStateSpy.mockImplementation(key =>
|
||||||
key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
@@ -117,8 +122,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
@@ -130,7 +135,9 @@ describe('run', () => {
|
|||||||
it('should not save cache for yarn2', async () => {
|
it('should not save cache for yarn2', async () => {
|
||||||
inputs['cache'] = 'yarn';
|
inputs['cache'] = 'yarn';
|
||||||
getStateSpy.mockImplementation(key =>
|
getStateSpy.mockImplementation(key =>
|
||||||
key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
@@ -139,8 +146,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
expect(infoSpy).toHaveBeenCalledWith(
|
||||||
@@ -152,7 +159,9 @@ describe('run', () => {
|
|||||||
it('should not save cache for npm', async () => {
|
it('should not save cache for npm', async () => {
|
||||||
inputs['cache'] = 'npm';
|
inputs['cache'] = 'npm';
|
||||||
getStateSpy.mockImplementation(key =>
|
getStateSpy.mockImplementation(key =>
|
||||||
key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
@@ -162,8 +171,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
@@ -172,7 +181,9 @@ describe('run', () => {
|
|||||||
it('should not save cache for pnpm', async () => {
|
it('should not save cache for pnpm', async () => {
|
||||||
inputs['cache'] = 'pnpm';
|
inputs['cache'] = 'pnpm';
|
||||||
getStateSpy.mockImplementation(key =>
|
getStateSpy.mockImplementation(key =>
|
||||||
key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
@@ -181,8 +192,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||||
@@ -193,7 +204,9 @@ describe('run', () => {
|
|||||||
it('saves cache from yarn 1', async () => {
|
it('saves cache from yarn 1', async () => {
|
||||||
inputs['cache'] = 'yarn';
|
inputs['cache'] = 'yarn';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
@@ -204,8 +217,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
@@ -221,7 +234,9 @@ describe('run', () => {
|
|||||||
it('saves cache from yarn 2', async () => {
|
it('saves cache from yarn 2', async () => {
|
||||||
inputs['cache'] = 'yarn';
|
inputs['cache'] = 'yarn';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
@@ -232,8 +247,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
@@ -249,7 +264,9 @@ describe('run', () => {
|
|||||||
it('saves cache from npm', async () => {
|
it('saves cache from npm', async () => {
|
||||||
inputs['cache'] = 'npm';
|
inputs['cache'] = 'npm';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
@@ -260,8 +277,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
@@ -277,7 +294,9 @@ describe('run', () => {
|
|||||||
it('saves cache from pnpm', async () => {
|
it('saves cache from pnpm', async () => {
|
||||||
inputs['cache'] = 'pnpm';
|
inputs['cache'] = 'pnpm';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? pnpmFileHash
|
? pnpmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
@@ -288,8 +307,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
@@ -305,7 +324,9 @@ describe('run', () => {
|
|||||||
it('save with -1 cacheId , should not fail workflow', async () => {
|
it('save with -1 cacheId , should not fail workflow', async () => {
|
||||||
inputs['cache'] = 'npm';
|
inputs['cache'] = 'npm';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
@@ -319,8 +340,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
@@ -336,7 +357,9 @@ describe('run', () => {
|
|||||||
it('saves with error from toolkit, should fail workflow', async () => {
|
it('saves with error from toolkit, should fail workflow', async () => {
|
||||||
inputs['cache'] = 'npm';
|
inputs['cache'] = 'npm';
|
||||||
getStateSpy.mockImplementation((key: string) =>
|
getStateSpy.mockImplementation((key: string) =>
|
||||||
key === State.CacheMatchedKey
|
key === State.CachePackageManager
|
||||||
|
? inputs['cache']
|
||||||
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
@@ -350,8 +373,8 @@ describe('run', () => {
|
|||||||
|
|
||||||
await run();
|
await run();
|
||||||
|
|
||||||
expect(getInputSpy).toHaveBeenCalled();
|
expect(getInputSpy).not.toHaveBeenCalled();
|
||||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
expect(getStateSpy).toHaveBeenCalledTimes(4);
|
||||||
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
expect(getCommandOutputSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(debugSpy).toHaveBeenCalledTimes(0);
|
expect(debugSpy).toHaveBeenCalledTimes(0);
|
||||||
expect(infoSpy).not.toHaveBeenCalledWith(
|
expect(infoSpy).not.toHaveBeenCalledWith(
|
||||||
|
@@ -357,6 +357,41 @@ describe('setup-node', () => {
|
|||||||
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
|
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('reports when download failed but version exists', async () => {
|
||||||
|
os.platform = 'linux';
|
||||||
|
os.arch = 'x64';
|
||||||
|
|
||||||
|
// a version which is not in the manifest but is in node dist
|
||||||
|
const versionSpec = '11.15.0';
|
||||||
|
|
||||||
|
inputs['node-version'] = versionSpec;
|
||||||
|
inputs['always-auth'] = false;
|
||||||
|
inputs['token'] = 'faketoken';
|
||||||
|
|
||||||
|
// ... but not in the local cache
|
||||||
|
findSpy.mockImplementation(() => '');
|
||||||
|
|
||||||
|
dlSpy.mockImplementationOnce(async () => {
|
||||||
|
throw new tc.HTTPError(404);
|
||||||
|
});
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(getManifestSpy).toHaveBeenCalled();
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
`Attempting to download ${versionSpec}...`
|
||||||
|
);
|
||||||
|
expect(logSpy).toHaveBeenCalledWith(
|
||||||
|
'Not found in manifest. Falling back to download directly from Node'
|
||||||
|
);
|
||||||
|
expect(dlSpy).toHaveBeenCalled();
|
||||||
|
expect(warningSpy).toHaveBeenCalledWith(
|
||||||
|
`Node version ${versionSpec} for platform ${os.platform} and architecture ${os.arch} was found but failed to download. ` +
|
||||||
|
'This usually happens when downloadable binaries are not fully updated at https://nodejs.org/. ' +
|
||||||
|
'To resolve this issue you may either fall back to the older version or try again later.'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('acquires specified architecture of node', async () => {
|
it('acquires specified architecture of node', async () => {
|
||||||
for (const {arch, version, osSpec} of [
|
for (const {arch, version, osSpec} of [
|
||||||
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
{arch: 'x86', version: '12.16.2', osSpec: 'win32'},
|
||||||
|
23269
dist/cache-save/index.js
vendored
23269
dist/cache-save/index.js
vendored
File diff suppressed because one or more lines are too long
24584
dist/setup/index.js
vendored
24584
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
5568
package-lock.json
generated
5568
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -37,22 +37,22 @@
|
|||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^29.5.6",
|
||||||
"@types/node": "^16.11.25",
|
"@types/node": "^16.11.25",
|
||||||
"@types/semver": "^6.0.0",
|
"@types/semver": "^6.0.0",
|
||||||
"@types/uuid": "^9.0.3",
|
"@types/uuid": "^9.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||||
"@typescript-eslint/parser": "^5.54.0",
|
"@typescript-eslint/parser": "^5.54.0",
|
||||||
"@vercel/ncc": "^0.33.4",
|
"@vercel/ncc": "^0.38.0",
|
||||||
"eslint": "^8.35.0",
|
"eslint": "^8.35.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-jest": "^27.2.1",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"jest": "^27.2.5",
|
"jest": "^29.7.0",
|
||||||
"jest-circus": "^27.2.5",
|
"jest-circus": "^29.7.0",
|
||||||
"jest-each": "^27.2.5",
|
"jest-each": "^29.7.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^2.8.4",
|
||||||
"ts-jest": "^27.0.5",
|
"ts-jest": "^29.1.1",
|
||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
|
|
||||||
import fs from 'fs';
|
|
||||||
|
|
||||||
import {State} from './constants';
|
import {State} from './constants';
|
||||||
import {getPackageManagerInfo} from './cache-utils';
|
import {getPackageManagerInfo} from './cache-utils';
|
||||||
|
|
||||||
@@ -16,20 +14,19 @@ process.on('uncaughtException', e => {
|
|||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
const cacheLock = core.getInput('cache');
|
const cacheLock = core.getState(State.CachePackageManager);
|
||||||
await cachePackages(cacheLock);
|
await cachePackages(cacheLock);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed((error as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachePackages = async (packageManager: string) => {
|
const cachePackages = async (packageManager: string) => {
|
||||||
const state = core.getState(State.CacheMatchedKey);
|
const state = core.getState(State.CacheMatchedKey);
|
||||||
const primaryKey = core.getState(State.CachePrimaryKey);
|
const primaryKey = core.getState(State.CachePrimaryKey);
|
||||||
let cachePaths = JSON.parse(
|
const cachePaths = JSON.parse(
|
||||||
core.getState(State.CachePaths) || '[]'
|
core.getState(State.CachePaths) || '[]'
|
||||||
) as string[];
|
) as string[];
|
||||||
cachePaths = cachePaths.filter(fs.existsSync);
|
|
||||||
|
|
||||||
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
||||||
if (!packageManagerInfo) {
|
if (!packageManagerInfo) {
|
||||||
|
@@ -5,6 +5,7 @@ export enum LockType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum State {
|
export enum State {
|
||||||
|
CachePackageManager = 'SETUP_NODE_CACHE_PACKAGE_MANAGER',
|
||||||
CachePrimaryKey = 'CACHE_KEY',
|
CachePrimaryKey = 'CACHE_KEY',
|
||||||
CacheMatchedKey = 'CACHE_RESULT',
|
CacheMatchedKey = 'CACHE_RESULT',
|
||||||
CachePaths = 'CACHE_PATHS'
|
CachePaths = 'CACHE_PATHS'
|
||||||
|
@@ -18,6 +18,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
let manifest: tc.IToolRelease[] | undefined;
|
let manifest: tc.IToolRelease[] | undefined;
|
||||||
let nodeJsVersions: INodeVersion[] | undefined;
|
let nodeJsVersions: INodeVersion[] | undefined;
|
||||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
|
|
||||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||||
core.info('Attempt to resolve LTS alias from manifest...');
|
core.info('Attempt to resolve LTS alias from manifest...');
|
||||||
|
|
||||||
@@ -61,63 +62,57 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
|
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
} else {
|
this.addToolPath(toolPath);
|
||||||
let downloadPath = '';
|
return;
|
||||||
try {
|
}
|
||||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
|
||||||
|
|
||||||
const versionInfo = await this.getInfoFromManifest(
|
let downloadPath = '';
|
||||||
this.nodeInfo.versionSpec,
|
try {
|
||||||
this.nodeInfo.stable,
|
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||||
osArch,
|
|
||||||
manifest
|
const versionInfo = await this.getInfoFromManifest(
|
||||||
|
this.nodeInfo.versionSpec,
|
||||||
|
this.nodeInfo.stable,
|
||||||
|
osArch,
|
||||||
|
manifest
|
||||||
|
);
|
||||||
|
|
||||||
|
if (versionInfo) {
|
||||||
|
core.info(
|
||||||
|
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
||||||
|
);
|
||||||
|
downloadPath = await tc.downloadTool(
|
||||||
|
versionInfo.downloadUrl,
|
||||||
|
undefined,
|
||||||
|
this.nodeInfo.auth
|
||||||
);
|
);
|
||||||
if (versionInfo) {
|
|
||||||
core.info(
|
|
||||||
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
|
||||||
);
|
|
||||||
downloadPath = await tc.downloadTool(
|
|
||||||
versionInfo.downloadUrl,
|
|
||||||
undefined,
|
|
||||||
this.nodeInfo.auth
|
|
||||||
);
|
|
||||||
|
|
||||||
if (downloadPath) {
|
if (downloadPath) {
|
||||||
toolPath = await this.extractArchive(downloadPath, versionInfo);
|
toolPath = await this.extractArchive(downloadPath, versionInfo);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
core.info(
|
|
||||||
'Not found in manifest. Falling back to download directly from Node'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} else {
|
||||||
// Rate limit?
|
core.info(
|
||||||
if (
|
'Not found in manifest. Falling back to download directly from Node'
|
||||||
err instanceof tc.HTTPError &&
|
);
|
||||||
(err.httpStatusCode === 403 || err.httpStatusCode === 429)
|
|
||||||
) {
|
|
||||||
core.info(
|
|
||||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
core.info(err.message);
|
|
||||||
}
|
|
||||||
core.debug(err.stack);
|
|
||||||
core.info('Falling back to download directly from Node');
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Rate limit?
|
||||||
|
if (
|
||||||
|
err instanceof tc.HTTPError &&
|
||||||
|
(err.httpStatusCode === 403 || err.httpStatusCode === 429)
|
||||||
|
) {
|
||||||
|
core.info(
|
||||||
|
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
core.info((err as Error).message);
|
||||||
|
}
|
||||||
|
core.debug((err as Error).stack ?? 'empty stack');
|
||||||
|
core.info('Falling back to download directly from Node');
|
||||||
|
}
|
||||||
|
|
||||||
if (!toolPath) {
|
if (!toolPath) {
|
||||||
const nodeJsVersions = await this.getNodeJsVersions();
|
toolPath = await this.downloadDirectlyFromNode();
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
if (!evaluatedVersion) {
|
|
||||||
throw new Error(
|
|
||||||
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
|
||||||
toolPath = await this.downloadNodejs(toolName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.osPlat != 'win32') {
|
if (this.osPlat != 'win32') {
|
||||||
@@ -127,6 +122,43 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected addToolPath(toolPath: string) {
|
||||||
|
if (this.osPlat != 'win32') {
|
||||||
|
toolPath = path.join(toolPath, 'bin');
|
||||||
|
}
|
||||||
|
|
||||||
|
core.addPath(toolPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async downloadDirectlyFromNode() {
|
||||||
|
const nodeJsVersions = await this.getNodeJsVersions();
|
||||||
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
|
const evaluatedVersion = this.evaluateVersions(versions);
|
||||||
|
|
||||||
|
if (!evaluatedVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const toolPath = await this.downloadNodejs(toolName);
|
||||||
|
return toolPath;
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof tc.HTTPError && error.httpStatusCode === 404) {
|
||||||
|
core.warning(
|
||||||
|
`Node version ${this.nodeInfo.versionSpec} for platform ${this.osPlat} and architecture ${this.nodeInfo.arch} was found but failed to download. ` +
|
||||||
|
'This usually happens when downloadable binaries are not fully updated at https://nodejs.org/. ' +
|
||||||
|
'To resolve this issue you may either fall back to the older version or try again later.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected evaluateVersions(versions: string[]): string {
|
protected evaluateVersions(versions: string[]): string {
|
||||||
let version = '';
|
let version = '';
|
||||||
|
|
||||||
@@ -214,7 +246,7 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
return info?.resolvedVersion;
|
return info?.resolvedVersion;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.info('Unable to resolve version from manifest...');
|
core.info('Unable to resolve version from manifest...');
|
||||||
core.debug(err.message);
|
core.debug((err as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@ import {restoreCache} from './cache-restore';
|
|||||||
import {isCacheFeatureAvailable} from './cache-utils';
|
import {isCacheFeatureAvailable} from './cache-utils';
|
||||||
import {getNodejsDistribution} from './distributions/installer-factory';
|
import {getNodejsDistribution} from './distributions/installer-factory';
|
||||||
import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util';
|
import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util';
|
||||||
|
import {State} from './constants';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -60,6 +61,7 @@ export async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
|
core.saveState(State.CachePackageManager, cache);
|
||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
await restoreCache(cache, cacheDependencyPath);
|
await restoreCache(cache, cacheDependencyPath);
|
||||||
}
|
}
|
||||||
@@ -73,7 +75,7 @@ export async function run() {
|
|||||||
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.setFailed(err.message);
|
core.setFailed((err as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user