Skip to content

refactor(ci): consolidate all compilation caching to sccache#328

Merged
DorianZheng merged 1 commit intomainfrom
refactor/consolidate-sccache-caching
Mar 2, 2026
Merged

refactor(ci): consolidate all compilation caching to sccache#328
DorianZheng merged 1 commit intomainfrom
refactor/consolidate-sccache-caching

Conversation

@DorianZheng
Copy link
Copy Markdown
Member

Summary

  • Remove Swatinem/rust-cache from all workflows (build-runtime, build-wheels, build-node, test) and standardize on sccache as the sole compilation cache
  • Extend sccache to macOS (previously Linux-only) by removing platform conditions from sccache setup and GHA env export steps
  • Add sccache to lint and test workflows: clippy job (lint.yml), cli and go jobs (test.yml)
  • Chain build-runtime after warm-caches via workflow_run trigger so builds benefit from warm cache
  • Fix build-wheels.yml: remove explicit SCCACHE_GHA_ENABLED/RUSTC_WRAPPER from Export step to prevent macOS failures when sccache-action fails with continue-on-error

Why

Two caching systems (Swatinem + sccache) created redundancy:

  • sccache already caches all compilation work (the expensive part)
  • Swatinem doesn't work inside Docker/manylinux containers (the main bottleneck)
  • Both compete for the 10GB GHA cache limit

Trade-off: Cargo dependencies are re-downloaded each run (~30-60s) since Swatinem cached ~/.cargo, but compilation (5-20 min) is the real bottleneck that sccache addresses.

Test plan

  • YAML validation passes for all 6 workflow files
  • Open PR touching Rust code triggers test.yml and lint.yml — verify sccache stats in cli, go, and clippy jobs
  • Manual workflow_dispatch on build-runtime.yml — verify macOS sccache stats appear
  • After merge: verify Warm Caches → Build Runtime chain works via workflow_run
  • Verify rust test job (llvm-cov) works without sccache (no RUSTC_WRAPPER conflict)
  • Check GHA cache (Settings > Actions > Caches) — Swatinem rust-cache-* entries should stop being created

Remove Swatinem/rust-cache from all workflows and standardize on
sccache as the sole compilation cache. sccache caches individual
compilation units via the GHA cache API, which works both on host
runners and inside Docker/manylinux containers — unlike Swatinem
which only caches host-level target/ directories.

Changes:
- Remove Swatinem/rust-cache from build-runtime, build-wheels,
  build-node, and test workflows
- Extend sccache to macOS (previously Linux-only) by removing
  platform conditions from sccache setup and GHA env export steps
- Add sccache to clippy (lint.yml) and cli/go test jobs (test.yml)
- Skip sccache for rust test job (cargo-llvm-cov conflicts via
  RUSTC_WRAPPER)
- Add CARGO_INCREMENTAL=0 everywhere (required for sccache)
- Chain build-runtime after warm-caches via workflow_run trigger
- Fix build-wheels Export step: remove explicit SCCACHE_GHA_ENABLED
  and RUSTC_WRAPPER (let sccache-action set them on success only)
- Update README.md with new architecture diagram and cache docs
@DorianZheng DorianZheng merged commit f3846c3 into main Mar 2, 2026
23 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