mirror of
https://github.com/actions/setup-node.git
synced 2026-06-14 14:13:52 +08:00
Compare commits
2 Commits
v3.1.0
...
f52e974c1d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f52e974c1d | ||
|
|
6deefe4234 |
10
.github/workflows/build-test.yml
vendored
10
.github/workflows/build-test.yml
vendored
@@ -18,13 +18,13 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Node 16.x
|
||||
uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node 12
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
node-version: 12.x
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format-check
|
||||
- run: npm test
|
||||
- run: npm test
|
||||
10
.github/workflows/check-dist.yml
vendored
10
.github/workflows/check-dist.yml
vendored
@@ -21,12 +21,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node 16.x
|
||||
uses: actions/setup-node@v3
|
||||
- name: Set Node.js 12.x
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
node-version: 12.x
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
id: diff
|
||||
|
||||
# If index.js was different than expected, upload the expected version as an artifact
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: dist
|
||||
|
||||
10
.github/workflows/e2e-cache.yml
vendored
10
.github/workflows/e2e-cache.yml
vendored
@@ -10,7 +10,7 @@ on:
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
|
||||
jobs:
|
||||
node-npm-depencies-caching:
|
||||
name: Test npm (Node ${{ matrix.node-version}}, ${{ matrix.os }})
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [12, 14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clean global cache
|
||||
run: npm cache clean --force
|
||||
- name: Setup Node
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [12, 14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [12, 14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Yarn version
|
||||
run: yarn --version
|
||||
- name: Generate yarn file
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [12, 14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Update yarn
|
||||
run: yarn set version berry
|
||||
- name: Yarn version
|
||||
|
||||
4
.github/workflows/licensed.yml
vendored
4
.github/workflows/licensed.yml
vendored
@@ -13,12 +13,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- 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/3.4.4/licensed-3.4.4-linux-x64.tar.gz
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
|
||||
sudo tar -xzf licensed.tar.gz
|
||||
sudo mv licensed /usr/local/bin/licensed
|
||||
- run: licensed status
|
||||
|
||||
4
.github/workflows/proxy.yml
vendored
4
.github/workflows/proxy.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 14
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
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@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Clear tool cache
|
||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||
- name: Setup node 11
|
||||
|
||||
22
.github/workflows/versions.yml
vendored
22
.github/workflows/versions.yml
vendored
@@ -3,14 +3,14 @@ name: versions
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
|
||||
jobs:
|
||||
local-cache:
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10, 12, 14]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10.15, 12.16.0, 14.2.0, 16.3.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [10, 12, 14]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node and check latest
|
||||
uses: ./
|
||||
with:
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
@@ -101,7 +101,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
node-version: [11, 13]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node from dist
|
||||
uses: ./
|
||||
with:
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
# test old versions which didn't have npm and layout different
|
||||
- name: Setup node 0.12.18 from dist
|
||||
uses: ./
|
||||
@@ -130,7 +130,7 @@ jobs:
|
||||
arch:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node 14 x86 from dist
|
||||
uses: ./
|
||||
with:
|
||||
|
||||
2
.licenses/npm/@actions/cache.dep.yml
generated
2
.licenses/npm/@actions/cache.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/cache"
|
||||
version: 2.0.0
|
||||
version: 1.0.8
|
||||
type: npm
|
||||
summary: Actions cache lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
name: tr46
|
||||
version: 0.0.3
|
||||
name: "@actions/core"
|
||||
version: 1.2.4
|
||||
type: npm
|
||||
summary: An implementation of the Unicode TR46 spec
|
||||
homepage: https://github.com/Sebmaster/tr46.js#readme
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
32
.licenses/npm/@actions/http-client-1.0.8.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client-1.0.8.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@actions/http-client"
|
||||
version: 1.0.8
|
||||
type: npm
|
||||
summary: Actions Http Client
|
||||
homepage: https://github.com/actions/http-client#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
notices: []
|
||||
42
.licenses/npm/@types/node.dep.yml
generated
42
.licenses/npm/@types/node.dep.yml
generated
@@ -1,32 +1,26 @@
|
||||
---
|
||||
name: "@types/node"
|
||||
version: 16.11.25
|
||||
version: 12.0.10
|
||||
type: npm
|
||||
summary: TypeScript definitions for Node.js
|
||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
|
||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |2
|
||||
MIT License
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE
|
||||
text: " MIT License\r\n\r\n Copyright (c) Microsoft Corporation. All rights
|
||||
reserved.\r\n\r\n Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy\r\n of this software and associated documentation files (the
|
||||
\"Software\"), to deal\r\n in the Software without restriction, including without
|
||||
limitation the rights\r\n to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell\r\n copies of the Software, and to permit persons to
|
||||
whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n
|
||||
\ The above copyright notice and this permission notice shall be included in
|
||||
all\r\n copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE
|
||||
IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n
|
||||
\ SOFTWARE\r\n"
|
||||
notices: []
|
||||
|
||||
2
.licenses/npm/node-fetch.dep.yml
generated
2
.licenses/npm/node-fetch.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: node-fetch
|
||||
version: 2.6.7
|
||||
version: 2.6.1
|
||||
type: npm
|
||||
summary: A light-weight module that brings window.fetch to node.js
|
||||
homepage: https://github.com/bitinn/node-fetch
|
||||
|
||||
23
.licenses/npm/webidl-conversions.dep.yml
generated
23
.licenses/npm/webidl-conversions.dep.yml
generated
@@ -1,23 +0,0 @@
|
||||
---
|
||||
name: webidl-conversions
|
||||
version: 3.0.1
|
||||
type: npm
|
||||
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
|
||||
homepage:
|
||||
license: bsd-2-clause
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
notices: []
|
||||
32
.licenses/npm/whatwg-url.dep.yml
generated
32
.licenses/npm/whatwg-url.dep.yml
generated
@@ -1,32 +0,0 @@
|
||||
---
|
||||
name: whatwg-url
|
||||
version: 5.0.0
|
||||
type: npm
|
||||
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.txt
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
notices: []
|
||||
@@ -1 +1 @@
|
||||
* @actions/actions-service
|
||||
* @actions/spark
|
||||
36
README.md
36
README.md
@@ -1,8 +1,8 @@
|
||||
# setup-node
|
||||
|
||||
[](https://github.com/actions/setup-node/actions/workflows/build-test.yml)
|
||||
[](https://github.com/actions/setup-node/actions/workflows/versions.yml)
|
||||
[](https://github.com/actions/setup-node/actions/workflows/proxy.yml)
|
||||
<p align="left">
|
||||
<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 provides the following functionality for GitHub Actions users:
|
||||
|
||||
@@ -16,30 +16,28 @@ This action provides the following functionality for GitHub Actions users:
|
||||
See [action.yml](action.yml)
|
||||
|
||||
**Basic:**
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.
|
||||
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.
|
||||
|
||||
The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/).
|
||||
|
||||
For information regarding locally cached versions of Node.js on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
|
||||
|
||||
#### Supported version syntax
|
||||
|
||||
The `node-version` input supports the following syntax:
|
||||
|
||||
major versions: `12`, `14`, `16`
|
||||
more specific versions: `10.15`, `14.2.0`, `16.3.0`
|
||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
|
||||
major versions: `12`, `14`, `16`
|
||||
more specific versions: `10.15`, `14.2.0`, `16.3.0`
|
||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
|
||||
|
||||
## Caching packages dependencies
|
||||
|
||||
@@ -50,11 +48,10 @@ The action defaults to search for the dependency file (`package-lock.json` or `y
|
||||
See the examples of using cache for `yarn` / `pnpm` and `cache-dependency-path` input in the [Advanced usage](docs/advanced-usage.md#caching-packages-dependencies) guide.
|
||||
|
||||
**Caching npm dependencies:**
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -63,11 +60,10 @@ steps:
|
||||
```
|
||||
|
||||
**Caching npm dependencies in monorepos:**
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -77,7 +73,6 @@ steps:
|
||||
```
|
||||
|
||||
## Matrix Testing:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
@@ -87,15 +82,14 @@ jobs:
|
||||
node: [ '12', '14', '16' ]
|
||||
name: Node ${{ matrix.node }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
||||
## Advanced usage
|
||||
|
||||
1. [Check latest version](docs/advanced-usage.md#check-latest-version)
|
||||
|
||||
452
Riri
Normal file
452
Riri
Normal file
@@ -0,0 +1,452 @@
|
||||
Main logo
|
||||
Search for transactions, addresses, blocks and embedded text data...
|
||||
|
||||
|
||||
API
|
||||
API documentation
|
||||
API documentation
|
||||
Introduction
|
||||
General stats endpoints
|
||||
Retrieve overall information about blockchains and tokens
|
||||
Stats on multiple blockchains at once
|
||||
Bitcoin-like blockchain stats
|
||||
Ethereum-like blockchain stats
|
||||
Ripple-like blockchain stats
|
||||
Stellar-like blockchain stats
|
||||
Monero-like blockchain stats
|
||||
Cardano-like blockchain stats
|
||||
Mixin-like DAG stats
|
||||
Tezos-like blockchain stats
|
||||
EOS-like blockchain stats
|
||||
Cross-chain token stats
|
||||
Omni Layer stats
|
||||
ERC-20 stats
|
||||
Dashboard endpoints
|
||||
Retrieve information about various entities in a neat format from our databases
|
||||
Raw data endpoints
|
||||
Retrieve raw information about various entities directly from our full nodes
|
||||
Infinitable endpoints
|
||||
SQL-like queries: filter, sort, and aggregate blockchain data
|
||||
Misc endpoints
|
||||
Privacy-o-meter
|
||||
News aggregator
|
||||
Support
|
||||
Show all
|
||||
Blockchair API
|
||||
Blockchair API
|
||||
Blockchair API provides developers, researchers, and businesses with access to data contained in 19 blockchains
|
||||
Explore pricing plans
|
||||
Stats on multiple blockchains at once
|
||||
Allows to retrieve the most important stats on all blockchains we support via just one API request.
|
||||
|
||||
Endpoint:
|
||||
|
||||
https://api.blockchair.com/stats
|
||||
If you require data on just one blockchain, please use https://api.blockchair.com/{:chain}/stats instead.
|
||||
|
||||
Output:
|
||||
|
||||
data contains an array with stats on 15 blockchains we support at once:
|
||||
|
||||
Bitcoin
|
||||
Bitcoin Cash
|
||||
Ethereum
|
||||
Litecoin
|
||||
Bitcoin SV
|
||||
Dogecoin
|
||||
Dash
|
||||
Ripple
|
||||
Groestlcoin
|
||||
Stellar
|
||||
Monero
|
||||
Cardano
|
||||
Zcash
|
||||
Mixin
|
||||
Tezos
|
||||
eCash
|
||||
and on 3 cross-chain tokens:
|
||||
|
||||
Tether (USDT)
|
||||
USD Coin (USDC)
|
||||
Binance USD (BUSD)
|
||||
Note that Bitcoin Testnet stats are not included in this output.
|
||||
|
||||
Description of the fields is available in the next three sections of documentation.
|
||||
|
||||
Example output:
|
||||
|
||||
https://api.blockchair.com/stats:
|
||||
|
||||
{
|
||||
"data": {
|
||||
"bitcoin": {
|
||||
"data": {
|
||||
"blocks": 599952,
|
||||
...
|
||||
}
|
||||
},
|
||||
"bitcoin-cash": {
|
||||
"data": {
|
||||
"blocks": 605134,
|
||||
...
|
||||
}
|
||||
},
|
||||
"bitcoin-sv": {
|
||||
"data": {
|
||||
"blocks": 604886,
|
||||
...
|
||||
}
|
||||
},
|
||||
"ethereum": {
|
||||
"data": {
|
||||
"blocks": 8766052,
|
||||
...
|
||||
}
|
||||
},
|
||||
"litecoin": {
|
||||
"data": {
|
||||
"blocks": 1721519,
|
||||
...
|
||||
}
|
||||
},
|
||||
"dogecoin": {
|
||||
"data": {
|
||||
"blocks": 2941267,
|
||||
...
|
||||
}
|
||||
},
|
||||
"dash": {
|
||||
"data": {
|
||||
"blocks": 1156197,
|
||||
...
|
||||
}
|
||||
},
|
||||
"ripple": {
|
||||
"data": {
|
||||
"ledgers": 50795982,
|
||||
...
|
||||
}
|
||||
},
|
||||
"groestlcoin": {
|
||||
"data": {
|
||||
"blocks": 2801282,
|
||||
...
|
||||
}
|
||||
},
|
||||
"stellar": {
|
||||
"data": {
|
||||
"ledgers": 26968006,
|
||||
...
|
||||
}
|
||||
},
|
||||
"monero": {
|
||||
"data": {
|
||||
"blocks": 2014108,
|
||||
...
|
||||
}
|
||||
},
|
||||
"cardano": {
|
||||
"data": {
|
||||
"blocks": 3673733,
|
||||
...
|
||||
}
|
||||
},
|
||||
"zcash": {
|
||||
"data": {
|
||||
"blocks": 756512,
|
||||
...
|
||||
}
|
||||
},
|
||||
"mixin": {
|
||||
"data": {
|
||||
"snapshots": 18632532,
|
||||
...
|
||||
}
|
||||
},
|
||||
"tezos": {
|
||||
"data": {
|
||||
"blocks": 974144,
|
||||
...
|
||||
}
|
||||
},
|
||||
"cross-chain": {
|
||||
"tether": {
|
||||
"data": ...
|
||||
},
|
||||
"usd-coin": {
|
||||
"data": ...
|
||||
},
|
||||
"binance-usd": {
|
||||
"data": ...
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"code": 200,
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
Endpoint:
|
||||
|
||||
https://api.blockchair.com/stellar/stats
|
||||
Output:
|
||||
|
||||
data contains an array with blockchain statistics:
|
||||
|
||||
ledgers — total number of ledgers
|
||||
circulation — number of coins in circulation (in stroops)
|
||||
best_ledger_height — the latest ledger number
|
||||
best_ledger_hash — the latest ledger hash
|
||||
best_ledger_time — the latest ledger time
|
||||
ledgers_24h — number of ledgers closed over the last 24 hours
|
||||
transactions_24h — number of transactions confirmed over the last 24 hours
|
||||
successful_transactions_24h— number of successful transactions over the last 24 hours
|
||||
failed_transactions_24h— number of failed transactions over the last 24 hours
|
||||
operations_24h — number of operations over the last 24 hours
|
||||
average_transaction_fee_24h — average transaction fee over the last 24 hours
|
||||
average_transaction_fee_usd_24h — the same in USD
|
||||
market_price_usd — average market price of 1 coin in USD (market data source: CoinGecko)
|
||||
market_price_btc — average market price of 1 coin in BTC
|
||||
market_price_usd_change_24h_percentage — market price change in percent for 24 hours
|
||||
market_cap_usd — market capitalization (coins in circulation * price per coin in USD)
|
||||
market_dominance_percentage — dominance index (how much % of the total cryptocurrency market is the market capitalization of the coin)
|
||||
countdowns (optional) — an optional array of events ([event, time_left] format), where time_left is the number of seconds till the event
|
||||
Example output:
|
||||
|
||||
https://api.blockchair.com/stellar/stats:
|
||||
|
||||
{
|
||||
"data": {
|
||||
"ledgers": 26602978,
|
||||
"best_ledger_height": 26602978,
|
||||
"best_ledger_hash": "3151f16e9a6ce9ee43f57a068c83a04c7e864ccc7d1027519d42aab79e13b40f",
|
||||
"best_ledger_time": "2019-11-02 16:42:01",
|
||||
"circulation": 1054439020873472900,
|
||||
"ledgers_24h": 15643,
|
||||
"transactions_24h": 461072,
|
||||
"successful_transactions_24h": 285958,
|
||||
"failed_transactions_24h": 175114,
|
||||
"operations_24h": 1085466,
|
||||
"average_transaction_fee_24h": 283.5731513695005,
|
||||
"average_transaction_fee_usd_24h": 0.000001991250668916633,
|
||||
"market_price_usd": 0.07022,
|
||||
"market_price_btc": 0.0000075229454120425,
|
||||
"market_price_usd_change_24h_percentage": 3.41847,
|
||||
"market_cap_usd": 1406714595,
|
||||
"market_dominance_percentage": 0.56
|
||||
},
|
||||
"context": {
|
||||
"code": 200,
|
||||
...
|
||||
}
|
||||
}
|
||||
Request cost formula:
|
||||
|
||||
Always 1.
|
||||
|
||||
Explore visualization on our front-end:
|
||||
|
||||
https://blockchair.com/stellar
|
||||
Request cost formula:
|
||||
rs, and businesses with access to data contained in 19 blockchains
|
||||
Explore pricing plans
|
||||
Bitcoin-like blockchain stats
|
||||
Endpoints:
|
||||
|
||||
https://api.blockchair.com/bitcoin/stats
|
||||
https://api.blockchair.com/bitcoin-cash/stats
|
||||
https://api.blockchair.com/litecoin/stats
|
||||
https://api.blockchair.com/bitcoin-sv/stats
|
||||
https://api.blockchair.com/dogecoin/stats
|
||||
https://api.blockchair.com/dash/stats
|
||||
https://api.blockchair.com/groestlcoin/stats
|
||||
https://api.blockchair.com/zcash/stats
|
||||
https://api.blockchair.com/ecash/stats
|
||||
https://api.blockchair.com/bitcoin/testnet/stats
|
||||
Output:
|
||||
|
||||
data contains an array with blockchain statistics:
|
||||
|
||||
blocks — total number of blocks (note that it's 1 more than the latest block number as there is block #0)
|
||||
transactions — total number of transactions
|
||||
outputs — total number of outputs (including spent)
|
||||
circulation — number of coins in circulation (in satoshi)
|
||||
blockchain_size — total size of all blocks in bytes (note: it's not the size of a full node, it's just bare blocks; nodes are bigger in size as they use database indexing, etc)
|
||||
nodes— number of full network nodes (it's an approximate number and actually not a blockchain metric)
|
||||
difficulty — current mining difficulty
|
||||
hashrate_24h — approximated hashrate over the last 24 hours (returned as a string as it doesn't fit into an integer)
|
||||
next_retarget_time_estimate — approximate timestamp of the next difficulty retarget (this field is available for Bitcoin and Litecoin only)
|
||||
next_difficulty_estimate — approximate next difficulty value (this field is available for Bitcoin and Litecoin only)
|
||||
best_block_height — the latest block height
|
||||
best_block_hash — the latest block hash
|
||||
best_block_time — the latest block time
|
||||
mempool_transactions — number of transactions in the mempool
|
||||
mempool_outputs — number of outputs in the mempool
|
||||
mempool_size — mempool size in bytes
|
||||
mempool_tps — number of transactions per second added to the mempool
|
||||
mempool_total_fee_usd — sum of transaction fees in the mempool, in USD
|
||||
blocks_24h — number of blocks mined over the last 24 hours
|
||||
transactions_24h — number of transactions confirmed over the last 24 hours
|
||||
volume_24h — total monetary volume of transactions over the last 24 hours
|
||||
average_transaction_fee_24h — average transaction fee over the last 24 hours
|
||||
average_transaction_fee_usd_24h — the same in USD
|
||||
median_transaction_fee_24h— median transaction fee over the last 24 hours
|
||||
median_transaction_fee_usd_24h — the same in USD
|
||||
inflation_24h— number of new coins mined over the last 24 hours (in satoshi), this can be considered as the daily inflation
|
||||
inflation_usd_24h — the same in USD
|
||||
cdd_24h— total coindays destroyed over the last 24 hours
|
||||
largest_transaction_24h — array of hash and value_usd — biggest payment over the last 24 hours
|
||||
market_price_usd — average market price of 1 coin in USD (market data source: CoinGecko)
|
||||
market_price_btc — average market price of 1 coin in BTC (for Bitcoin it always returns 1)
|
||||
market_price_usd_change_24h_percentage — market price change in percent for 24 hours
|
||||
market_cap_usd — market capitalization (coins in circulation * price per coin in USD)
|
||||
market_dominance_percentage — dominance index (how much % of the total cryptocurrency market is the market capitalization of the coin)
|
||||
countdowns (optional) — an optional array of events ([event, time_left] format), where time_left is the number of seconds till the event
|
||||
suggested_transaction_fee_per_byte_sat — suggests a proper transaction fee in satoshi per byte based on the latest block
|
||||
hodling_addresses — the total number of addresses with positive balance
|
||||
Example output:
|
||||
|
||||
https://api.blockchair.com/bitcoin/stats:
|
||||
|
||||
{
|
||||
"data": {
|
||||
"blocks": 690165,
|
||||
"transactions": 654248075,
|
||||
"outputs": 1776138129,
|
||||
"circulation": 1875100229497096,
|
||||
"blocks_24h": 130,
|
||||
"transactions_24h": 229726,
|
||||
"difficulty": 14363025673660,
|
||||
"volume_24h": 187713267560047,
|
||||
"mempool_transactions": 6591,
|
||||
"mempool_outputs": 16532,
|
||||
"mempool_size": 5076549,
|
||||
"mempool_tps": 5.416666666666667,
|
||||
"mempool_total_fee_usd": 14219.1005,
|
||||
"best_block_height": 690164,
|
||||
"best_block_hash": "000000000000000000023fcb3703bf89ddbfc1ef5109f21c2387a9d630b78c6e",
|
||||
"best_block_time": "2021-07-08 14:37:00",
|
||||
"blockchain_size": 353767186147,
|
||||
"average_transaction_fee_24h": 14421,
|
||||
"inflation_24h": 81250000000,
|
||||
"median_transaction_fee_24h": 5269,
|
||||
"cdd_24h": 3696149.5996842394,
|
||||
"mempool_outputs": 44316,
|
||||
"largest_transaction_24h": {
|
||||
"hash": "7a83c11f42dadad1c6916cceb079835aa09ed70127dba7cdf15aa904277c907d",
|
||||
"value_usd": 773548352
|
||||
},
|
||||
"nodes": 8502,
|
||||
"hashrate_24h": "92904707138521187685",
|
||||
"inflation_usd_24h": 26587437.5,
|
||||
"average_transaction_fee_usd_24h": 4.719001232335435,
|
||||
"median_transaction_fee_usd_24h": 1.724338485,
|
||||
"market_price_usd": 32723,
|
||||
"market_price_btc": 1,
|
||||
"market_price_usd_change_24h_percentage": -5.7534,
|
||||
"market_cap_usd": 613578128025,
|
||||
"market_dominance_percentage": 43.03,
|
||||
"next_retarget_time_estimate": "2021-07-18 19:23:20",
|
||||
"next_difficulty_estimate": 17958208674260,
|
||||
"countdowns": [],
|
||||
"suggested_transaction_fee_per_byte_sat": 17,
|
||||
"hodling_addresses": 38343147
|
||||
},
|
||||
"context": {
|
||||
"code": 200,
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
Always 1.
|
||||
|
||||
Explore visualizations on our front-end:
|
||||
|
||||
https://blockchair.com/
|
||||
https://blockchair.com/compare
|
||||
Explorers
|
||||
Bitcoin
|
||||
Ethereum
|
||||
Litecoin
|
||||
Cardano
|
||||
Ripple
|
||||
Polkadot
|
||||
Dogecoin
|
||||
Solana new
|
||||
Bitcoin Cash
|
||||
Stellar
|
||||
Monero
|
||||
EOS
|
||||
Kusama
|
||||
Bitcoin SV
|
||||
eCash
|
||||
Zcash
|
||||
Dash
|
||||
Mixin
|
||||
Groestlcoin
|
||||
Tether USD
|
||||
USD Coin
|
||||
Binance USD
|
||||
Data
|
||||
API
|
||||
Database dumps
|
||||
Full node dumps
|
||||
Charts
|
||||
Services
|
||||
Blockchair News
|
||||
Blockchair Donut
|
||||
Blockchair Awesome
|
||||
Products
|
||||
Transaction receipts
|
||||
Wallet statements
|
||||
Portfolio tracker
|
||||
Broadcast transaction
|
||||
Privacy-o-meter
|
||||
Node explorers
|
||||
Release monitor
|
||||
Halving countdown
|
||||
Compare blockchains
|
||||
Get Blockchair extension
|
||||
Useful links
|
||||
About Blockchair
|
||||
FAQ
|
||||
Changelog
|
||||
Careers
|
||||
Terms of service
|
||||
Privacy policy
|
||||
Blockchair Onion v3 URL
|
||||
Blockchair Onion v2 URL
|
||||
For partners
|
||||
Partnerships
|
||||
Advertise with us
|
||||
Brand kit
|
||||
For developers
|
||||
Submit a bug or request
|
||||
Bug bounty program
|
||||
API documentation
|
||||
Status
|
||||
Social
|
||||
Twitter
|
||||
Telegram
|
||||
GitHub
|
||||
LinkedIn
|
||||
Languages
|
||||
English
|
||||
Español
|
||||
Français
|
||||
Italiano
|
||||
Nederlands
|
||||
Português
|
||||
Русский
|
||||
中文
|
||||
فارسی
|
||||
Вahasa Indonesia
|
||||
Türkçe
|
||||
日本語
|
||||
한국어
|
||||
Deutsch
|
||||
© 2021 Blockchair
|
||||
Footer Blockchair logoNo 3d party trackers
|
||||
Works without javascript
|
||||
1.010-3049-g4e40c42b Thu Feb 3 12:14:18 UTC 2022
|
||||
@@ -1,28 +1,37 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as cache from '@actions/cache';
|
||||
import path from 'path';
|
||||
import * as utils from '../src/cache-utils';
|
||||
import {PackageManagerInfo, isCacheFeatureAvailable} from '../src/cache-utils';
|
||||
import {PackageManagerInfo} from '../src/cache-utils';
|
||||
|
||||
describe('cache-utils', () => {
|
||||
const commonPath = '/some/random/path';
|
||||
const versionYarn1 = '1.2.3';
|
||||
const versionYarn2 = '2.3.4';
|
||||
|
||||
let debugSpy: jest.SpyInstance;
|
||||
let getCommandOutputSpy: jest.SpyInstance;
|
||||
let isFeatureAvailable: jest.SpyInstance;
|
||||
let info: jest.SpyInstance;
|
||||
let warningSpy: jest.SpyInstance;
|
||||
|
||||
function getPackagePath(name: string) {
|
||||
if (name === utils.supportedPackageManagers.npm.getCacheFolderCommand) {
|
||||
return `${commonPath}/npm`;
|
||||
} else if (
|
||||
name === utils.supportedPackageManagers.pnpm.getCacheFolderCommand
|
||||
) {
|
||||
return `${commonPath}/pnpm`;
|
||||
} else {
|
||||
if (name === utils.supportedPackageManagers.yarn1.getCacheFolderCommand) {
|
||||
return `${commonPath}/yarn1`;
|
||||
} else {
|
||||
return `${commonPath}/yarn2`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
|
||||
debugSpy = jest.spyOn(core, 'debug');
|
||||
debugSpy.mockImplementation(msg => {});
|
||||
|
||||
info = jest.spyOn(core, 'info');
|
||||
warningSpy = jest.spyOn(core, 'warning');
|
||||
|
||||
isFeatureAvailable = jest.spyOn(cache, 'isFeatureAvailable');
|
||||
|
||||
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
|
||||
});
|
||||
|
||||
@@ -42,32 +51,7 @@ describe('cache-utils', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('isCacheFeatureAvailable for GHES is false', () => {
|
||||
isFeatureAvailable.mockImplementation(() => false);
|
||||
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
|
||||
|
||||
expect(() => isCacheFeatureAvailable()).toThrowError(
|
||||
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
|
||||
);
|
||||
});
|
||||
|
||||
it('isCacheFeatureAvailable for GHES has an interhal error', () => {
|
||||
isFeatureAvailable.mockImplementation(() => false);
|
||||
process.env['GITHUB_SERVER_URL'] = '';
|
||||
isCacheFeatureAvailable();
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||
);
|
||||
});
|
||||
|
||||
it('isCacheFeatureAvailable for GHES is available', () => {
|
||||
isFeatureAvailable.mockImplementation(() => true);
|
||||
|
||||
expect(isCacheFeatureAvailable()).toStrictEqual(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env['GITHUB_SERVER_URL'] = '';
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as im from '../src/installer';
|
||||
import * as cache from '@actions/cache';
|
||||
import fs from 'fs';
|
||||
import cp from 'child_process';
|
||||
import osm = require('os');
|
||||
@@ -37,7 +36,6 @@ describe('setup-node', () => {
|
||||
let execSpy: jest.SpyInstance;
|
||||
let authSpy: jest.SpyInstance;
|
||||
let parseNodeVersionSpy: jest.SpyInstance;
|
||||
let isCacheActionAvailable: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
// @actions/core
|
||||
@@ -69,9 +67,6 @@ describe('setup-node', () => {
|
||||
existsSpy = jest.spyOn(fs, 'existsSync');
|
||||
mkdirpSpy = jest.spyOn(io, 'mkdirP');
|
||||
|
||||
// @actions/tool-cache
|
||||
isCacheActionAvailable = jest.spyOn(cache, 'isFeatureAvailable');
|
||||
|
||||
// disable authentication portion for installer tests
|
||||
authSpy = jest.spyOn(auth, 'configAuthentication');
|
||||
authSpy.mockImplementation(() => {});
|
||||
@@ -649,49 +644,6 @@ describe('setup-node', () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('cache on GHES', () => {
|
||||
it('Should throw an error, because cache is not supported', async () => {
|
||||
inputs['node-version'] = '12';
|
||||
inputs['cache'] = 'npm';
|
||||
|
||||
inSpy.mockImplementation(name => inputs[name]);
|
||||
|
||||
let toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockImplementation(() => toolPath);
|
||||
|
||||
// expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
process.env['GITHUB_SERVER_URL'] = 'https://www.test.com';
|
||||
isCacheActionAvailable.mockImplementation(() => false);
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(cnSpy).toHaveBeenCalledWith(
|
||||
`::error::Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.${osm.EOL}`
|
||||
);
|
||||
});
|
||||
|
||||
it('Should throw an internal error', async () => {
|
||||
inputs['node-version'] = '12';
|
||||
inputs['cache'] = 'npm';
|
||||
|
||||
inSpy.mockImplementation(name => inputs[name]);
|
||||
|
||||
let toolPath = path.normalize('/cache/node/12.16.1/x64');
|
||||
findSpy.mockImplementation(() => toolPath);
|
||||
|
||||
// expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
|
||||
process.env['GITHUB_SERVER_URL'] = '';
|
||||
isCacheActionAvailable.mockImplementation(() => false);
|
||||
|
||||
await main.run();
|
||||
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('LTS version', () => {
|
||||
beforeEach(() => {
|
||||
os.platform = 'linux';
|
||||
|
||||
@@ -27,11 +27,15 @@ inputs:
|
||||
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
|
||||
# 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'
|
||||
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead'
|
||||
outputs:
|
||||
cache-hit:
|
||||
description: 'A boolean value to indicate if a cache was hit'
|
||||
runs:
|
||||
using: 'node16'
|
||||
using: 'node12'
|
||||
main: 'dist/setup/index.js'
|
||||
post: 'dist/cache-save/index.js'
|
||||
post-if: success()
|
||||
post-if: success()
|
||||
2301
dist/cache-save/index.js
vendored
2301
dist/cache-save/index.js
vendored
File diff suppressed because one or more lines are too long
3351
dist/setup/index.js
vendored
3351
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -10,8 +10,8 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
check-latest: true
|
||||
@@ -20,15 +20,15 @@ steps:
|
||||
```
|
||||
|
||||
## Node version file
|
||||
|
||||
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
|
||||
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
|
||||
|
||||
The `node-version-file` input accepts a path to a file containing the version of Node.js to be used by a project, for example `.nvmrc` or `.node-version`. If both the `node-version` and the `node-version-file` inputs are provided then the `node-version` input is used.
|
||||
See [supported version syntax](https://github.com/actions/setup-node#supported-version-syntax)
|
||||
> The action will search for the node version file relative to the repository root.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- run: npm install
|
||||
@@ -46,8 +46,8 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
name: Node sample
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
|
||||
@@ -58,12 +58,12 @@ jobs:
|
||||
## Caching packages dependencies
|
||||
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
|
||||
|
||||
**Caching yarn dependencies:**
|
||||
**Caching yarn dependencies:**
|
||||
Yarn caching handles both yarn versions: 1 or 2.
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'yarn'
|
||||
@@ -81,11 +81,11 @@ steps:
|
||||
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
|
||||
with:
|
||||
version: 6.10.0
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'pnpm'
|
||||
@@ -96,8 +96,8 @@ steps:
|
||||
**Using wildcard patterns to cache dependencies**
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -109,8 +109,8 @@ steps:
|
||||
**Using a list of file paths to cache dependencies**
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -146,9 +146,9 @@ jobs:
|
||||
architecture: x86
|
||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
architecture: ${{ matrix.architecture }}
|
||||
@@ -159,8 +159,8 @@ jobs:
|
||||
## Publish to npmjs and GPR with npm
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
@@ -168,7 +168,7 @@ steps:
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
registry-url: 'https://npm.pkg.github.com'
|
||||
- run: npm publish
|
||||
@@ -179,8 +179,8 @@ steps:
|
||||
## Publish to npmjs and GPR with yarn
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.x'
|
||||
registry-url: <registry url>
|
||||
@@ -188,7 +188,7 @@ steps:
|
||||
- run: yarn publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
registry-url: 'https://npm.pkg.github.com'
|
||||
- run: yarn publish
|
||||
@@ -199,8 +199,8 @@ steps:
|
||||
## Use private packages
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
5164
package-lock.json
generated
5164
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-node",
|
||||
"version": "3.1.0",
|
||||
"version": "2.0.0",
|
||||
"private": true,
|
||||
"description": "setup node action",
|
||||
"main": "lib/setup-node.js",
|
||||
@@ -23,7 +23,7 @@
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^2.0.0",
|
||||
"@actions/cache": "^1.0.8",
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^1.1.0",
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^16.11.25",
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@zeit/ncc": "^0.21.0",
|
||||
"jest": "^27.2.5",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as cache from '@actions/cache';
|
||||
|
||||
type SupportedPackageManagers = {
|
||||
[prop: string]: PackageManagerInfo;
|
||||
@@ -96,28 +95,3 @@ export const getCacheDirectoryPath = async (
|
||||
|
||||
return stdOut;
|
||||
};
|
||||
|
||||
export function isGhes(): boolean {
|
||||
const ghUrl = new URL(
|
||||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
);
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
}
|
||||
|
||||
export function isCacheFeatureAvailable(): boolean {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
if (isGhes()) {
|
||||
throw new Error(
|
||||
'Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'
|
||||
);
|
||||
} else {
|
||||
core.warning(
|
||||
'The runner was not able to contact the cache service. Caching will be skipped'
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
16
src/main.ts
16
src/main.ts
@@ -4,7 +4,7 @@ import fs from 'fs';
|
||||
import * as auth from './authutil';
|
||||
import * as path from 'path';
|
||||
import {restoreCache} from './cache-restore';
|
||||
import {isGhes, isCacheFeatureAvailable} from './cache-utils';
|
||||
import {URL} from 'url';
|
||||
import os = require('os');
|
||||
|
||||
export async function run() {
|
||||
@@ -45,7 +45,10 @@ export async function run() {
|
||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||
}
|
||||
|
||||
if (cache && isCacheFeatureAvailable()) {
|
||||
if (cache) {
|
||||
if (isGhes()) {
|
||||
throw new Error('Caching is not supported on GHES');
|
||||
}
|
||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||
await restoreCache(cache, cacheDependencyPath);
|
||||
}
|
||||
@@ -63,8 +66,15 @@ export async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
function isGhes(): boolean {
|
||||
const ghUrl = new URL(
|
||||
process.env['GITHUB_SERVER_URL'] || 'https://github.com'
|
||||
);
|
||||
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||
}
|
||||
|
||||
function resolveVersionInput(): string {
|
||||
let version = core.getInput('node-version');
|
||||
let version = core.getInput('node-version') || core.getInput('version');
|
||||
const versionFileInput = core.getInput('node-version-file');
|
||||
|
||||
if (version && versionFileInput) {
|
||||
|
||||
Reference in New Issue
Block a user