Skip to content

Cargo

Avrea caches crates from crates.io so that cargo build and cargo fetch resolve dependencies from colocated cache on repeat runs.

Cargo is pre-configured via ~/.cargo/config.toml:

~/.cargo/config.toml
[registries.cache]
index = "sparse+https://cache.avrea.com:8443/cargo/"
[source.crates-io]
replace-with = "cache"

Your workflow needs no changes:

workflow.yml
jobs:
build:
runs-on: avrea-ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: cargo build --release

Because crates.io is routed through the cache, cargo publish needs the target registry named explicitly:

workflow.yml
- run: cargo publish --registry crates-io

Without it, Cargo stops with crates-io is replaced with remote registry cache. Crates whose package.publish names a single other registry need no change.

Create or append to ~/.cargo/config.toml:

~/.cargo/config.toml
[registries.cache]
index = "sparse+https://cache.avrea.com:8443/cargo/"
[source.crates-io]
replace-with = "cache"