mirror of
https://github.com/actions/setup-node.git
synced 2025-11-07 13:06:55 +00:00
Compare commits
3 commits
e075a82bc6
...
33d9e9b3f7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33d9e9b3f7 | ||
|
|
dda4788290 | ||
|
|
497723e433 |
4 changed files with 31 additions and 6 deletions
|
|
@ -8,8 +8,6 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import osm from 'os';
|
||||
|
||||
import each from 'jest-each';
|
||||
|
||||
import * as main from '../src/main';
|
||||
import * as util from '../src/util';
|
||||
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
||||
|
|
@ -93,7 +91,7 @@ describe('main tests', () => {
|
|||
}, 100000);
|
||||
|
||||
describe('getNodeVersionFromFile', () => {
|
||||
each`
|
||||
it.each`
|
||||
contents | expected
|
||||
${'12'} | ${'12'}
|
||||
${'12.3'} | ${'12.3'}
|
||||
|
|
@ -110,7 +108,7 @@ describe('main tests', () => {
|
|||
${'{"volta": {"extends": "./package.json"}}'}| ${'18.0.0'}
|
||||
${'{"engines": {"node": "17.0.0"}}'} | ${'17.0.0'}
|
||||
${'{}'} | ${null}
|
||||
`.it('parses "$contents"', ({contents, expected}) => {
|
||||
`('parses "$contents"', ({contents, expected}) => {
|
||||
const existsSpy = jest.spyOn(fs, 'existsSync');
|
||||
existsSpy.mockImplementation(() => true);
|
||||
|
||||
|
|
|
|||
|
|
@ -300,6 +300,35 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
**Restore-Only Cache**
|
||||
|
||||
```yaml
|
||||
## In some workflows, you may want to restore a cache without saving it. This can help reduce cache writes and storage usage in workflows that only need to read from cache
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
# Restore Node.js modules cache (restore-only)
|
||||
- name: Restore Node modules cache
|
||||
uses: actions/cache@v4
|
||||
id: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
# Setup Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
# Install dependencies
|
||||
- run: npm install
|
||||
```
|
||||
|
||||
> For more details related to cache scenarios, please refer [Node – npm](https://github.com/actions/cache/blob/main/examples.md#node---npm).
|
||||
|
||||
## Multiple Operating Systems and Architectures
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -33,7 +33,6 @@
|
|||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"jest-each": "^29.7.0",
|
||||
"prettier": "^3.6.2",
|
||||
"ts-jest": "^29.4.1",
|
||||
"typescript": "^5.4.2"
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@
|
|||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-circus": "^29.7.0",
|
||||
"jest-each": "^29.7.0",
|
||||
"prettier": "^3.6.2",
|
||||
"ts-jest": "^29.4.1",
|
||||
"typescript": "^5.4.2"
|
||||
|
|
|
|||
Loading…
Reference in a new issue