Skip to content

ci: cache Rust compilation with sccache#85

Merged
johncarmack1984 merged 1 commit into
mainfrom
ci/sccache
Jun 30, 2026
Merged

ci: cache Rust compilation with sccache#85
johncarmack1984 merged 1 commit into
mainfrom
ci/sccache

Conversation

@johncarmack1984

@johncarmack1984 johncarmack1984 commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Adds sccache as the Rust compilation cache on both cargo CI jobs.

Why

Swatinem/rust-cache keys the whole target/ on Cargo.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 a Cargo.lock change still hits for every crate that didn't actually change — the common PR case, and where the time goes.

What

  • desktop rust gate (the frequent, non-LTO job, where this matters most): RUSTC_WRAPPER=sccache with 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.
  • release build-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) and sccache --show-stats after 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).

The win shows from the second run onward — the first populates the cache.

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.
@johncarmack1984 johncarmack1984 merged commit 0e77e8e into main Jun 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant