# Swatinem/rust-cache

> A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.

Source: https://talira.ai/catalog/swatinem-rust-cache-y6eve8ad
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Plugin
- Categories: [developer tools / ci / caching](https://talira.ai/categories/developer-tools/ci/caching), [languages / rust](https://talira.ai/categories/languages/rust)
- Platforms: linux, macos, windows
- Licence: LGPL-3.0
- Pricing: Free and open source
- Free tier: yes
- Self-hostable: yes
- Creator: Arpad Borsos (Swatinem)

rust-cache is a GitHub Action that caches Cargo's registry, git dependencies and target directory between workflow runs, keyed on the rustc version, lockfiles and job. It prunes the cache to keep useful dependency artifacts and offers shared keys, prefix keys and workspace settings.

## Links

- GitHub: https://github.com/Swatinem/rust-cache

## Problems it solves

- my GitHub Actions Rust job recompiles every crate on every push
- actions/cache for cargo keeps missing or uploading huge caches
- what should I cache in CI for a Rust project and what key should I use
- Rust CI takes 10 minutes and most of it is building dependencies
- share a cargo cache between several jobs in one workflow
- the target folder cache in CI keeps growing until it's useless
- invalidate the CI cache automatically when the toolchain changes
- speed up clippy and test jobs on GitHub Actions

## Features

- caches registry, git deps and target dir
- automatic cache keys from rustc version and lockfiles
- shared-key and prefix-key
- cache pruning

## Trust

Overall: 0.51 out of 1.
Signals: maintenance 0.68, adoption 0.66, momentum 0.43, community 0.70, backing 0.20, extensibility 0.00.

- last commit 9 days ago
- 12 commits in the last 90 days
- latest release v2.9.3 34 days ago
- 2.0k GitHub stars
- 54 contributors
- accepts sponsorship (Github)
- created by Arpad Borsos (Swatinem)

## Alternatives

- [Mr Boxington (mbx)](https://talira.ai/catalog/mr-boxington-mbx-5hc8kes0.md): A shared cache for Cargo builds
- [actions/cache](https://talira.ai/catalog/actions-cache-znrtg810.md): Cache dependencies and build outputs in GitHub Actions
- [sccache](https://talira.ai/catalog/sccache-3e1w9xr3.md): Shared compilation cache for C, C++, Rust and CUDA, stored locally or in the cloud
- [Kache](https://talira.ai/catalog/kache-j5q2h9jj.md): Build once. Reuse the work.
- [Blacksmith](https://talira.ai/catalog/blacksmith-hhbhky6x.md): Faster, cheaper hosted runners for GitHub Actions
- [WarpBuild](https://talira.ai/catalog/warpbuild-2241xsag.md): High-performance GitHub Actions runners: 2x faster, 50% cheaper
