mirror of
https://github.com/Swatinem/rust-cache.git
synced 2024-11-23 14:36:08 +08:00
36 lines
944 B
Markdown
36 lines
944 B
Markdown
# Rust Cache Action
|
|
|
|
A GitHub Action that implements smart caching for rust/cargo projects with
|
|
sensible defaults.
|
|
|
|
## Example usage
|
|
|
|
```yaml
|
|
- uses: Swatinem/rust-cache@v1
|
|
```
|
|
|
|
### Cache Details
|
|
|
|
The cache currently caches the following directories:
|
|
|
|
- `~/.cargo/registry/index`
|
|
- `~/.cargo/registry/cache`
|
|
- `./target`
|
|
|
|
This cache is automatically keyed by:
|
|
|
|
- the github `job`,
|
|
- the rustc release / host / hash, and
|
|
- a hash of the `Cargo.lock` / `Cargo.toml` files.
|
|
|
|
An additional input `key` can be provided if the builtin keys are not sufficient.
|
|
|
|
Before persisting, the cache is cleaned of intermediate artifacts and
|
|
anything that is not a workspace dependency.
|
|
In particular, no caching of workspace crates will be done. For
|
|
this reason, this action will automatically set `CARGO_INCREMENTAL=0` to
|
|
disable incremental compilation.
|
|
|
|
**TODO**: The `~/.cargo/git/db` database is not yet persisted, support will be
|
|
added at a later point.
|