Skip to content
Rust build cache

Build Rust with crates you’ve already compiled.

Give a fresh build access to downloaded dependencies, reusable Cargo target state, and sccache results. Cargo still decides what must be rebuilt.

.boringcache.toml
workspace = "my-org/app"

[adapters.cargo]
tag = "cargo-cache"
command = ["cargo", "build", "--release"]

[adapters.sccache]
tag = "rust-compiler"
boringcache cargo
permissions:
  contents: read
  id-token: write

steps:
  - uses: boringcache/one@f0fb9b2d926a32b10c543e92093ba00c5a291b79 # v1.33.0
    with:
      mode: cargo
      trust-policy: auto
  - run: cargo build --release
steps:
  - label: Build
    command: >
      boringcache ci run
      --oidc-provider buildkite
      -- boringcache cargo
build:
  timeout: 1h
  id_tokens:
    BORINGCACHE_OIDC_TOKEN:
      aud: urn:boringcache:workload
  script:
    - boringcache ci run --oidc-provider gitlab -- boringcache cargo

What your build can reuse.

Dependency downloads

Restore crates and Git dependencies before the build needs them.

Cargo target state

Bring back compatible outputs so Cargo can avoid repeating work.

sccache results

Reuse eligible compiler results when compilation is still needed.

Target reuse and compiler caching avoid different work.

A target-state hit can avoid invoking the compiler. sccache can help when the compiler still runs. Use both, or choose target reuse alone with compiler-cache = "none".

See Cargo and compiler-cache activity together.

Inspect restored build data, compiler-cache reads, and uploads in the same run.

Explore the workspace →
Workspace insights

Deno build cache

GitHub Actionsmain48b6eee

Open run

Shared cache reuse

0 cache errors

96.9%

1,837 of 1,896 remote read lookups were hits.

Remote hits
1,837
Missed lookups
59

Cache data transferred

Restored
4.68 GB
Uploaded
304 MB
  • sccache 1.2 GB restored · 84.2 MB uploaded
  • Archive 3.48 GB restored · 219 MB uploaded

Cache activity by tool

  • sccache 1,834 hits · 59 misses
  • Archive 3 hits · 0 misses

95.8%

Compiler results reused

Deno · Cargo + sccache

Keep shared-cache publication in trusted jobs.

Give consumers restore access and publishers a separate permission. Connect supported CI through OIDC or use scoped credentials.

Connect your CI →

Separate readers and publishers

  • Trusted builds Publish shared cache for the next build Read + publish
  • Pull requests Restore cache without replacing it Read only
  • Local development Use a scoped credential for the workspace Scoped access

Before you connect.

Does BoringCache replace cargo or rustc?
No. Cargo still resolves dependencies and drives the build. BoringCache restores target state and provisions sccache around the command you already run.
How is this different from archiving ~/.cargo and target/?
The adapter preserves source freshness across restores and adds compiler reuse through sccache. Matching data is stored once across your workspace. Cargo still decides which crates need rebuilding.
Can I use target caching without sccache?
Yes. Set compiler-cache = "none" in the adapter config to keep target-state reuse alone.
Do local builds benefit too?
Yes. The same workspace serves CI and a local shell, so a laptop can start from the crates CI already compiled.
Read the Cargo setup guide →

Start with your next Cargo build.

Install the CLI. Run onboarding to connect your repository and configure your cache.

30 GB of cache free. No credit card required.

curl -sSL https://install.boringcache.com/install.sh | sh
boringcache onboard
boringcache cargo