build: skip sscache action on non-main branches#61790
Open
joyeecheung wants to merge 1 commit intonodejs:mainfrom
Open
build: skip sscache action on non-main branches#61790joyeecheung wants to merge 1 commit intonodejs:mainfrom
joyeecheung wants to merge 1 commit intonodejs:mainfrom
Conversation
To reduce cache thrashing.
Collaborator
|
Review requested:
|
marco-ippolito
approved these changes
Feb 12, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files🚀 New features to boost your workflow:
|
bnb
approved these changes
Feb 12, 2026
targos
approved these changes
Feb 12, 2026
lpinca
approved these changes
Feb 12, 2026
aduh95
reviewed
Feb 13, 2026
Comment on lines
+105
to
+106
| CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang-19' || 'clang-19' }} | ||
| CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || 'clang++-19' }} |
Contributor
There was a problem hiding this comment.
Can we avoid the repetition?
Suggested change
| CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang-19' || 'clang-19' }} | |
| CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache clang++-19' || 'clang++-19' }} | |
| CC: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang-19 | |
| CXX: ${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'sccache' || '' }} clang++-19 |
aduh95
reviewed
Feb 13, 2026
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN' || '' }} \ | ||
| --arg loadJSBuiltinsDynamically false \ | ||
| --arg ccache '(import <nixpkgs> {}).sccache' \ | ||
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--arg ccache ''(import <nixpkgs> {}).sccache''' || '' }} \ |
Contributor
There was a problem hiding this comment.
We should set it to null otherwise it defaults to ccache (which would be pure overhead on a ephemeral runner)
Suggested change
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--arg ccache ''(import <nixpkgs> {}).sccache''' || '' }} \ | |
| --arg ccache '${{ (github.base_ref == 'main' || github.ref_name == 'main') && 'import <nixpkgs> {}).sccache' || 'null' }}' \ |
Alternatively, we could define it in the Configure sccache step above, and fallback to null if it was skipped
Suggested change
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--arg ccache ''(import <nixpkgs> {}).sccache''' || '' }} \ | |
| --arg ccache "${NIX_SCCACHE:-null}" |
aduh95
reviewed
Feb 13, 2026
| -I nixpkgs=./tools/nix/pkgs.nix \ | ||
| --pure --keep TAR_DIR --keep FLAKY_TESTS \ | ||
| --keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ | ||
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN' || '' }} \ |
Contributor
There was a problem hiding this comment.
nit: I would simplify this, it's no big deal if we pass not-defined variables
Suggested change
| ${{ (github.base_ref == 'main' || github.ref_name == 'main') && '--keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN' || '' }} \ | |
| --keep SCCACHE_GHA_VERSION --keep ACTIONS_CACHE_SERVICE_V2 --keep ACTIONS_RESULTS_URL --keep ACTIONS_RUNTIME_TOKEN \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To reduce cache thrashing.
From a look at the action results, PRs targeting non-main generally don't have a good cache hit rate anyway, so it seems better to just keep it to main where the majority of the volume is:
https://github.com/nodejs/node/actions/runs/21866462915
https://github.com/nodejs/node/actions/runs/21866461713
Refs: #61436