ci: enable sccache GHA backend and optimize rust-cache keys#372
Merged
streamer45 merged 1 commit intomainfrom Apr 25, 2026
Merged
ci: enable sccache GHA backend and optimize rust-cache keys#372streamer45 merged 1 commit intomainfrom
streamer45 merged 1 commit intomainfrom
Conversation
- Add SCCACHE_GHA_ENABLED=true to all Rust workflows so sccache uses the GitHub Actions cache API instead of local disk (which is empty on each ephemeral runner, causing 0% hit rate). - Add RUSTC_WRAPPER=sccache to release.yml and marketplace-build.yml where it was missing (sccache was installed but never used). - Use shared-key in Swatinem/rust-cache to group jobs with similar compilation profiles: skit (lint/test/build), skit-e2e (pipeline-validation/playwright), skit-gpu (GPU jobs). This reduces 7 independent cache namespaces to 3. - Add save-if on hosted runner jobs so rust-cache is only saved from main branch runs. PR runs still restore from main cache; sccache handles the delta for changed crates. - Enable cache-on-failure everywhere so partially-completed builds still contribute to the cache. Signed-off-by: StreamKit Devin <devin@streamkit.dev> Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
Contributor
Author
|
✅ Reviewed on |
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
3 tasks
streamer45
added a commit
that referenced
this pull request
Apr 25, 2026
The sccache GHA backend stores one cache entry per compiled artifact, creating ~1000 tiny entries that evict the much more valuable Swatinem/rust-cache entries (full target/ snapshots) via LRU. Remove SCCACHE_GHA_ENABLED from all workflows. On hosted runners sccache falls back to local disk (harmless no-op on ephemeral VMs). On the self-hosted GPU runner it continues to work via persistent local disk cache. The other optimizations from #372 (shared-key, save-if, cache-on-failure, RUSTC_WRAPPER) remain in place. Signed-off-by: StreamKit Devin <devin@streamkit.dev> Co-authored-by: StreamKit Devin <devin@streamkit.dev> Co-authored-by: Claudio Costa <cstcld91@gmail.com>
This was referenced Apr 25, 2026
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.
Summary
sccache has been running with a 0% cache hit rate on all hosted runner jobs because the
SCCACHE_GHA_ENABLEDenvironment variable was never set. Themozilla-actions/sccache-action@v0.0.9installs sccache and exposes the GHA cache service variables but — unlike earlier versions — does not setSCCACHE_GHA_ENABLED=true. Without it, sccache falls back to local disk (/home/runner/.cache/sccache), which is empty on each ephemeral runner.Additionally,
release.ymlandmarketplace-build.ymlinstalled sccache but never setRUSTC_WRAPPER=sccache, so it was never used as the compiler wrapper.This PR fixes these issues and optimizes the
Swatinem/rust-cacheconfiguration:Enable sccache GHA backend — adds
SCCACHE_GHA_ENABLED: "true"to all 5 Rust workflow env blocks (skit.yml,e2e.yml,plugins.yml,release.yml,marketplace-build.yml).Add
RUSTC_WRAPPER: sccachetorelease.ymlandmarketplace-build.ymlwhere it was missing.Share rust-cache via
shared-key— groups 7 independent job caches into 3 shared namespaces:skit→ lint, test, build (ubuntu-22.04)skit-e2e→ pipeline-validation, playwright-e2e (ubuntu-22.04)skit-gpu→ test-gpu, pipeline-validation-gpu (self-hosted)Save rust-cache only from main — adds
save-if: ${{ github.ref == 'refs/heads/main' }}on hosted runner jobs so PR pushes don't churn the cache pool. sccache (now with GHA backend) handles the delta for changed crates.Enable
cache-on-failure: trueon all rust-cache entries so partially-completed builds still contribute.Evidence from a recent
Skit / Testrun showing the problem:The self-hosted GPU runner (persistent disk) confirms sccache works when it has a warm cache:
Review & Testing Checklist for Human
Skit / TestandSkit / Lintpost-step should showCache location: GitHub Actions Cacheinstead ofLocal diskand a non-zero hit rate on subsequent runsv0-rust-*entries has decreased (3 shared-key groups instead of 7 per-job groups)Notes
skit-gpushared-key) do not havesave-ifsince the GPU runner's persistent local sccache disk already provides excellent hit rates, and always-save ensures the GHA rust-cache stays warm as a fallback.cargo clippyinvocations (~85% of lint calls are "multiple input files") or proc-macro/cdylib crate types (~50% of test/build).rust-cachecontinues to handle these via target/ snapshot restore.plugins.ymlrust-cache already hadcache-on-failure: trueand a customworkspacesconfig — onlySCCACHE_GHA_ENABLEDwas added there.Link to Devin session: https://staging.itsdev.in/sessions/cdf841e834eb419aa04168a565311f10
Requested by: @streamer45