ci: cache Rust compilation with sccache#85
Merged
Merged
Conversation
rust-cache keys the entire target/ on Cargo.lock, so any dependency bump forces a full cold recompile of lux's large AWS-SDK + Tauri trees. sccache caches each crate content-addressed, so a lock change still hits for every unchanged crate. The desktop rust gate gets RUSTC_WRAPPER=sccache + the GitHub Actions cache backend, with rust-cache dropped to registry-only (cache-targets: false) since sccache now owns compilation; build-macos gets sccache alongside rust-cache (the fat-LTO link stays uncacheable, but per-arch dep compilation hits on lock changes). CARGO_INCREMENTAL=0 and sccache --show-stats for visibility.
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.
Adds sccache as the Rust compilation cache on both cargo CI jobs.
Why
Swatinem/rust-cachekeys the wholetarget/onCargo.lock, so any dependency bump invalidates it and forces a full cold recompile of lux's large dependency trees (full AWS SDK + Tauri). sccache caches each crate's compilation content-addressed (inputs + flags + rustc version), so aCargo.lockchange still hits for every crate that didn't actually change — the common PR case, and where the time goes.What
desktoprustgate (the frequent, non-LTO job, where this matters most):RUSTC_WRAPPER=sccachewith the GitHub Actions cache backend. rust-cache drops to registry-only (cache-targets: false) since sccache now owns compilation caching — keeps this job's GHA-cache footprint small.releasebuild-macos: sccache added alongside rust-cache. The final fat-LTO link isn't cacheable, but the universal build's per-arch dependency compilation hits across a lock bump.CARGO_INCREMENTAL=0(incremental output isn't cacheable) andsccache --show-statsafter each build so hit rates show up in the logs.Backend note
Using the GitHub Actions cache backend — zero infra, works immediately. Its 10 GB/repo cap with LRU eviction is the only limit; if it starts thrashing (the release
target/cache is large), the clean upgrade is sccache → S3 via the existing OIDC pattern (no cap, durable, no contention with rust-cache's GHA usage).