Cache cargo registry
All jobs share the same cache key. The contents of this cache is not
rustc version specific.
Because we do not check in a `Cargo.lock` file, dependencies may be
updated at any time. Therefore, each workflow run gets a unique cache
key.
@@ -22,6 +22,16 @@ jobs:
override: true
components: rustfmt, clippy
+ - name: Cache cargo registry and git deps
+ uses: actions/cache@main
+ with:
+ path: |
+ ~/.cargo/registry/cache
+ ~/.cargo/registry/index
+ key: ${{ runner.os }}-cargo-${{ github.run_id }}
+ restore-keys: |
+ ${{ runner.os }}-cargo-
+
- name: cargo fmt
uses: actions-rs/cargo@v1
with:
@@ -50,6 +60,16 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true
+ - name: Cache cargo registry and git deps
+ uses: actions/cache@main
+ with:
+ path: |
+ ~/.cargo/registry/cache
+ ~/.cargo/registry/index
+ key: ${{ runner.os }}-cargo-${{ github.run_id }}
+ restore-keys: |
+ ${{ runner.os }}-cargo-
+
- name: cargo build
uses: actions-rs/cargo@v1
with:
