mirror of
https://github.com/actions/setup-node
synced 2025-04-20 07:03:11 +00:00
Merge pull request #10 from theomart77/dependabot/npm_and_yarn/y18n-4.0.1
Bump y18n from 4.0.0 to 4.0.1
This commit is contained in:
commit
f6a4f35362
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
.licenses/** -diff linguist-generated=true
|
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
32
.github/workflows/build-test.yml
vendored
Normal file
32
.github/workflows/build-test.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
name: build-test
|
||||
versions-manifest.json
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node 12
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format-check
|
||||
- run: npm test
|
||||
- name: Verify no unstaged changes
|
||||
if: runner.os != 'windows'
|
||||
run: __tests__/verify-no-unstaged-changes.sh
|
39
.github/workflows/deno.yml
vendored
Normal file
39
.github/workflows/deno.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# This workflow will install Deno and run tests across stable and nightly builds on Windows, Ubuntu and macOS.
|
||||
# For more information see: https://github.com/denolib/setup-deno
|
||||
|
||||
name: Deno
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
deno: ["v1.x", "nightly"]
|
||||
os: [macOS-latest, windows-latest, ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- name: Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Deno
|
||||
uses: denolib/setup-deno@c7d7968ad4a59c159a777f79adddad6872ee8d96
|
||||
with:
|
||||
deno-version: ${{ matrix.deno }} # tests across multiple Deno versions
|
||||
|
||||
- name: Cache Dependencies
|
||||
run: deno cache deps.ts
|
||||
|
||||
- name: Run Tests
|
||||
run: deno test -A --unstable
|
20
.github/workflows/licensed.yml
vendored
Normal file
20
.github/workflows/licensed.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Licensed
|
||||
|
||||
on:
|
||||
push: {branches: main}
|
||||
pull_request: {branches: main}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm ci
|
||||
- name: Install licensed
|
||||
run: |
|
||||
cd $RUNNER_TEMP
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||
sudo tar -xzf licensed.tar.gz
|
||||
sudo mv licensed /usr/local/bin/licensed
|
||||
- run: licensed status
|
56
.github/workflows/proxy.yml
vendored
Normal file
56
.github/workflows/proxy.yml
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
name: proxy
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
test-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
container:
|
||||
image: ubuntu:latest
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
image: datadog/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 10
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh 10
|
||||
|
||||
test-bypass-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
env:
|
||||
https_proxy: http://no-such-proxy:3128
|
||||
no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 11
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 11
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh 11
|
99
.github/workflows/versions.yml
vendored
Normal file
99
.github/workflows/versions.yml
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
name: versions
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
jobs:
|
||||
local-cache:
|
||||
runs no:action.yml
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10, 12, 14]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||
shell: bash
|
||||
|
||||
manifest:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10.15, 12.16.0, 14.2.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||
shell: bash
|
||||
|
||||
check-latest:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10, 11, 12, 14]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node and check latest
|
||||
uses: ./
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
check-latest: true
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||
shell: bash
|
||||
|
||||
node-dist:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [11, 13]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node from dist
|
||||
uses: ./
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||
shell: bash
|
||||
|
||||
old-versions:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# test old versions which didn't have npm and layout different
|
||||
- name: Setup node 0.12.18 from dist
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 0.12.18
|
||||
- name: Verify node
|
||||
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
|
||||
shell: bash
|
94
.github/workflows/workflow.yml
vendored
94
.github/workflows/workflow.yml
vendored
@ -1,94 +0,0 @@
|
||||
name: Main workflow
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- releases/*
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node 12
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format-check
|
||||
- run: npm test
|
||||
- name: Verify no unstaged changes
|
||||
if: runner.os != 'windows'
|
||||
run: __tests__/verify-no-unstaged-changes.sh
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 10
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh 10
|
||||
|
||||
test-fallback:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: mv "${{ runner.tool_cache }}" "${{ runner.tool_cache }}.old"
|
||||
- name: Setup node 0.12.18 # For non LTS versions of Node, the zip is not always available
|
||||
uses: ./ # and falls back to downloading node.exe and node.lib
|
||||
with:
|
||||
node-version: 0.12.18
|
||||
- name: Verify node
|
||||
shell: bash
|
||||
run: __tests__/verify-node.sh 0.12.18 SKIP_NPM
|
||||
|
||||
test-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:latest
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
image: datadog/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 10
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh 10
|
||||
|
||||
test-bypass-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
https_proxy: http://no-such-proxy:3128
|
||||
no_proxy: github.com,nodejs.org,registry.npmjs.org
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 10
|
||||
uses: ./
|
||||
with:
|
||||
node-version: 10.x
|
||||
- name: Verify node and npm
|
||||
run: __tests__/verify-node.sh 10
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,9 @@ node_modules/
|
||||
lib/
|
||||
__tests__/runner/*
|
||||
|
||||
validate/temp
|
||||
validate/node
|
||||
|
||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Logs
|
||||
logs
|
||||
|
14
.licensed.yml
Normal file
14
.licensed.yml
Normal file
@ -0,0 +1,14 @@
|
||||
sources:
|
||||
npm: true
|
||||
|
||||
allowed:
|
||||
- apache-2.0
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- isc
|
||||
- mit
|
||||
- cc0-1.0
|
||||
- unlicense
|
||||
|
||||
reviewed:
|
||||
npm:
|
BIN
.licenses/npm/@actions/core-1.2.4.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/core-1.2.4.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/core-1.2.6.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/core-1.2.6.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/github.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/github.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/http-client-1.0.6.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/http-client-1.0.6.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/http-client-1.0.8.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/http-client-1.0.8.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/tool-cache.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/tool-cache.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/auth-token.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/auth-token.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/types.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/types.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@types/node.dep.yml
generated
Normal file
BIN
.licenses/npm/@types/node.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/atob-lite.dep.yml
generated
Normal file
BIN
.licenses/npm/atob-lite.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/btoa-lite.dep.yml
generated
Normal file
BIN
.licenses/npm/btoa-lite.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/cross-spawn.dep.yml
generated
Normal file
BIN
.licenses/npm/cross-spawn.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/deprecation.dep.yml
generated
Normal file
BIN
.licenses/npm/deprecation.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/end-of-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/end-of-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/execa.dep.yml
generated
Normal file
BIN
.licenses/npm/execa.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/get-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/get-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/is-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/is-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/isexe.dep.yml
generated
Normal file
BIN
.licenses/npm/isexe.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/isobject.dep.yml
generated
Normal file
BIN
.licenses/npm/isobject.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.get.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.get.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.set.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.set.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/macos-release.dep.yml
generated
Normal file
BIN
.licenses/npm/macos-release.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/nice-try.dep.yml
generated
Normal file
BIN
.licenses/npm/nice-try.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
Normal file
BIN
.licenses/npm/node-fetch.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/npm-run-path.dep.yml
generated
Normal file
BIN
.licenses/npm/npm-run-path.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
Normal file
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/once.dep.yml
generated
Normal file
BIN
.licenses/npm/once.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/os-name.dep.yml
generated
Normal file
BIN
.licenses/npm/os-name.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/p-finally.dep.yml
generated
Normal file
BIN
.licenses/npm/p-finally.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/path-key.dep.yml
generated
Normal file
BIN
.licenses/npm/path-key.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/pump.dep.yml
generated
Normal file
BIN
.licenses/npm/pump.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/semver-5.7.0.dep.yml
generated
Normal file
BIN
.licenses/npm/semver-5.7.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/semver-6.1.2.dep.yml
generated
Normal file
BIN
.licenses/npm/semver-6.1.2.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/shebang-command.dep.yml
generated
Normal file
BIN
.licenses/npm/shebang-command.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/shebang-regex.dep.yml
generated
Normal file
BIN
.licenses/npm/shebang-regex.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/signal-exit.dep.yml
generated
Normal file
BIN
.licenses/npm/signal-exit.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/strip-eof.dep.yml
generated
Normal file
BIN
.licenses/npm/strip-eof.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/universal-user-agent-2.1.0.dep.yml
generated
Normal file
BIN
.licenses/npm/universal-user-agent-2.1.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/uuid.dep.yml
generated
Normal file
BIN
.licenses/npm/uuid.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/which.dep.yml
generated
Normal file
BIN
.licenses/npm/which.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/windows-release.dep.yml
generated
Normal file
BIN
.licenses/npm/windows-release.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
Binary file not shown.
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Jest Tests on Nix",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"runtimeArgs": [
|
||||
"--inspect-brk",
|
||||
"${workspaceRoot}/node_modules/.bin/jest",
|
||||
"--runInBand"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"port": 9229
|
||||
}
|
||||
]
|
||||
}
|
76
CONDUCT
Normal file
76
CONDUCT
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to make participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at opensource@github.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
49
README.md
49
README.md
@ -1,17 +1,36 @@
|
||||
# setup-node
|
||||
# node
|
||||
|
||||
<p align="left">
|
||||
<a href="https://github.com/actions/setup-node"><img alt="GitHub Actions status" src="https://github.com/actions/setup-node/workflows/Main%20workflow/badge.svg"></a>
|
||||
<a href="https://github.com/actions/setup-node/actions?query=workflow%3Abuild-test"><img alt="build-test status" src="https://github.com/actions/setup-node/workflows/build-test/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aversions"><img alt="versions status" src="https://github.com/actions/setup-node/workflows/versions/badge.svg"></a> <a href="https://github.com/actions/setup-node/actions?query=workflow%3Aproxy"><img alt="proxy status" src="https://github.com/actions/setup-node/workflows/proxy/badge.svg"></a>
|
||||
</p>
|
||||
|
||||
This action sets by node environment for use in actions by:
|
||||
|
||||
- optionally downloading and caching a version of node - npm by version spec and add to PATH
|
||||
- registering problem matchers for error output
|
||||
- registering problem matchers for error output
|
||||
- configuring authentication for GPR or npm
|
||||
|
||||
# v2-beta
|
||||
|
||||
A beta release which adds reliability for pulling node distributions from a cache of node releases is available by referencing the `v2-beta` tag.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2-beta
|
||||
with:
|
||||
node-version: '12'
|
||||
```
|
||||
|
||||
It will first check the local cache for a semver match. The hosted images have been updated with the latest of each LTS from v8, v10, v12, and v14. `self-hosted` machines will benefit from the cache as well only downloading once. It will pull LTS versions from `main` branch of [node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json) repository and on miss or failure, it will fall back to the previous behavior of download directly from [node dist](https://nodejs.org/dist/).
|
||||
|
||||
The `node-version` input is optional. If not supplied, node which is in your PATH will be used. However, this action will still register problem matchers and support auth features. So setting up the node environment is still a valid scenario without downloading and caching versions.
|
||||
|
||||
# Usage
|
||||
|
||||
See [action.yml](action.yml)
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2.1.4
|
||||
|
||||
Basic:
|
||||
```yaml
|
||||
@ -19,7 +38,21 @@ steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '10.x'
|
||||
node-version: '12'
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
Check latest version:
|
||||
> In basic example, without `check-latest` flag, the action tries to resolve version from local cache firstly and download only if it is not found. Local cache on image is updated with a couple of weeks latency.
|
||||
`check-latest` flag forces the action to check if the cached version is the latest one. It reduces latency significantly but it is much more likely to incur version downloading.
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '12'
|
||||
check-latest: true
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
@ -31,7 +64,7 @@ jobs:
|
||||
runs-on: ubuntu-16.04
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '10', '8' ]
|
||||
node: [ '10', '12' ]
|
||||
name: Node ${{ matrix.node }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -85,7 +118,7 @@ steps:
|
||||
|
||||
Use private packages:
|
||||
```yaml
|
||||
steps:
|
||||
steps:git clone https://github.com/XYOracleNetwork/sdk-core-nodejs
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
@ -108,3 +141,7 @@ The scripts and documentation in this project are released under the [MIT Licens
|
||||
# Contributions
|
||||
|
||||
Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
:wave: Be nice. See [our code of conduct](CONDUCT)
|
||||
|
@ -1,31 +0,0 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`installer tests Appends trailing slash to registry 1`] = `
|
||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
registry=https://registry.npmjs.org/
|
||||
always-auth=false"
|
||||
`;
|
||||
|
||||
exports[`installer tests Automatically configures GPR scope 1`] = `
|
||||
"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
@ownername:registry=npm.pkg.github.com/
|
||||
always-auth=false"
|
||||
`;
|
||||
|
||||
exports[`installer tests Configures scoped npm registries 1`] = `
|
||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
@myscope:registry=https://registry.npmjs.org/
|
||||
always-auth=false"
|
||||
`;
|
||||
|
||||
exports[`installer tests Sets up npmrc for always-auth true 1`] = `
|
||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
registry=https://registry.npmjs.org/
|
||||
always-auth=true"
|
||||
`;
|
||||
|
||||
exports[`installer tests Sets up npmrc for npmjs 1`] = `
|
||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
registry=https://registry.npmjs.org/
|
||||
always-auth=false"
|
||||
`;
|
@ -1,22 +1,28 @@
|
||||
import * as io from '@actions/io';
|
||||
import os = require('os');
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as auth from '../src/authutil';
|
||||
|
||||
let rcFile: string;
|
||||
|
||||
describe('installer tests', () => {
|
||||
describe('authutil tests', () => {
|
||||
const _runnerDir = path.join(__dirname, 'runner');
|
||||
|
||||
let cnSpy: jest.SpyInstance;
|
||||
let logSpy: jest.SpyInstance;
|
||||
let dbgSpy: jest.SpyInstance;
|
||||
|
||||
beforeAll(async () => {
|
||||
const tempDir = path.join(
|
||||
__dirname,
|
||||
'runner',
|
||||
path.join(
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(7)
|
||||
),
|
||||
'temp'
|
||||
const randPath = path.join(
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(7)
|
||||
);
|
||||
console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
|
||||
process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
|
||||
const tempDir = path.join(_runnerDir, randPath, 'temp');
|
||||
await io.rmRF(tempDir);
|
||||
await io.mkdirP(tempDir);
|
||||
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
|
||||
@ -24,44 +30,97 @@ describe('installer tests', () => {
|
||||
rcFile = path.join(tempDir, '.npmrc');
|
||||
}, 100000);
|
||||
|
||||
beforeEach(() => {
|
||||
if (fs.existsSync(rcFile)) {
|
||||
fs.unlinkSync(rcFile);
|
||||
}
|
||||
beforeEach(async () => {
|
||||
await io.rmRF(rcFile);
|
||||
// if (fs.existsSync(rcFile)) {
|
||||
// fs.unlinkSync(rcFile);
|
||||
// }
|
||||
process.env['INPUT_SCOPE'] = '';
|
||||
});
|
||||
|
||||
// writes
|
||||
cnSpy = jest.spyOn(process.stdout, 'write');
|
||||
logSpy = jest.spyOn(console, 'log');
|
||||
dbgSpy = jest.spyOn(core, 'debug');
|
||||
cnSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('write:' + line + '\n');
|
||||
});
|
||||
logSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('log:' + line + '\n');
|
||||
});
|
||||
dbgSpy.mockImplementation(msg => {
|
||||
// uncomment to see debug output
|
||||
// process.stderr.write(msg + '\n');
|
||||
});
|
||||
}, 100000);
|
||||
|
||||
function dbg(message: string) {
|
||||
process.stderr.write('dbg::' + message + '::\n');
|
||||
}
|
||||
|
||||
afterAll(async () => {
|
||||
if (_runnerDir) {
|
||||
await io.rmRF(_runnerDir);
|
||||
}
|
||||
console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions
|
||||
}, 100000);
|
||||
|
||||
function readRcFile(rcFile: string) {
|
||||
let rc = {};
|
||||
let contents = fs.readFileSync(rcFile, {encoding: 'utf8'});
|
||||
for (const line of contents.split(os.EOL)) {
|
||||
let parts = line.split('=');
|
||||
if (parts.length == 2) {
|
||||
rc[parts[0].trim()] = parts[1].trim();
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
it('Sets up npmrc for npmjs', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org/', 'false');
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
let contents = fs.readFileSync(rcFile, {encoding: 'utf8'});
|
||||
let rc = readRcFile(rcFile);
|
||||
expect(rc['registry']).toBe('https://registry.npmjs.org/');
|
||||
expect(rc['always-auth']).toBe('false');
|
||||
});
|
||||
|
||||
it('Appends trailing slash to registry', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
let rc = readRcFile(rcFile);
|
||||
expect(rc['registry']).toBe('https://registry.npmjs.org/');
|
||||
expect(rc['always-auth']).toBe('false');
|
||||
});
|
||||
|
||||
it('Configures scoped npm registries', async () => {
|
||||
process.env['INPUT_SCOPE'] = 'myScope';
|
||||
await auth.configAuthentication('https://registry.npmjs.org', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
let rc = readRcFile(rcFile);
|
||||
expect(rc['@myscope:registry']).toBe('https://registry.npmjs.org/');
|
||||
expect(rc['always-auth']).toBe('false');
|
||||
});
|
||||
|
||||
it('Automatically configures GPR scope', async () => {
|
||||
await auth.configAuthentication('npm.pkg.github.com', 'false');
|
||||
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
let rc = readRcFile(rcFile);
|
||||
expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/');
|
||||
expect(rc['always-auth']).toBe('false');
|
||||
});
|
||||
|
||||
it('Sets up npmrc for always-auth true', async () => {
|
||||
await auth.configAuthentication('https://registry.npmjs.org/', 'true');
|
||||
expect(fs.existsSync(rcFile)).toBe(true);
|
||||
expect(fs.readFileSync(rcFile, {encoding: 'utf8'})).toMatchSnapshot();
|
||||
expect(fs.statSync(rcFile)).toBeDefined();
|
||||
let rc = readRcFile(rcFile);
|
||||
expect(rc['registry']).toBe('https://registry.npmjs.org/');
|
||||
expect(rc['always-auth']).toBe('true');
|
||||
});
|
||||
});
|
||||
|
770
__tests__/data/node-dist-index.json
Normal file
770
__tests__/data/node-dist-index.json
Normal file
@ -0,0 +1,770 @@
|
||||
[
|
||||
{
|
||||
"version": "v14.1.0",
|
||||
"date": "2020-04-29",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "8.1.307.31",
|
||||
"uv": "1.37.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1g",
|
||||
"modules": "83",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v14.0.0",
|
||||
"date": "2020-04-21",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "8.1.307.30",
|
||||
"uv": "1.37.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1f",
|
||||
"modules": "83",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v13.14.0",
|
||||
"date": "2020-04-28",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "7.9.317.25",
|
||||
"uv": "1.37.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1g",
|
||||
"modules": "79",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v13.13.0",
|
||||
"date": "2020-04-14",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "7.9.317.25",
|
||||
"uv": "1.35.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1f",
|
||||
"modules": "79",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v12.16.3",
|
||||
"date": "2020-04-28",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "7.8.279.23",
|
||||
"uv": "1.34.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1g",
|
||||
"modules": "72",
|
||||
"lts": "Erbium",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v12.16.2",
|
||||
"date": "2020-04-08",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "7.8.279.23",
|
||||
"uv": "1.34.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1e",
|
||||
"modules": "72",
|
||||
"lts": "Erbium",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v12.1.0",
|
||||
"date": "2019-04-29",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.9.0",
|
||||
"v8": "7.4.288.21",
|
||||
"uv": "1.28.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1b",
|
||||
"modules": "72",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v11.15.0",
|
||||
"date": "2019-04-30",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.7.0",
|
||||
"v8": "7.0.276.38",
|
||||
"uv": "1.27.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1b",
|
||||
"modules": "67",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v10.20.1",
|
||||
"date": "2020-04-10",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "6.8.275.32",
|
||||
"uv": "1.34.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1e",
|
||||
"modules": "64",
|
||||
"lts": "Dubnium",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v10.20.0",
|
||||
"date": "2020-03-24",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.14.4",
|
||||
"v8": "6.8.275.32",
|
||||
"uv": "1.34.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.1.1e",
|
||||
"modules": "64",
|
||||
"lts": "Dubnium",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v9.11.2",
|
||||
"date": "2018-06-12",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "5.6.0",
|
||||
"v8": "6.2.414.46",
|
||||
"uv": "1.19.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2o",
|
||||
"modules": "59",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v9.11.1",
|
||||
"date": "2018-04-05",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "5.6.0",
|
||||
"v8": "6.2.414.46",
|
||||
"uv": "1.19.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2o",
|
||||
"modules": "59",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v8.17.0",
|
||||
"date": "2019-12-17",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.13.4",
|
||||
"v8": "6.2.414.78",
|
||||
"uv": "1.23.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2s",
|
||||
"modules": "57",
|
||||
"lts": "Carbon",
|
||||
"security": true
|
||||
},
|
||||
{
|
||||
"version": "v8.16.2",
|
||||
"date": "2019-10-08",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "6.4.1",
|
||||
"v8": "6.2.414.78",
|
||||
"uv": "1.23.2",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2s",
|
||||
"modules": "57",
|
||||
"lts": "Carbon",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v7.10.1",
|
||||
"date": "2017-07-11",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "4.2.0",
|
||||
"v8": "5.5.372.43",
|
||||
"uv": "1.11.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2k",
|
||||
"modules": "51",
|
||||
"lts": false,
|
||||
"security": true
|
||||
},
|
||||
{
|
||||
"version": "v7.10.0",
|
||||
"date": "2017-05-02",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "4.2.0",
|
||||
"v8": "5.5.372.43",
|
||||
"uv": "1.11.0",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2k",
|
||||
"modules": "51",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v6.17.1",
|
||||
"date": "2019-04-03",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "3.10.10",
|
||||
"v8": "5.1.281.111",
|
||||
"uv": "1.16.1",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2r",
|
||||
"modules": "48",
|
||||
"lts": "Boron",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v6.17.0",
|
||||
"date": "2019-02-28",
|
||||
"files": [
|
||||
"aix-ppc64",
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-s390x",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "3.10.10",
|
||||
"v8": "5.1.281.111",
|
||||
"uv": "1.16.1",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2r",
|
||||
"modules": "48",
|
||||
"lts": "Boron",
|
||||
"security": true
|
||||
},
|
||||
{
|
||||
"version": "v5.12.0",
|
||||
"date": "2016-06-23",
|
||||
"files": [
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi"
|
||||
],
|
||||
"npm": "3.8.6",
|
||||
"v8": "4.6.85.32",
|
||||
"uv": "1.8.0",
|
||||
"zlib": "1.2.8",
|
||||
"openssl": "1.0.2h",
|
||||
"modules": "47",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v4.9.1",
|
||||
"date": "2018-03-29",
|
||||
"files": [
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "2.15.11",
|
||||
"v8": "4.5.103.53",
|
||||
"uv": "1.9.1",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2o",
|
||||
"modules": "46",
|
||||
"lts": "Argon",
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v4.9.0",
|
||||
"date": "2018-03-28",
|
||||
"files": [
|
||||
"headers",
|
||||
"linux-arm64",
|
||||
"linux-armv6l",
|
||||
"linux-armv7l",
|
||||
"linux-ppc64le",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-7z",
|
||||
"win-x64-exe",
|
||||
"win-x64-msi",
|
||||
"win-x64-zip",
|
||||
"win-x86-7z",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi",
|
||||
"win-x86-zip"
|
||||
],
|
||||
"npm": "2.15.11",
|
||||
"v8": "4.5.103.53",
|
||||
"uv": "1.9.1",
|
||||
"zlib": "1.2.11",
|
||||
"openssl": "1.0.2o",
|
||||
"modules": "46",
|
||||
"lts": "Argon",
|
||||
"security": true
|
||||
},
|
||||
{
|
||||
"version": "v0.12.18",
|
||||
"date": "2017-02-22",
|
||||
"files": [
|
||||
"headers",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"osx-x86-tar",
|
||||
"src",
|
||||
"sunos-x86",
|
||||
"win-x64-exe",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi"
|
||||
],
|
||||
"npm": "2.15.11",
|
||||
"v8": "3.28.71.20",
|
||||
"uv": "1.6.1",
|
||||
"zlib": "1.2.8",
|
||||
"openssl": "1.0.1u",
|
||||
"modules": "14",
|
||||
"lts": false,
|
||||
"security": false
|
||||
},
|
||||
{
|
||||
"version": "v0.12.17",
|
||||
"date": "2016-10-18",
|
||||
"files": [
|
||||
"headers",
|
||||
"linux-x64",
|
||||
"linux-x86",
|
||||
"osx-x64-pkg",
|
||||
"osx-x64-tar",
|
||||
"osx-x86-tar",
|
||||
"src",
|
||||
"sunos-x64",
|
||||
"sunos-x86",
|
||||
"win-x64-exe",
|
||||
"win-x86-exe",
|
||||
"win-x86-msi"
|
||||
],
|
||||
"npm": "2.15.1",
|
||||
"v8": "3.28.71.19",
|
||||
"uv": "1.6.1",
|
||||
"zlib": "1.2.8",
|
||||
"openssl": "1.0.1u",
|
||||
"modules": "14",
|
||||
"lts": false,
|
||||
"security": true
|
||||
}
|
||||
]
|
152
__tests__/data/versions-manifest.json
Normal file
152
__tests__/data/versions-manifest.json
Normal file
@ -0,0 +1,152 @@
|
||||
[
|
||||
{
|
||||
"version": "14.0.0",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200423.30",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-14.0.0-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-14.0.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-14.0.0-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "13.13.0",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200423.29",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-13.13.0-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-13.13.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-13.13.0-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "12.16.2",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200423.28",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-12.16.2-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-12.16.2-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-12.16.2-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "10.20.1",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200423.27",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-10.20.1-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-10.20.1-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-10.20.1-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "8.17.0",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200423.26",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-8.17.0-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-8.17.0-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-8.17.0-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "6.17.1",
|
||||
"stable": true,
|
||||
"release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200423.25",
|
||||
"files": [
|
||||
{
|
||||
"filename": "node-6.17.1-darwin-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "darwin",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-darwin-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-6.17.1-linux-x64.tar.gz",
|
||||
"arch": "x64",
|
||||
"platform": "linux",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-linux-x64.tar.gz"
|
||||
},
|
||||
{
|
||||
"filename": "node-6.17.1-win32-x64.zip",
|
||||
"arch": "x64",
|
||||
"platform": "win32",
|
||||
"download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-win32-x64.zip"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
@ -1,123 +1,493 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as installer from '../src/installer';
|
||||
import fs from 'fs';
|
||||
import cp from 'child_process';
|
||||
import osm = require('os');
|
||||
import path from 'path';
|
||||
import * as main from '../src/main';
|
||||
import * as im from '../src/installer';
|
||||
import * as auth from '../src/authutil';
|
||||
import {context} from '@actions/github';
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
let toolDir: string;
|
||||
let nodeTestManifest = require('./data/versions-manifest.json');
|
||||
let nodeTestDist = require('./data/node-dist-index.json');
|
||||
|
||||
describe('installer tests', () => {
|
||||
beforeAll(async () => {
|
||||
toolDir = path.join(
|
||||
__dirname,
|
||||
'runner',
|
||||
path.join(
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(7)
|
||||
),
|
||||
'tools'
|
||||
// let matchers = require('../matchers.json');
|
||||
// let matcherPattern = matchers.problemMatcher[0].pattern[0];
|
||||
// let matcherRegExp = new RegExp(matcherPattern.regexp);
|
||||
|
||||
describe('setup-node', () => {
|
||||
let inputs = {} as any;
|
||||
let os = {} as any;
|
||||
|
||||
let inSpy: jest.SpyInstance;
|
||||
let findSpy: jest.SpyInstance;
|
||||
let cnSpy: jest.SpyInstance;
|
||||
let logSpy: jest.SpyInstance;
|
||||
let warningSpy: jest.SpyInstance;
|
||||
let getManifestSpy: jest.SpyInstance;
|
||||
let getDistSpy: jest.SpyInstance;
|
||||
let platSpy: jest.SpyInstance;
|
||||
let archSpy: jest.SpyInstance;
|
||||
let dlSpy: jest.SpyInstance;
|
||||
let exSpy: jest.SpyInstance;
|
||||
let cacheSpy: jest.SpyInstance;
|
||||
let dbgSpy: jest.SpyInstance;
|
||||
let whichSpy: jest.SpyInstance;
|
||||
let existsSpy: jest.SpyInstance;
|
||||
let mkdirpSpy: jest.SpyInstance;
|
||||
let execSpy: jest.SpyInstance;
|
||||
let authSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
// @actions/core
|
||||
console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
|
||||
process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out
|
||||
inputs = {};
|
||||
inSpy = jest.spyOn(core, 'getInput');
|
||||
inSpy.mockImplementation(name => inputs[name]);
|
||||
|
||||
// node
|
||||
os = {};
|
||||
platSpy = jest.spyOn(osm, 'platform');
|
||||
platSpy.mockImplementation(() => os['platform']);
|
||||
archSpy = jest.spyOn(osm, 'arch');
|
||||
archSpy.mockImplementation(() => os['arch']);
|
||||
execSpy = jest.spyOn(cp, 'execSync');
|
||||
|
||||
// @actions/tool-cache
|
||||
findSpy = jest.spyOn(tc, 'find');
|
||||
dlSpy = jest.spyOn(tc, 'downloadTool');
|
||||
exSpy = jest.spyOn(tc, 'extractTar');
|
||||
cacheSpy = jest.spyOn(tc, 'cacheDir');
|
||||
getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo');
|
||||
getDistSpy = jest.spyOn(im, 'getVersionsFromDist');
|
||||
|
||||
// io
|
||||
whichSpy = jest.spyOn(io, 'which');
|
||||
existsSpy = jest.spyOn(fs, 'existsSync');
|
||||
mkdirpSpy = jest.spyOn(io, 'mkdirP');
|
||||
|
||||
// disable authentication portion for installer tests
|
||||
authSpy = jest.spyOn(auth, 'configAuthentication');
|
||||
authSpy.mockImplementation(() => {});
|
||||
|
||||
// gets
|
||||
getManifestSpy.mockImplementation(
|
||||
() => <tc.IToolRelease[]>nodeTestManifest
|
||||
);
|
||||
const tempDir = path.join(
|
||||
__dirname,
|
||||
'runner',
|
||||
path.join(
|
||||
Math.random()
|
||||
.toString(36)
|
||||
.substring(7)
|
||||
),
|
||||
'temp'
|
||||
getDistSpy.mockImplementation(() => <im.INodeVersion>nodeTestDist);
|
||||
|
||||
// writes
|
||||
cnSpy = jest.spyOn(process.stdout, 'write');
|
||||
logSpy = jest.spyOn(core, 'info');
|
||||
dbgSpy = jest.spyOn(core, 'debug');
|
||||
warningSpy = jest.spyOn(core, 'warning');
|
||||
cnSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('write:' + line + '\n');
|
||||
});
|
||||
logSpy.mockImplementation(line => {
|
||||
// uncomment to debug
|
||||
// process.stderr.write('log:' + line + '\n');
|
||||
});
|
||||
dbgSpy.mockImplementation(msg => {
|
||||
// uncomment to see debug output
|
||||
// process.stderr.write(msg + '\n');
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
//jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions
|
||||
}, 100000);
|
||||
|
||||
//--------------------------------------------------
|
||||
// Manifest find tests
|
||||
//--------------------------------------------------
|
||||
it('can mock manifest versions', async () => {
|
||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
||||
'actions',
|
||||
'node-versions',
|
||||
'mocktoken'
|
||||
);
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
}, 100000);
|
||||
|
||||
it('Acquires version of node if no matching version is installed', async () => {
|
||||
await installer.getNode('10.16.0');
|
||||
const nodeDir = path.join(toolDir, 'node', '10.16.0', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
|
||||
if (isWindows) {
|
||||
expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(nodeDir, 'bin', 'node'))).toBe(true);
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
if (isWindows) {
|
||||
it('Falls back to backup location if first one doesnt contain correct version', async () => {
|
||||
await installer.getNode('5.10.1');
|
||||
const nodeDir = path.join(toolDir, 'node', '5.10.1', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
|
||||
}, 100000);
|
||||
|
||||
it('Falls back to third location if second one doesnt contain correct version', async () => {
|
||||
await installer.getNode('0.12.18');
|
||||
const nodeDir = path.join(toolDir, 'node', '0.12.18', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
|
||||
}, 100000);
|
||||
}
|
||||
|
||||
it('Throws if no location contains correct node version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await installer.getNode('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
expect(versions).toBeDefined();
|
||||
expect(versions?.length).toBe(6);
|
||||
});
|
||||
|
||||
it('Acquires version of node with long paths', async () => {
|
||||
const toolpath = await installer.getNode('8.8.1');
|
||||
const nodeDir = path.join(toolDir, 'node', '8.8.1', os.arch());
|
||||
|
||||
expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
|
||||
if (isWindows) {
|
||||
expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(nodeDir, 'bin', 'node'))).toBe(true);
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Uses version of node installed in cache', async () => {
|
||||
const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch());
|
||||
await io.mkdirP(nodeDir);
|
||||
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
|
||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||
await installer.getNode('250.0.0');
|
||||
return;
|
||||
it('can mock dist versions', async () => {
|
||||
let versions: im.INodeVersion[] = await im.getVersionsFromDist();
|
||||
expect(versions).toBeDefined();
|
||||
expect(versions?.length).toBe(23);
|
||||
});
|
||||
|
||||
it('Doesnt use version of node that was only partially installed in cache', async () => {
|
||||
const nodeDir: string = path.join(toolDir, 'node', '251.0.0', os.arch());
|
||||
await io.mkdirP(nodeDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||
await installer.getNode('251.0.0');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
it('can find 12.16.2 from manifest on osx', async () => {
|
||||
os.platform = 'darwin';
|
||||
os.arch = 'x64';
|
||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
||||
'actions',
|
||||
'node-versions',
|
||||
'mocktoken'
|
||||
);
|
||||
expect(versions).toBeDefined();
|
||||
let match = await tc.findFromManifest('12.16.2', true, versions);
|
||||
expect(match).toBeDefined();
|
||||
expect(match?.version).toBe('12.16.2');
|
||||
});
|
||||
|
||||
it('Resolves semantic versions of node installed in cache', async () => {
|
||||
const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
|
||||
await io.mkdirP(nodeDir);
|
||||
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
|
||||
// These will throw if it doesn't find it in the cache (because no such version exists)
|
||||
await installer.getNode('252.0.0');
|
||||
await installer.getNode('252');
|
||||
await installer.getNode('252.0');
|
||||
it('can find 12 from manifest on linux', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
||||
'actions',
|
||||
'node-versions',
|
||||
'mocktoken'
|
||||
);
|
||||
expect(versions).toBeDefined();
|
||||
let match = await tc.findFromManifest('12.16.2', true, versions);
|
||||
expect(match).toBeDefined();
|
||||
expect(match?.version).toBe('12.16.2');
|
||||
});
|
||||
|
||||
it('can find 10 from manifest on windows', async () => {
|
||||
os.platform = 'win32';
|
||||
os.arch = 'x64';
|
||||
let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
|
||||
'actions',
|
||||
'node-versions',
|
||||
'mocktoken'
|
||||
);
|
||||
expect(versions).toBeDefined();
|
||||
let match = await tc.findFromManifest('10', true, versions);
|
||||
expect(match).toBeDefined();
|
||||
expect(match?.version).toBe('10.20.1');
|
||||
});
|
||||
|
||||
//--------------------------------------------------
|
||||
// Found in cache tests
|
||||
//--------------------------------------------------
|
||||
|
||||
it('finds version in cache with stable true', async () => {
|
||||
inputs['node-version'] = '12';
|
||||
inputs.stable = 'true';
|
||||
|
||||
let toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockImplementation(() => toolPath);
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
});
|
||||
|
||||
it('finds version in cache with stable not supplied', async () => {
|
||||
inputs['node-version'] = '12';
|
||||
|
||||
inSpy.mockImplementation(name => inputs[name]);
|
||||
|
||||
let toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockImplementation(() => toolPath);
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
});
|
||||
|
||||
it('finds version in cache and adds it to the path', async () => {
|
||||
inputs['node-version'] = '12';
|
||||
|
||||
inSpy.mockImplementation(name => inputs[name]);
|
||||
|
||||
let toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockImplementation(() => toolPath);
|
||||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('handles unhandled find error and reports error', async () => {
|
||||
let errMsg = 'unhandled error message';
|
||||
inputs['node-version'] = '12';
|
||||
|
||||
findSpy.mockImplementation(() => {
|
||||
throw new Error(errMsg);
|
||||
});
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(cnSpy).toHaveBeenCalledWith('::error::' + errMsg + osm.EOL);
|
||||
});
|
||||
|
||||
it('downloads a version from a manifest match', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is in the manifest
|
||||
let versionSpec = '12.16.2';
|
||||
let resolvedVersion = versionSpec;
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
|
||||
let expectedUrl =
|
||||
'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
|
||||
|
||||
// ... but not in the local cache
|
||||
findSpy.mockImplementation(() => '');
|
||||
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
let toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Acquiring ${resolvedVersion} from ${expectedUrl}`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('falls back to a version from node dist', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is not in the manifest but is in node dist
|
||||
let versionSpec = '11.15.0';
|
||||
let resolvedVersion = versionSpec;
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
|
||||
let expectedUrl =
|
||||
'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
|
||||
|
||||
// ... but not in the local cache
|
||||
findSpy.mockImplementation(() => '');
|
||||
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
let toolPath = path.normalize('/cache/node/11.11.0/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('does not find a version that does not exist', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
let versionSpec = '9.99.9';
|
||||
inputs['node-version'] = versionSpec;
|
||||
|
||||
findSpy.mockImplementation(() => '');
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Not found in manifest. Falling back to download directly from Node'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(cnSpy).toHaveBeenCalledWith(
|
||||
`::error::Unable to find Node version '${versionSpec}' for platform ${os.platform} and architecture ${os.arch}.${osm.EOL}`
|
||||
);
|
||||
});
|
||||
|
||||
it('reports a failed download', async () => {
|
||||
let errMsg = 'unhandled download message';
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is in the manifest
|
||||
let versionSpec = '12.16.2';
|
||||
let resolvedVersion = versionSpec;
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
|
||||
findSpy.mockImplementation(() => '');
|
||||
dlSpy.mockImplementation(() => {
|
||||
throw new Error(errMsg);
|
||||
});
|
||||
await main.run();
|
||||
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`);
|
||||
});
|
||||
|
||||
describe('check-latest flag', () => {
|
||||
it('use local version and dont check manifest if check-latest is not specified', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
inputs['node-version'] = '12';
|
||||
inputs['check-latest'] = 'false';
|
||||
|
||||
const toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockReturnValue(toolPath);
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
expect(logSpy).not.toHaveBeenCalledWith(
|
||||
'Attempt to resolve the latest version from manifest...'
|
||||
);
|
||||
});
|
||||
|
||||
it('check latest version and resolve it from local cache', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
inputs['node-version'] = '12';
|
||||
inputs['check-latest'] = 'true';
|
||||
|
||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
findSpy.mockReturnValue(toolPath);
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempt to resolve the latest version from manifest...'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'");
|
||||
expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
});
|
||||
|
||||
it('check latest version and install it from manifest', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
inputs['node-version'] = '12';
|
||||
inputs['check-latest'] = 'true';
|
||||
|
||||
findSpy.mockImplementation(() => '');
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
const toolPath = path.normalize('/cache/node/12.16.2/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
const expectedUrl =
|
||||
'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempt to resolve the latest version from manifest...'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'");
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Acquiring 12.16.2 from ${expectedUrl}`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith('Extracting ...');
|
||||
});
|
||||
|
||||
it('fallback to dist if version if not found in manifest', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is not in the manifest but is in node dist
|
||||
let versionSpec = '11';
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['check-latest'] = 'true';
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
|
||||
// ... but not in the local cache
|
||||
findSpy.mockImplementation(() => '');
|
||||
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
let toolPath = path.normalize('/cache/node/11.11.0/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempt to resolve the latest version from manifest...'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Failed to resolve version ${versionSpec} from manifest`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
|
||||
it('fallback to dist if manifest is not available', async () => {
|
||||
os.platform = 'linux';
|
||||
os.arch = 'x64';
|
||||
|
||||
// a version which is not in the manifest but is in node dist
|
||||
let versionSpec = '12';
|
||||
|
||||
inputs['node-version'] = versionSpec;
|
||||
inputs['check-latest'] = 'true';
|
||||
inputs['always-auth'] = false;
|
||||
inputs['token'] = 'faketoken';
|
||||
|
||||
// ... but not in the local cache
|
||||
findSpy.mockImplementation(() => '');
|
||||
getManifestSpy.mockImplementation(() => {
|
||||
throw new Error('Unable to download manifest');
|
||||
});
|
||||
|
||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
||||
let toolPath = path.normalize('/cache/node/12.11.0/x64');
|
||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
||||
cacheSpy.mockImplementation(async () => toolPath);
|
||||
|
||||
await main.run();
|
||||
|
||||
let expPath = path.join(toolPath, 'bin');
|
||||
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(exSpy).toHaveBeenCalled();
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempt to resolve the latest version from manifest...'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Unable to resolve version from manifest...'
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Failed to resolve version ${versionSpec} from manifest`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Attempting to download ${versionSpec}...`
|
||||
);
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
15
action.yml
15
action.yml
@ -1,17 +1,24 @@
|
||||
name: 'Setup Node.js environment'
|
||||
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
|
||||
name: theomart77
|
||||
description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH'
|
||||
author: 'GitHub'
|
||||
inputs:
|
||||
always-auth:
|
||||
description: 'Set always-auth in npmrc'
|
||||
default: 'false'
|
||||
node-version:
|
||||
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
|
||||
default: '10.x'
|
||||
description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0'
|
||||
check-latest:
|
||||
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
|
||||
default: true
|
||||
registry-url:
|
||||
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN'
|
||||
scope:
|
||||
description: 'Optional scope for authenticating against scoped registries'
|
||||
token:
|
||||
description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
|
||||
default: ${{ github.token }}
|
||||
# TODO: add input to control forcing to pull from cloud or dist.
|
||||
# escape valve for someone having issues or needing the absolute latest which isn't cached yet
|
||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||
version:
|
||||
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
|
||||
|
19
azure-pipelines-1.yml
Normal file
19
azure-pipelines-1.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
steps:
|
||||
- script: echo Hello, world!
|
||||
displayName: 'Run a one-line script'
|
||||
|
||||
- script: |
|
||||
echo Add other tasks to build, test, and deploy your project.
|
||||
echo See https://aka.ms/yaml
|
||||
displayName: 'Run a multi-line script'
|
22
azure-pipelines.yml
Normal file
22
azure-pipelines.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# Node.js with Angular
|
||||
# Build a Node.js project that uses Angular.
|
||||
# Add steps that analyze code, save build artifacts, deploy, and more:
|
||||
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
|
||||
|
||||
trigger:
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- script: |
|
||||
npm install -g @angular/cli
|
||||
npm install
|
||||
ng build --prod
|
||||
displayName: 'npm install and build'
|
1763
dist/index.js
vendored
1763
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
3901
package-lock.json
generated
3901
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-node",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"private": true,
|
||||
"description": "setup node action",
|
||||
"main": "lib/setup-node.js",
|
||||
@ -23,11 +23,12 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.2",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.3",
|
||||
"@actions/github": "^1.1.0",
|
||||
"@actions/http-client": "^1.0.6",
|
||||
"@actions/http-client": "^1.0.8",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/tool-cache": "^1.3.3",
|
||||
"@actions/tool-cache": "^1.5.4",
|
||||
"semver": "^6.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -35,10 +36,10 @@
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@zeit/ncc": "^0.21.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^24.7.1",
|
||||
"prettier": "^1.17.1",
|
||||
"ts-jest": "^24.0.2",
|
||||
"typescript": "^3.5.1"
|
||||
"prettier": "^1.19.1",
|
||||
"ts-jest": "^24.3.0",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
}
|
||||
|
314
src/installer.ts
314
src/installer.ts
@ -1,54 +1,144 @@
|
||||
import os = require('os');
|
||||
import * as assert from 'assert';
|
||||
import * as core from '@actions/core';
|
||||
import * as hc from '@actions/http-client';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
import fs = require('fs');
|
||||
|
||||
//
|
||||
// Node versions interface
|
||||
// see https://nodejs.org/dist/index.json
|
||||
//
|
||||
interface INodeVersion {
|
||||
export interface INodeVersion {
|
||||
version: string;
|
||||
files: string[];
|
||||
}
|
||||
|
||||
export async function getNode(versionSpec: string) {
|
||||
interface INodeVersionInfo {
|
||||
downloadUrl: string;
|
||||
resolvedVersion: string;
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
export async function getNode(
|
||||
versionSpec: string,
|
||||
stable: boolean,
|
||||
checkLatest: boolean,
|
||||
auth: string | undefined
|
||||
) {
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
|
||||
if (checkLatest) {
|
||||
core.info('Attempt to resolve the latest version from manifest...');
|
||||
const resolvedVersion = await resolveVersionFromManifest(
|
||||
versionSpec,
|
||||
stable,
|
||||
auth
|
||||
);
|
||||
if (resolvedVersion) {
|
||||
versionSpec = resolvedVersion;
|
||||
core.info(`Resolved as '${versionSpec}'`);
|
||||
} else {
|
||||
core.info(`Failed to resolve version ${versionSpec} from manifest`);
|
||||
}
|
||||
}
|
||||
|
||||
// check cache
|
||||
let toolPath: string;
|
||||
toolPath = tc.find('node', versionSpec);
|
||||
|
||||
// If not found in cache, download
|
||||
if (!toolPath) {
|
||||
let version: string;
|
||||
const c = semver.clean(versionSpec) || '';
|
||||
// If explicit version
|
||||
if (semver.valid(c) != null) {
|
||||
// version to download
|
||||
version = versionSpec;
|
||||
} else {
|
||||
// query nodejs.org for a matching version
|
||||
version = await queryLatestMatch(versionSpec);
|
||||
if (!version) {
|
||||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
} else {
|
||||
core.info(`Attempting to download ${versionSpec}...`);
|
||||
let downloadPath = '';
|
||||
let info: INodeVersionInfo | null = null;
|
||||
|
||||
//
|
||||
// Try download from internal distribution (popular versions only)
|
||||
//
|
||||
try {
|
||||
info = await getInfoFromManifest(versionSpec, stable, auth);
|
||||
if (info) {
|
||||
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
|
||||
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
|
||||
} else {
|
||||
core.info(
|
||||
'Not found in manifest. 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.message);
|
||||
}
|
||||
core.debug(err.stack);
|
||||
core.info('Falling back to download directly from Node');
|
||||
}
|
||||
|
||||
//
|
||||
// Download from nodejs.org
|
||||
//
|
||||
if (!downloadPath) {
|
||||
info = await getInfoFromDist(versionSpec);
|
||||
if (!info) {
|
||||
throw new Error(
|
||||
`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
|
||||
);
|
||||
}
|
||||
|
||||
// check cache
|
||||
toolPath = tc.find('node', version);
|
||||
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
|
||||
try {
|
||||
downloadPath = await tc.downloadTool(info.downloadUrl);
|
||||
} catch (err) {
|
||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||
return await acquireNodeFromFallbackLocation(info.resolvedVersion);
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!toolPath) {
|
||||
// download, extract, cache
|
||||
toolPath = await acquireNode(version);
|
||||
//
|
||||
// Extract
|
||||
//
|
||||
core.info('Extracting ...');
|
||||
let extPath: string;
|
||||
info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here
|
||||
if (osPlat == 'win32') {
|
||||
let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe');
|
||||
extPath = await tc.extract7z(downloadPath, undefined, _7zPath);
|
||||
// 7z extracts to folder matching file name
|
||||
let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z'));
|
||||
if (fs.existsSync(nestedPath)) {
|
||||
extPath = nestedPath;
|
||||
}
|
||||
} else {
|
||||
extPath = await tc.extractTar(downloadPath, undefined, [
|
||||
'xz',
|
||||
'--strip',
|
||||
'1'
|
||||
]);
|
||||
}
|
||||
|
||||
//
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
//
|
||||
core.info('Adding to the cache ...');
|
||||
toolPath = await tc.cacheDir(extPath, 'node', info.resolvedVersion);
|
||||
core.info('Done');
|
||||
}
|
||||
|
||||
//
|
||||
@ -65,41 +155,74 @@ export async function getNode(versionSpec: string) {
|
||||
core.addPath(toolPath);
|
||||
}
|
||||
|
||||
async function queryLatestMatch(versionSpec: string): Promise<string> {
|
||||
// node offers a json list of versions
|
||||
let dataFileName: string;
|
||||
switch (osPlat) {
|
||||
case 'linux':
|
||||
dataFileName = `linux-${osArch}`;
|
||||
break;
|
||||
case 'darwin':
|
||||
dataFileName = `osx-${osArch}-tar`;
|
||||
break;
|
||||
case 'win32':
|
||||
dataFileName = `win-${osArch}-exe`;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected OS '${osPlat}'`);
|
||||
async function getInfoFromManifest(
|
||||
versionSpec: string,
|
||||
stable: boolean,
|
||||
auth: string | undefined
|
||||
): Promise<INodeVersionInfo | null> {
|
||||
let info: INodeVersionInfo | null = null;
|
||||
const releases = await tc.getManifestFromRepo(
|
||||
'actions',
|
||||
'node-versions',
|
||||
auth,
|
||||
'main'
|
||||
);
|
||||
const rel = await tc.findFromManifest(versionSpec, stable, releases);
|
||||
|
||||
if (rel && rel.files.length > 0) {
|
||||
info = <INodeVersionInfo>{};
|
||||
info.resolvedVersion = rel.version;
|
||||
info.downloadUrl = rel.files[0].download_url;
|
||||
info.fileName = rel.files[0].filename;
|
||||
}
|
||||
|
||||
let versions: string[] = [];
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let httpClient = new hc.HttpClient('setup-node', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
let response = await httpClient.getJson<INodeVersion[]>(dataUrl);
|
||||
let nodeVersions = response.result || [];
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
versions.push(nodeVersion.version);
|
||||
}
|
||||
});
|
||||
return info;
|
||||
}
|
||||
|
||||
// get the latest version that matches the version spec
|
||||
let version: string = evaluateVersions(versions, versionSpec);
|
||||
return version;
|
||||
async function getInfoFromDist(
|
||||
versionSpec: string
|
||||
): Promise<INodeVersionInfo | null> {
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
|
||||
let version: string;
|
||||
|
||||
version = await queryDistForMatch(versionSpec);
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
||||
//
|
||||
version = semver.clean(version) || '';
|
||||
let fileName: string =
|
||||
osPlat == 'win32'
|
||||
? `node-v${version}-win-${osArch}`
|
||||
: `node-v${version}-${osPlat}-${osArch}`;
|
||||
let urlFileName: string =
|
||||
osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
||||
let url = `https://nodejs.org/dist/v${version}/${urlFileName}`;
|
||||
|
||||
return <INodeVersionInfo>{
|
||||
downloadUrl: url,
|
||||
resolvedVersion: version,
|
||||
fileName: fileName
|
||||
};
|
||||
}
|
||||
|
||||
async function resolveVersionFromManifest(
|
||||
versionSpec: string,
|
||||
stable: boolean,
|
||||
auth: string | undefined
|
||||
): Promise<string | undefined> {
|
||||
try {
|
||||
const info = await getInfoFromManifest(versionSpec, stable, auth);
|
||||
return info?.resolvedVersion;
|
||||
} catch (err) {
|
||||
core.info('Unable to resolve version from manifest...');
|
||||
core.debug(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - should we just export this from @actions/tool-cache? Lifted directly from there
|
||||
@ -130,47 +253,49 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
|
||||
return version;
|
||||
}
|
||||
|
||||
async function acquireNode(version: string): Promise<string> {
|
||||
//
|
||||
// Download - a tool installer intimately knows how to get the tool (and construct urls)
|
||||
//
|
||||
version = semver.clean(version) || '';
|
||||
let fileName: string =
|
||||
osPlat == 'win32'
|
||||
? `node-v${version}-win-${osArch}`
|
||||
: `node-v${version}-${osPlat}-${osArch}`;
|
||||
let urlFileName: string =
|
||||
osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`;
|
||||
let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
|
||||
async function queryDistForMatch(versionSpec: string): Promise<string> {
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
|
||||
let downloadPath: string;
|
||||
// node offers a json list of versions
|
||||
let dataFileName: string;
|
||||
switch (osPlat) {
|
||||
case 'linux':
|
||||
dataFileName = `linux-${osArch}`;
|
||||
break;
|
||||
case 'darwin':
|
||||
dataFileName = `osx-${osArch}-tar`;
|
||||
break;
|
||||
case 'win32':
|
||||
dataFileName = `win-${osArch}-exe`;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected OS '${osPlat}'`);
|
||||
}
|
||||
|
||||
try {
|
||||
downloadPath = await tc.downloadTool(downloadUrl);
|
||||
} catch (err) {
|
||||
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
|
||||
return await acquireNodeFromFallbackLocation(version);
|
||||
let versions: string[] = [];
|
||||
let nodeVersions = await module.exports.getVersionsFromDist();
|
||||
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
versions.push(nodeVersion.version);
|
||||
}
|
||||
});
|
||||
|
||||
throw err;
|
||||
}
|
||||
// get the latest version that matches the version spec
|
||||
let version: string = evaluateVersions(versions, versionSpec);
|
||||
return version;
|
||||
}
|
||||
|
||||
//
|
||||
// Extract
|
||||
//
|
||||
let extPath: string;
|
||||
if (osPlat == 'win32') {
|
||||
let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe');
|
||||
extPath = await tc.extract7z(downloadPath, undefined, _7zPath);
|
||||
} else {
|
||||
extPath = await tc.extractTar(downloadPath);
|
||||
}
|
||||
|
||||
//
|
||||
// Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded
|
||||
//
|
||||
let toolRoot = path.join(extPath, fileName);
|
||||
return await tc.cacheDir(toolRoot, 'node', version);
|
||||
export async function getVersionsFromDist(): Promise<INodeVersion[]> {
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let httpClient = new hc.HttpClient('setup-node', [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
let response = await httpClient.getJson<INodeVersion[]>(dataUrl);
|
||||
return response.result || [];
|
||||
}
|
||||
|
||||
// For non LTS versions of Node, the files we need (for Windows) are sometimes located
|
||||
@ -188,6 +313,9 @@ async function acquireNode(version: string): Promise<string> {
|
||||
async function acquireNodeFromFallbackLocation(
|
||||
version: string
|
||||
): Promise<string> {
|
||||
let osPlat: string = os.platform();
|
||||
let osArch: string = translateArchToDistUrl(os.arch());
|
||||
|
||||
// Create temporary folder to download in to
|
||||
const tempDownloadFolder: string =
|
||||
'temp_' + Math.floor(Math.random() * 2000000000);
|
||||
@ -201,6 +329,8 @@ async function acquireNodeFromFallbackLocation(
|
||||
exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`;
|
||||
libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`;
|
||||
|
||||
core.info(`Downloading only node binary from ${exeUrl}`);
|
||||
|
||||
const exePath = await tc.downloadTool(exeUrl);
|
||||
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||
const libPath = await tc.downloadTool(libUrl);
|
||||
@ -218,7 +348,9 @@ async function acquireNodeFromFallbackLocation(
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return await tc.cacheDir(tempDir, 'node', version);
|
||||
let toolPath = await tc.cacheDir(tempDir, 'node', version);
|
||||
core.addPath(toolPath);
|
||||
return toolPath;
|
||||
}
|
||||
|
||||
// os.arch does not always match the relative download url, e.g.
|
||||
|
51
src/main.ts
Normal file
51
src/main.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as installer from './installer';
|
||||
import * as auth from './authutil';
|
||||
import * as path from 'path';
|
||||
import {URL} from 'url';
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
//
|
||||
// Version is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||
//
|
||||
let version = core.getInput('node-version');
|
||||
if (!version) {
|
||||
version = core.getInput('version');
|
||||
}
|
||||
|
||||
if (version) {
|
||||
let token = core.getInput('token');
|
||||
let auth = !token || isGhes() ? undefined : `token ${token}`;
|
||||
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
||||
const checkLatest =
|
||||
(core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE';
|
||||
await installer.getNode(version, stable, checkLatest, auth);
|
||||
}
|
||||
|
||||
const registryUrl: string = core.getInput('registry-url');
|
||||
const alwaysAuth: string = core.getInput('always-auth');
|
||||
if (registryUrl) {
|
||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||
}
|
||||
|
||||
const matchersPath = path.join(__dirname, '..', '.github');
|
||||
console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
|
||||
console.log(
|
||||
`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`
|
||||
);
|
||||
console.log(
|
||||
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
||||
);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
function isGhes(): boolean {
|
||||
const ghUrl = new URL(
|
||||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
);
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
}
|
@ -1,39 +1,3 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as installer from './installer';
|
||||
import * as auth from './authutil';
|
||||
import * as path from 'path';
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
//
|
||||
// Version is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||
//
|
||||
let version = core.getInput('version');
|
||||
if (!version) {
|
||||
version = core.getInput('node-version');
|
||||
}
|
||||
if (version) {
|
||||
await installer.getNode(version);
|
||||
}
|
||||
|
||||
const registryUrl: string = core.getInput('registry-url');
|
||||
const alwaysAuth: string = core.getInput('always-auth');
|
||||
if (registryUrl) {
|
||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||
}
|
||||
|
||||
const matchersPath = path.join(__dirname, '..', '.github');
|
||||
console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
|
||||
console.log(
|
||||
`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`
|
||||
);
|
||||
console.log(
|
||||
`##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}`
|
||||
);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
import {run} from './main';
|
||||
|
||||
run();
|
||||
|
@ -7,6 +7,7 @@
|
||||
],
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"sourceMap": true,
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
|
22
validate/test.sh
Executable file
22
validate/test.sh
Executable file
@ -0,0 +1,22 @@
|
||||
|
||||
#/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf ./temp
|
||||
rm -rf ./node
|
||||
|
||||
# uncomment to use charles proxy or other debugging proxy
|
||||
# export NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||
# export https_proxy=http://127.0.0.1:8888
|
||||
|
||||
export RUNNER_TOOL_CACHE=$(pwd)
|
||||
export RUNNER_TEMP="${RUNNER_TOOL_CACHE}/temp"
|
||||
export INPUT_STABLE=true
|
||||
export INPUT_VERSION="12" #"0.12.7" #"12" #"11.15.0"
|
||||
# export your PAT with repo scope before running
|
||||
export INPUT_TOKEN=$GITHUB_TOKEN
|
||||
|
||||
echo "Getting ${INPUT_VERSION} ($INPUT_STABLE) with ${INPUT_TOKEN}..."
|
||||
|
||||
node ../dist/index.js
|
Loading…
Reference in New Issue
Block a user