Skip to content

vercel/sccache

 
 

Repository files navigation

sccache (Vercel fork)

This is a Vercel-maintained fork of mozilla/sccache. It is maintained as a linear stack of patches (one commit = one feature) on top of the upstream main branch.

For full upstream documentation, see the upstream README or the upstream repository.

Patches

Each patch is a single commit. Generate the current patch list with:

git log --oneline upstream/main..HEAD

Current patches (oldest first):

  1. Multi-level caching with automatic backfill — Cherry-picked from upstream mozilla/sccache#2581. Adds hierarchical cache storage (e.g., disk -> redis -> s3) with configurable write tolerance policies and automatic backfill from slower tiers. Drop this patch once the PR is merged upstream.

  2. Allow caching all Rust crate types via SCCACHE_RUST_CRATE_TYPE_ALLOW_HASH — Vercel-originated patch. When this env var is set, all crate types (bin, dylib, cdylib, proc-macro) become cacheable. The env var value is hashed into the cache key only when unsupported crate types are present, so machines with different linker setups get separate cache entries.

  3. Upgrade opendal + Vercel Artifacts cache backend — Upgrades opendal to mmastrac/opendal vercel_opts branch via [patch.crates-io] (apache/opendal#7334). Adds layers-logging feature and aws-lc-sys/prebuilt-nasm. Adds Vercel Artifacts cache backend configured via SCCACHE_VERCEL_ARTIFACTS_TOKEN, plus optional SCCACHE_VERCEL_ARTIFACTS_ENDPOINT, SCCACHE_VERCEL_ARTIFACTS_TEAM_ID, SCCACHE_VERCEL_ARTIFACTS_TEAM_SLUG. Once the upstream opendal PR merges, switch the patch to apache/opendal main. Drop the patch entirely once opendal publishes a release with these changes.

  4. This README + CI/release workflows — Fork documentation, CI test workflow, and release workflow.

Files changed per patch

Use git diff-tree --no-commit-id --name-status -r <commit> to verify each patch only touches expected files.

Patch 1 — multi-level caching: M README.md M docs/Configuration.md A docs/MultiLevel.md M src/cache/cache.rs M src/cache/disk.rs M src/cache/mod.rs A src/cache/multilevel.rs A src/cache/multilevel_test.rs M src/cache/readonly.rs M src/compiler/preprocessor_cache.rs M src/config.rs M src/server.rs M tests/harness/mod.rs M tests/integration/Makefile M tests/integration/docker-compose.yml M tests/integration/scripts/test-basedirs.sh A tests/integration/scripts/test-multilevel-chain.sh A tests/integration/scripts/test-multilevel.sh

Patch 2 — crate type caching: M src/compiler/rust.rs

Patch 3 — opendal upgrade + Vercel Artifacts backend: M Cargo.lock M Cargo.toml M docs/Configuration.md M src/cache/cache.rs M src/cache/mod.rs A src/cache/vercel_artifacts.rs M src/config.rs M tests/harness/mod.rs

Patch 4 — README + CI/release workflows: A .github/README.md D .github/workflows/benchmarks.yml M .github/workflows/ci.yml M .github/workflows/integration-tests.yml A .github/workflows/vercel-ci.yml A .github/workflows/vercel-release.yml

CI & Releases

  • vercel-ci.yml — Runs cargo test on Ubuntu on every push/PR.
  • vercel-release.yml — Manual trigger (workflow_dispatch). Builds static musl binaries for x86_64 and aarch64 Linux, then creates a GitHub release tagged vercel-YYYYMMDD with the patch stack in the release description.

Agent instructions for rebasing on upstream

When rebasing this fork on the latest upstream main, follow these steps:

  1. Set up the upstream remote (one-time):

    git remote add upstream https://github.com/mozilla/sccache.git
    
  2. Fetch upstream and rebase:

    git fetch upstream
    git rebase upstream/main
    

    This replays each patch commit on top of the latest upstream.

  3. Resolve conflicts patch-by-patch. For each patch that conflicts:

    • Fix the conflict in the affected files
    • git add <files> and git rebase --continue
    • Build and run tests to confirm correctness: cargo build && cargo test
    • If a patch corresponds to an upstream PR that has been merged (e.g., #2581), it will likely produce an empty commit or trivial conflict — drop it with git rebase --skip or remove it during interactive rebase
  4. Update this README: revise the patch list above to reflect any dropped or added patches. Regenerate with git log --oneline upstream/main..HEAD.

  5. Run formatting, lints, build, and tests after all patches are applied:

    cargo fmt --all
    cargo clippy --locked --all-targets -- -D warnings -A unknown-lints -A clippy::type_complexity -A clippy::new-without-default
    cargo build
    cargo test
    
  6. Force-push the rebased branch:

    git push --force-with-lease origin main
    

About

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 95.1%
  • Shell 3.6%
  • Makefile 0.6%
  • C++ 0.4%
  • Nix 0.2%
  • C 0.1%