Skip to content

Conversation

@Renegade334
Copy link
Member

meta: use SCCACHE_GHA_ENABLED for shared build workflows

The test-shared workflow currently sets SCCACHE_GHA_VERSION=on; while this (non-canonically) enables the GHA cache, it also appends "-on" to the version tag of every uploaded cache entry, which prevents any cache entries from being shared with the non-shared workflows. Using the canonical SCCACHE_GHA_ENABLED doesn't overwrite the version string, which means that shared and non-shared builds can share cache hits where available.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Feb 2, 2026
Copy link
Member

@targos targos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I don't think this will actually have an impact. Builds are too different.

@Renegade334 Renegade334 added blocked PRs that are blocked by other issues or PRs. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Feb 3, 2026
@Renegade334 Renegade334 marked this pull request as ready for review February 3, 2026 17:11
@richardlau
Copy link
Member

which prevents any cache entries from being shared with the non-shared workflows.

I have no idea how sccache works, but for ccache (used in Jenkins) sharing cache between shared and non-shared builds doesn't give any benefits because the arguments passed to the compiler/linker are different. If anything this will probably end up causing earlier eviction of cache entries that could have been reused.

@Renegade334
Copy link
Member Author

If anything this will probably end up causing earlier eviction of cache entries that could have been reused.

This will cause one-time invalidation of the shared build cache, for sure. Beyond that, it should be zero-impact at worst.

@richardlau
Copy link
Member

If anything this will probably end up causing earlier eviction of cache entries that could have been reused.

This will cause one-time invalidation of the shared build cache, for sure. Beyond that, it should be zero-impact at worst.

I meant that if sccache is like ccache, then sharing the cache would lead to, e.g.

  1. Non-shared build runs. Populates cache.
  2. Shared build runs. Results are different from previous non-shared run (due to differing arguments to the compiler/linker). So new entries added to cache. If cache hits size limit (does sccache have those?) then older cache entries (e.g. from the previous non-shared build runs) are evicted.
  3. New non-shared build runs. If results from 1. have already been evicted the benefits of caching are now negated.

@Renegade334
Copy link
Member Author

I meant that if sccache is like ccache, then sharing the cache would lead to, e.g.

  1. Non-shared build runs. Populates cache.
  2. Shared build runs. Results are different from previous non-shared run (due to differing arguments to the compiler/linker). So new entries added to cache. If cache hits size limit (does sccache have those?) then older cache entries (e.g. from the previous non-shared build runs) are evicted.
  3. New non-shared build runs. If results from 1. have already been evicted the benefits of caching are now negated.

Probably poor nomenclature on my part – the cache storage itself (including any eviction limits) is shared between all our GHA builds irrespective of the version field in the entries, the version field is just metadata on the GHA storage side that enforces a cache miss on mismatch even if the keys match. So, shared and non-shared builds are currently guaranteed not to retrieve cache artifacts from the other – which will likely not change much, granted, but there's no real downside to this change either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. blocked PRs that are blocked by other issues or PRs. meta Issues and PRs related to the general management of the project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants