From 7c5115d0015eaa40329f2c70af453b5deb06de8a Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 8 Sep 2026 18:13:56 +0200 Subject: [PATCH] tools: improve benchmark build cache reuse Match Linux x64 benchmark builds to the Perfetto-enabled V8 configuration already cached by shared-library CI. Enable the GHA sccache backend in read-only mode for base builds. Retain the compiler wrapper for incremental PR builds, but stop the remote-backed server and use a read-only local cache for PR code. Assisted-by: GitHub Copilot Signed-off-by: Filip Skokan PR-URL: https://github.com/nodejs/node/pull/65859 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel --- .github/workflows/benchmark.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b512153621d..924feb42725 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -69,13 +69,14 @@ jobs: include: - runner: ubuntu-24.04 system: x86_64-linux + perfetto: true - runner: ubuntu-24.04-arm system: aarch64-linux - runner: macos-15-intel system: x86_64-darwin - runner: macos-latest system: aarch64-darwin - name: '${{ matrix.system }}: with shared libraries' + name: '${{ matrix.system }}: with shared libraries${{ matrix.perfetto && '' and perfetto'' || '''' }}' runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -105,7 +106,8 @@ jobs: uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | - core.exportVariable('SCCACHE_GHA_VERSION', 'on'); + core.exportVariable('SCCACHE_GHA_ENABLED', 'on'); + core.exportVariable('SCCACHE_GHA_RW_MODE', 'READ_ONLY'); core.exportVariable('ACTIONS_CACHE_SERVICE_V2', 'on'); core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); @@ -115,14 +117,16 @@ jobs: nix-shell \ -I nixpkgs=./tools/nix/pkgs.nix \ --pure --keep TAR_DIR --keep FLAKY_TESTS \ - --keep SCCACHE_GHA_ENABLED --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ + --keep SCCACHE_GHA_ENABLED --keep SCCACHE_GHA_RW_MODE \ + --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ --arg useSeparateDerivationForV8 true \ + --arg withPerfetto ${{ matrix.perfetto || false }} \ --arg loadJSBuiltinsDynamically false \ - --arg ccache "${NIX_SCCACHE:-null}" \ + --arg ccache '(import {}).sccache' \ --arg devTools '[]' \ --arg benchmarkTools '[]' \ --run ' - make build-ci -j4 V=1 + make build-ci -j4 V=1 && sccache --stop-server ' mv out/Release/node base_node @@ -130,19 +134,22 @@ jobs: run: git reset FETCH_HEAD --hard - name: Re-build Node.js on the merge commit - # ccache is disabled here to avoid polluting the cache. Local build outputs should make this build relatively quick anyway. + # Keep the compiler command unchanged for incremental builds, but never cache PR build outputs. run: | nix-shell \ -I nixpkgs=./tools/nix/pkgs.nix \ - --pure \ + --pure --keep SCCACHE_LOCAL_RW_MODE \ --arg useSeparateDerivationForV8 true \ + --arg withPerfetto ${{ matrix.perfetto || false }} \ --arg loadJSBuiltinsDynamically false \ - --arg ccache 'null' \ + --arg ccache '(import {}).sccache' \ --arg devTools '[]' \ --arg benchmarkTools '[]' \ --run ' make build-ci -j4 V=1 ' + env: + SCCACHE_LOCAL_RW_MODE: READ_ONLY - name: Run benchmark run: |