From a3b19875ec1e23fd592edf9b1768fe116b020f8a Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 22 Mar 2026 15:58:25 +0100 Subject: [PATCH] Implement Node.js caching in the GitHub Actions workflows The `setup-node` action contains built-in support for caching [1], so this commit makes sure we use it for all Node.js-based workflows to reduce workflow execution time. Note that, contrary what one might expect [2], the `node_modules` directory is deliberately not cached because it can conflict with differing Node.js versions and because it's not useful in combination with `npm ci` usage which wipes the `node_modules` folder unconditionally. Therefore, the action instead caches the global `npm` cache directory instead which does not suffer from these problems and still provides a speed-up at installation time. [1] https://github.com/actions/setup-node?tab=readme-ov-file#caching-global-packages-data [2] https://github.com/actions/setup-node/issues/416 [3] https://github.com/actions/cache/issues/67 --- .github/workflows/ci.yml | 1 + .github/workflows/coverage.yml | 1 + .github/workflows/font_tests.yml | 1 + .github/workflows/lint.yml | 1 + .github/workflows/prefs_tests.yml | 1 + .github/workflows/publish_release.yml | 1 + .github/workflows/publish_website.yml | 1 + .github/workflows/types_tests.yml | 1 + .github/workflows/update_locales.yml | 1 + 9 files changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b5c4a796..fa70d5d83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 94d36ed7f..0650efe03 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,6 +25,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/font_tests.yml b/.github/workflows/font_tests.yml index 1dcecb6e9..6ff7aecde 100644 --- a/.github/workflows/font_tests.yml +++ b/.github/workflows/font_tests.yml @@ -46,6 +46,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0fb706004..c9ec2cb58 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/prefs_tests.yml b/.github/workflows/prefs_tests.yml index fb8c91e91..96c8c9784 100644 --- a/.github/workflows/prefs_tests.yml +++ b/.github/workflows/prefs_tests.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 5fe18a329..b9dd3e9ff 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -26,6 +26,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' registry-url: 'https://registry.npmjs.org' - name: Install dependencies diff --git a/.github/workflows/publish_website.yml b/.github/workflows/publish_website.yml index f8d12822a..b55d86679 100644 --- a/.github/workflows/publish_website.yml +++ b/.github/workflows/publish_website.yml @@ -26,6 +26,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/types_tests.yml b/.github/workflows/types_tests.yml index 9d08a0e05..30d565817 100644 --- a/.github/workflows/types_tests.yml +++ b/.github/workflows/types_tests.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: ${{ matrix.node-version }} + cache: 'npm' - name: Install dependencies run: npm ci diff --git a/.github/workflows/update_locales.yml b/.github/workflows/update_locales.yml index 49718b679..18ca96bfc 100644 --- a/.github/workflows/update_locales.yml +++ b/.github/workflows/update_locales.yml @@ -24,6 +24,7 @@ jobs: uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6 with: node-version: lts/* + cache: 'npm' - name: Install dependencies run: npm ci