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.

The storage endpoint is pre-configured:

Terminal window
SCCACHE_WEBDAV_ENDPOINT="http://avrea-host:8290/sccache-build/webdav"
SCCACHE_WEBDAV_KEY_PREFIX=""

You need to install sccache, set RUSTC_WRAPPER, and start the daemon in your workflow:

workflow.yml
jobs:
build:
runs-on: avrea-ubuntu-latest
env:
RUSTC_WRAPPER: sccache
steps:
- uses: actions/checkout@v6
- name: Install sccache
run: |
SCCACHE_VERSION="v0.10.0"
curl -fsSL "https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
| tar xz --strip-components=1 -C /usr/local/bin/ "sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache"
- run: sccache --start-server
- run: cargo build --release
- run: sccache --show-stats
env:
RUSTC_WRAPPER: sccache
SCCACHE_WEBDAV_ENDPOINT: "http://avrea-host:8290/sccache-build/webdav"
SCCACHE_WEBDAV_KEY_PREFIX: ""
steps:
- uses: actions/checkout@v6
- name: Install sccache
run: |
SCCACHE_VERSION="v0.10.0"
curl -fsSL "https://github.com/mozilla/sccache/releases/download/${SCCACHE_VERSION}/sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz" \
| tar xz --strip-components=1 -C /usr/local/bin/ "sccache-${SCCACHE_VERSION}-x86_64-unknown-linux-musl/sccache"
- run: sccache --start-server
- run: cargo build --release
- run: sccache --show-stats

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++