Shipfox
Shipfox Caching

sccache

Cache Rust and C/C++ compilation artifacts with sccache, backed by Shipfox's colocated WebDAV storage

sccache is a compiler caching tool from Mozilla that wraps rustc, gcc, clang, and other compilers. It caches compilation outputs so that unchanged source files are never recompiled, dramatically speeding up incremental builds in Rust and C/C++ projects.

Shipfox provides a built-in WebDAV endpoint for sccache on every runner at $SHIPFOX_SCCACHE_URL. The cache is stored locally in the same data center as your runner, which means uploads and downloads are near-instant compared to remote object storage backends.

How it works

sccache intercepts compiler invocations and computes a hash of the inputs (source file, flags, and dependencies). If a matching entry exists in the cache, it returns the cached output. Otherwise, it compiles normally and stores the result for future runs.

In automatic mode, Shipfox pre-configures sccache's WebDAV backend and installs sccache as the Rust compiler wrapper before your job starts. All cargo build and cargo test invocations benefit from the cache with no changes to your workflow.

Automatic setup

When automatic caching is enabled, Shipfox pre-configures the following environment variables on every runner:

VariableValue
SCCACHE_WEBDAV_ENDPOINTShipfox's WebDAV cache endpoint
RUSTC_WRAPPERsccache

With RUSTC_WRAPPER=sccache set, every cargo invocation automatically routes through sccache. No changes to your workflow are needed.

- name: Build
  run: cargo build --release

- name: Test
  run: cargo test

Automatic caching is enabled by default. You can disable it per tool from your Organization Settings in the Shipfox dashboard if you prefer to manage the configuration yourself.

Manual setup

If you want to control the sccache configuration yourself, use the $SHIPFOX_SCCACHE_URL environment variable exposed on every runner.

Install and configure sccache in your workflow using the sccache-action:

- name: Configure sccache
  run: |
    echo "SCCACHE_WEBDAV_ENDPOINT=$SHIPFOX_SCCACHE_URL" >> "$GITHUB_ENV"
    echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"

- name: Install sccache
  uses: mozilla-actions/sccache-action@v0.0.9

- name: Build
  run: cargo build --release

- name: Test
  run: cargo test

You can also install sccache manually without the action if you prefer:

- name: Configure sccache
  run: |
    echo "SCCACHE_WEBDAV_ENDPOINT=$SHIPFOX_SCCACHE_URL" >> "$GITHUB_ENV"
    echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
    cargo install sccache

- name: Build
  run: cargo build --release

RUSTC_WRAPPER must be set to sccache for Rust compilation to be cached. Without it, sccache is installed but not used.

To inspect cache statistics at the end of a job:

- name: Show sccache stats
  run: sccache --show-stats