Skip to content

Commit

Permalink
ci(semver-checks): avoid stale caches after rustc or tool upgrade
Browse files Browse the repository at this point in the history
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: obi1kenobi/cargo-semver-checks#415.

Pull-Request: #3664.
  • Loading branch information
thomaseizinger committed Mar 24, 2023
1 parent 7e9581c commit 82e38bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/actions/cargo-semver-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82e38bf

Please sign in to comment.