From 9db57a85c05e08ddc4c48dd31c16ef7ae2b7febe Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sun, 6 Sep 2026 17:51:43 +0200 Subject: [PATCH 1/2] 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 --- .github/workflows/benchmark.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b512153621d8..9b15d5d4ecae 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,24 +106,30 @@ 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 || ''); + core.exportVariable('NIX_SCCACHE', '(import {}).sccache'); - name: Build Node.js on the base commit run: | 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 devTools '[]' \ --arg benchmarkTools '[]' \ --run ' + set -e make build-ci -j4 V=1 + sccache --stop-server ' mv out/Release/node base_node @@ -130,19 +137,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 "${NIX_SCCACHE:-null}" \ --arg devTools '[]' \ --arg benchmarkTools '[]' \ --run ' make build-ci -j4 V=1 ' + env: + SCCACHE_LOCAL_RW_MODE: READ_ONLY - name: Run benchmark run: | From e01854636c7bcfce379910229d1ecc61dbcd4b01 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sun, 6 Sep 2026 22:51:58 +0200 Subject: [PATCH 2/2] fixup! tools: improve benchmark build cache reuse --- .github/workflows/benchmark.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9b15d5d4ecae..924feb42725e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -111,7 +111,6 @@ jobs: 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 || ''); - core.exportVariable('NIX_SCCACHE', '(import {}).sccache'); - name: Build Node.js on the base commit run: | @@ -123,13 +122,11 @@ jobs: --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 ' - set -e - make build-ci -j4 V=1 - sccache --stop-server + make build-ci -j4 V=1 && sccache --stop-server ' mv out/Release/node base_node @@ -145,7 +142,7 @@ jobs: --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 '