From 95aa1ab827cfae3fa952d8be605c4a73da09760a Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Thu, 29 Sep 2022 10:34:20 -0400 Subject: [PATCH] Lock the cache to a specific rustc + dependencies Apparently, GitHub doesn't write back to the cache, leading to massive build times a few moments after its initialization (when a change happens invalidating it). While this forces a new cache whenever dependencies change, it'll restore from an older set of dependencies in that case, still minimizing build times. --- .github/actions/cached-rust/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/cached-rust/action.yml b/.github/actions/cached-rust/action.yml index 7149f78f..064f10d8 100644 --- a/.github/actions/cached-rust/action.yml +++ b/.github/actions/cached-rust/action.yml @@ -22,7 +22,8 @@ runs: ~/.cargo/registry ~/.cargo/git ./target - key: ${{ runner.os }}-${{ runner.arch }}-rust-${{ inputs.toolchain }} + key: ${{ runner.os }}-${{ runner.arch }}-rust-${{ steps.install-rust.outputs.rustc_hash }}-${{ hashFiles("**/Cargo.lock") }} + restore-keys: ${{ runner.os }}-${{ runner.arch }}-rust-${{ steps.install-rust.outputs.rustc_hash }}- - name: Install Rust uses: actions-rs/toolchain@v1