From 82e38bfa28f4ff0a811d82f4d239ac6dc9e65f78 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 24 Mar 2023 16:08:56 +0100 Subject: [PATCH] ci(semver-checks): avoid stale caches after rustc or tool upgrade With an upgrade to the Rust toolchain, the version of the rustdoc JSON may change. We incorporate the rustc version into the cache key to automatically invalidate the cache in that case. Additionally, we also incorporate the version of the `cargo semver-checks` tool. Related: https://github.com/obi1kenobi/cargo-semver-checks/issues/415. Pull-Request: #3664. --- .github/actions/cargo-semver-checks/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/cargo-semver-checks/action.yml b/.github/actions/cargo-semver-checks/action.yml index 413a67bf..efdc12a2 100644 --- a/.github/actions/cargo-semver-checks/action.yml +++ b/.github/actions/cargo-semver-checks/action.yml @@ -17,10 +17,15 @@ runs: MAX_STABLE_VERSION=$(curl https://crates.io/api/v1/crates/${{ inputs.crate }} --silent | jq '.crate.max_stable_version') echo "version=${MAX_STABLE_VERSION}" >> $GITHUB_OUTPUT + - shell: bash + run: | + rustc --version | tee .rustc-version + cargo semver-checks --version | tee .semver-checks-version + - uses: actions/cache@v3 with: path: ${{ github.workspace }}/target/semver-checks/cache - key: semver-checks-cache-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }} + key: semver-checks-cache-${{ hashFiles('.rustc-version') }}-${{ hashFiles('.semver-checks-version') }}-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }} - run: cargo semver-checks check-release --package ${{ inputs.crate }} --verbose shell: bash