Skip to content

Commit fc2242a

Browse files
committed
Auto merge of #11592 - jofas:11513-fix, r=weihanglo
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)
2 parents a5d47a7 + 37f0510 commit fc2242a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/doc/src/guide/cargo-home.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ However, caching the entire directory is often inefficient as it will contain do
5858
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`.
5959
That can unnecessarily slow down the build as downloading, extracting, recompressing and reuploading the cache to the CI servers can take some time.
6060

61-
It should be sufficient to only cache the following directories across builds:
61+
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.
6262

63+
It should be sufficient to cache the following files and directories across builds:
64+
65+
* `.crates.toml`
66+
* `.crates2.json`
6367
* `bin/`
6468
* `registry/index/`
6569
* `registry/cache/`

0 commit comments

Comments
 (0)