Skip to content

Commit

Permalink
Auto merge of #11592 - jofas:11513-fix, r=weihanglo
Browse files Browse the repository at this point in the history
Corrected documentation of how to cache binaries installed with `cargo install` in CI workflows

Fix for #11513. Updated the cargo book documentation on how to cache the `$CARGO_HOME` directory in CI workflows (added that the `.crates.toml` and `.crates2.json` files must be cached alongside the `/bin` folder, if installed binaries are cached)
  • Loading branch information
bors committed Jan 18, 2023
2 parents a5d47a7 + 37f0510 commit fc2242a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/doc/src/guide/cargo-home.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ However, caching the entire directory is often inefficient as it will contain do
If we depend on a crate such as `serde 1.0.92` and cache the entire `$CARGO_HOME` we would actually cache the sources twice, the `serde-1.0.92.crate` inside `registry/cache` and the extracted `.rs` files of serde inside `registry/src`.
That can unnecessarily slow down the build as downloading, extracting, recompressing and reuploading the cache to the CI servers can take some time.

It should be sufficient to only cache the following directories across builds:
If you wish to cache binaries installed with [`cargo install`], you need to cache the `bin/` folder and the `.crates.toml` and `.crates2.json` files.

It should be sufficient to cache the following files and directories across builds:

* `.crates.toml`
* `.crates2.json`
* `bin/`
* `registry/index/`
* `registry/cache/`
Expand Down

0 comments on commit fc2242a

Please sign in to comment.