# Cargo

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

## On Avrea runners

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

```toml title="~/.cargo/config.toml"
[registries.cache]
index = "sparse+https://cache.avrea.com:8443/cargo/"

[source.crates-io]
replace-with = "cache"
```

Your workflow needs no changes:

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

## Manual setup

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

```toml title="~/.cargo/config.toml"
[registries.cache]
index = "sparse+https://cache.avrea.com:8443/cargo/"

[source.crates-io]
replace-with = "cache"
```