From d3b7519239febf873d81628cdab6f987af7f2aaa Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Fri, 11 Apr 2025 15:59:15 -0700 Subject: [PATCH] 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/ --- .github/workflows/check-dist.yml | 7 +++---- .github/workflows/dependabot-build.yml | 8 +++----- .github/workflows/integration-test.yml | 10 ++++------ .github/workflows/test.yml | 16 ++++++---------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 17529b8fa..e2a13364e 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -14,13 +14,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + cache: 'npm' - - name: Install npm dependencies - run: npm clean-install + - run: npm clean-install - name: Rebuild the dist/ directory run: npm run package diff --git a/.github/workflows/dependabot-build.yml b/.github/workflows/dependabot-build.yml index 3eaf4d81c..cdbe29ed7 100644 --- a/.github/workflows/dependabot-build.yml +++ b/.github/workflows/dependabot-build.yml @@ -32,16 +32,14 @@ jobs: # Check out using a PAT so any pushed changes will trigger checkruns - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.DEPENDABOT_AUTOBUILD }} - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + cache: 'npm' - - name: Install npm dependencies - run: npm clean-install + - run: npm clean-install # If we're reacting to a Docker PR, we have on extra step to refresh and check in the container manifest, # this **must** happen before rebuilding dist/ so it uses the new version of the manifest diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 0b2cb72a0..4b8b4de82 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,18 +15,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + cache: 'npm' - - name: Install npm dependencies - run: npm clean-install + - run: npm clean-install - name: Pre-fetch the pinned images run: npm run fetch-images -- bundler - - name: Run integration tests - run: npm run test-integration + - run: npm run test-integration env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ef3db34c..5059693cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,19 +13,15 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version-file: .nvmrc + cache: 'npm' - - name: Install npm dependencies - run: npm clean-install + - run: npm clean-install - - name: Check formatting - run: npm run format-check + - run: npm run format-check - - name: Run linter - run: npm run lint-check + - run: npm run lint-check - - name: Run tests - run: npm run test + - run: npm run test