Skip to content

Commit bc54419

Browse files
committed
Enable caching of npm install/npm ci for setup-node action
The `setup-node` action now supports caching the results of `npm install`/`npm ci`: https://github.blog/changelog/2021-07-02-github-actions-setup-node-now-supports-dependency-caching/
1 parent 21e2530 commit bc54419

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

.github/workflows/check-dist.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Setup Node.js
18-
uses: actions/setup-node@v4
17+
- uses: actions/setup-node@v4
1918
with:
2019
node-version-file: .nvmrc
20+
cache: 'npm'
2121

22-
- name: Install npm dependencies
23-
run: npm clean-install
22+
- run: npm clean-install
2423

2524
- name: Rebuild the dist/ directory
2625
run: npm run package

.github/workflows/dependabot-build.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ jobs:
3232
# Check out using a PAT so any pushed changes will trigger checkruns
3333
- uses: actions/checkout@v4
3434
with:
35-
ref: ${{ github.event.pull_request.head.ref }}
3635
token: ${{ secrets.DEPENDABOT_AUTOBUILD }}
3736

38-
- name: Setup Node.js
39-
uses: actions/setup-node@v4
37+
- uses: actions/setup-node@v4
4038
with:
4139
node-version-file: .nvmrc
40+
cache: 'npm'
4241

43-
- name: Install npm dependencies
44-
run: npm clean-install
42+
- run: npm clean-install
4543

4644
# If we're reacting to a Docker PR, we have on extra step to refresh and check in the container manifest,
4745
# this **must** happen before rebuilding dist/ so it uses the new version of the manifest

.github/workflows/integration-test.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@ jobs:
1717
with:
1818
ref: ${{ github.event.pull_request.head.sha }}
1919

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v4
20+
- uses: actions/setup-node@v4
2221
with:
2322
node-version-file: .nvmrc
23+
cache: 'npm'
2424

25-
- name: Install npm dependencies
26-
run: npm clean-install
25+
- run: npm clean-install
2726

2827
- name: Pre-fetch the pinned images
2928
run: npm run fetch-images -- bundler
3029

31-
- name: Run integration tests
32-
run: npm run test-integration
30+
- run: npm run test-integration
3331
env:
3432
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/test.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Setup Node.js
17-
uses: actions/setup-node@v4
16+
- uses: actions/setup-node@v4
1817
with:
1918
node-version-file: .nvmrc
19+
cache: 'npm'
2020

21-
- name: Install npm dependencies
22-
run: npm clean-install
21+
- run: npm clean-install
2322

24-
- name: Check formatting
25-
run: npm run format-check
23+
- run: npm run format-check
2624

27-
- name: Run linter
28-
run: npm run lint-check
25+
- run: npm run lint-check
2926

30-
- name: Run tests
31-
run: npm run test
27+
- run: npm run test

0 commit comments

Comments
 (0)