Skip to content

sccache (Rust / C / C++)

Avrea provides a WebDAV remote storage endpoint for sccache. Compilation outputs are cached so that unchanged source files skip recompilation across jobs and branches.

Avrea pre-configures the WebDAV backend when sccache caching is enabled (cache.sccache.enabled, enabled by default):

Terminal window
SCCACHE_WEBDAV_ENDPOINT="http://cache.avrea.com:8290/sccache-build/webdav"
SCCACHE_WEBDAV_KEY_PREFIX=""

Use Mozilla's sccache action to install sccache, and set RUSTC_WRAPPER: sccache to cache Rust compilations. The action selects the release asset for your runner, verifies its checksum, and reports cache statistics after the job. It preserves Avrea's WebDAV settings.

Pin both the action and sccache versions for a reproducible setup:

workflow.yml
jobs:
build:
runs-on: avrea-ubuntu-latest
env:
RUSTC_WRAPPER: sccache
steps:
- uses: actions/checkout@v7
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.11
with:
version: "v0.18.0"
- run: sccache --start-server
- run: cargo build --release

The action is optional. You can install sccache yourself or keep an existing installation step. Use a binary with WebDAV support for your runner's operating system and architecture, and make sure sccache is on PATH.

For Rust, set RUSTC_WRAPPER: sccache. Keep Avrea's injected SCCACHE_WEBDAV_ENDPOINT and SCCACHE_WEBDAV_KEY_PREFIX variables, and leave the GHA backend disabled as described above. If you need to set the endpoint explicitly on an Avrea runner, use:

env:
RUSTC_WRAPPER: sccache
SCCACHE_WEBDAV_ENDPOINT: "http://cache.avrea.com:8290/sccache-build/webdav"
SCCACHE_WEBDAV_KEY_PREFIX: ""

Set these variables before starting sccache. You can then use the same sccache --start-server and cargo build --release steps shown above, and run sccache --show-stats to inspect the results.

In the Avrea console, open the workflow run and expand Run cache activity, or expand a job and open Job cache activity. Look for sccache build-cache activity: hits, misses, bytes served, and bytes written show requests reaching Avrea's backend. See Cache Stats for details on the counters and coverage states. Missing stats do not necessarily mean the wrong backend is selected.

To inspect the selected backend directly, run sccache --show-stats and check Cache location. It should report webdav, rather than ghac or a local disk cache. The location does not include the endpoint URL; check SCCACHE_WEBDAV_ENDPOINT separately to confirm Avrea's endpoint.

If it reports ghac, check for SCCACHE_GHA_ENABLED and SCCACHE_GHA_VERSION in the workflow, setup actions, and sccache configuration. If it reports a local cache, check that SCCACHE_WEBDAV_ENDPOINT is available to the process and that sccache caching is enabled for the repository or organization.

After changing backend settings in an already running job, stop the existing daemon with sccache --stop-server, then start it again with the updated environment.

Set the compiler wrappers to route compilation through sccache:

env:
CC: sccache gcc
CXX: sccache g++

Or with clang:

env:
CC: sccache clang
CXX: sccache clang++