Skip to content

feat(ci): add sccache compilation caching with graceful fallback#324

Merged
DorianZheng merged 1 commit intomainfrom
feat/ci-sccache-compilation-caching
Mar 2, 2026
Merged

feat(ci): add sccache compilation caching with graceful fallback#324
DorianZheng merged 1 commit intomainfrom
feat/ci-sccache-compilation-caching

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Add sccache (per-compilation-unit caching via GHA cache API) to all Linux Docker builds across build-runtime, build-node, and build-wheels workflows
  • Create warm-caches.yml workflow (Bevy pattern) to pre-warm sccache on push to main and weekly cron, so subsequent builds get cache hits
  • Replace actions/cache for manylinux cargo registry with sccache (which caches compilation units, not just the registry)
  • Add three-layer graceful fallback so sccache failure never breaks builds:
    1. continue-on-error on sccache setup steps
    2. Conditional Docker mount (only if sccache binary exists on host)
    3. Container-level RUSTC_WRAPPER check + pass-through shim for cibuildwheel

Motivation

Three workflows independently compile the same Rust code inside manylinux Docker containers (~17-25 min each). Current caching (Swatinem + actions/cache) only caches the cargo registry — zero compilation caching inside Docker. sccache works inside containers via the GHA cache API and shares cache across all workflows.

Files Changed

File Change
.github/workflows/warm-caches.yml NEW — dedicated cache warmup workflow
.github/workflows/build-runtime.yml Remove actions/cache, add sccache with fallback
.github/workflows/build-node.yml Remove actions/cache, add sccache with fallback
.github/workflows/build-wheels.yml Add sccache via cibuildwheel environment-pass
sdks/python/pyproject.toml Add environment-pass + sccache install with shim fallback

Test plan

  • Trigger Warm Caches via workflow_dispatch — verify cold cache (all misses in sccache --show-stats)
  • Trigger Warm Caches again — verify warm cache (90%+ hits)
  • Trigger Build Runtime — verify sccache hits in Docker build, macOS unaffected
  • Trigger Build Node.js — verify sccache hits in Docker build
  • Trigger Build Wheels — verify sccache hits in cibuildwheel container
  • Verify fallback: if sccache setup step were to fail, builds should still succeed without caching

Add sccache (per-compilation-unit caching via GHA cache API) to all
Linux Docker builds, replacing the less effective actions/cache for
cargo registry. sccache works inside manylinux containers and shares
cache across build-runtime, build-node, and build-wheels workflows.

Key changes:
- New warm-caches.yml workflow (Bevy pattern) to pre-warm sccache on
  push to main and weekly cron
- Replace actions/cache with sccache in build-runtime and build-node
- Add sccache to build-wheels via cibuildwheel environment-pass
- Three-layer fallback ensures sccache failure never breaks builds:
  1. continue-on-error on sccache setup steps
  2. Conditional Docker mount (only if sccache binary exists on host)
  3. Container-level RUSTC_WRAPPER check + pass-through shim for
     cibuildwheel
@DorianZheng DorianZheng merged commit 13e0ffc into main Mar 2, 2026
22 checks passed
@DorianZheng DorianZheng deleted the feat/ci-sccache-compilation-caching branch March 2, 2026 10:06
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