Prototype: sccache via GitHub Actions cache backend (Linux + macOS Ninja)#1680
Closed
bghgary wants to merge 1 commit into
Closed
Prototype: sccache via GitHub Actions cache backend (Linux + macOS Ninja)#1680bghgary wants to merge 1 commit into
bghgary wants to merge 1 commit into
Conversation
…nja) Wires mozilla-actions/sccache-action@v0.0.10 into build-linux.yml (all matrix entries) and build-macos.yml (Ninja generator only) with SCCACHE_GHA_ENABLED=true so sccache uses the per-repo GHA cache (10 GB) as backend. Adds CMAKE_*_COMPILER_LAUNCHER -D flags and a sccache --show-stats step for empirical evaluation. Xcode/Visual-Studio generators are skipped because CMAKE_<LANG>_COMPILER_LAUNCHER does not work with those generators. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
[Closed by Copilot on behalf of @bghgary] Closing — comparing single-run timings against master's runner-variance baseline doesn't show a clear win, and our build is mostly not suitable for compiler caching anyway (xcodebuild dispatches compilation in ways sccache doesn't reliably intercept; many translation units pull in codegen / linkage-affecting state that invalidates per-file caching). Will revisit if we change the build shape or hit a specific bottleneck that compiler caching could meaningfully target. |
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.
Context
Prototype for accelerating CI compile time using sccache with the GitHub Actions cache as the backend. Motivated by sanitizer / fresh-runner build times where most of the wall clock is recompiling unchanged dependency code (bgfx, bx, bimg, glslang, SPIRV-Cross, libwebp, JsRuntimeHost, etc.).
What this does
mozilla-actions/sccache-action@v0.0.10to two reusable workflows.SCCACHE_GHA_ENABLED=trueso sccache uses the per-repo GitHub Actions cache (10 GB) as its storage backend — no external infra required.-D CMAKE_{C,CXX}_COMPILER_LAUNCHER=sccache(andOBJC/OBJCXXon macOS).sccache --show-statsstep (withif: always()) so each run reports cache hits / misses / size for empirical evaluation.Scope
Intentionally narrow for the prototype:
Ubuntu_Clang_JSC,Ubuntu_GCC_JSC, sanitizers)MacOS_NinjaonlyMacOS,MacOS_Sanitizers,MacOS_Xcode26Visual Studio 17 2022The macOS Xcode and Win32 entries are skipped because
CMAKE_<LANG>_COMPILER_LAUNCHERis implemented for the Makefile and Ninja generators only — not for the Xcode or Visual Studio generators. Adding sccache there would require switching their generator (a separate, larger change) so it's deferred.The macOS step is gated with
if: inputs.generator != 'Xcode'soMacOS_Ninjapicks it up while the Xcode-generator entries continue to skip it cleanly.What sccache will and won't help
Will help: BN source, bgfx, bx, bimg, glslang, SPIRV-Cross, libwebp, JsRuntimeHost, arcana, plugin sources — anything FetchContent-built or compiled from source by BN.
Won't help:
So expected wall-clock gains are bounded by the compile share of total job time. For sanitizer builds that share is high.
How to evaluate
After this lands as draft, look at the new "sccache stats" step output in each Linux +
MacOS_Ninjajob:If results are good, follow-up PRs can:
cmake_policy(SET CMP0141 NEW)for/Z7debug-info to make sanitizer objects cacheable).Caveats
masterruns. That's normal — the master cache warms over time and PRs benefit from it.@v0.0.10). For stronger supply-chain hygiene we could pin to a commit SHA in a follow-up.[Created by Copilot on behalf of @bghgary]