rust-cache/README.md

38 lines
974 B
Markdown
Raw Normal View History

2020-09-25 22:42:39 +08:00
# Rust Cache Action
2020-10-04 00:10:54 +08:00
A GitHub Action that implements smart caching for rust/cargo projects with
sensible defaults.
2020-09-25 22:42:39 +08:00
## Example usage
```yaml
- uses: Swatinem/rust-cache@v1
```
2020-10-04 00:10:54 +08:00
### Registry Cache
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
- `~/.cargo/registry/index`
- `~/.cargo/registry/cache`
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
This cache is automatically keyed by hashing the `Cargo.lock` / `Cargo.toml`
files. Before persisting, the cache is cleaned of intermediate artifacts and
unneeded dependencies.
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
**TODO**: The `~/.cargo/git/db` database is not yet persisted, support will be
added at a later point.
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
### Target Cache
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
- `./target`
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
This cache is automatically keyed by:
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
- the github `job`,
- the rustc release / host / hash, and
- a hash of the `Cargo.lock` / `Cargo.toml` files.
2020-09-25 22:42:39 +08:00
2020-10-04 00:10:54 +08:00
Before persisting, the cache is cleaned of anything that is not a needed
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.