-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): cache registry baseline rustdoc JSON
The latest release (v0.18) of `cargo semver-checks` includes a [feature](obi1kenobi/cargo-semver-checks#339) where the rustdoc JSON files for registry baselines is cached in `target/semver-checks/cache`. The rustdoc JSON files for released crates never changes as the source code on crates.io cannot be changed once a version is published. Thus, it is unnecessary to generate that JSON on every CI run. We extract a separate action that installs `cargo semver-checks` for us and also sets up a cache. The cache is scoped to released version of the crate, meaning it automatically invalidates once we publish a new version. This speeds up the `cargo semver-checks` step by 50% which is ~ 1 minute per job. Pull-Request: #3469.
- Loading branch information
1 parent
c1bb234
commit 7f5b40a
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "Run cargo semver-checks" | ||
description: "Install and run the cargo semver-checks tool" | ||
inputs: | ||
crate: | ||
required: true | ||
description: "The crate to run `cargo semver-checks` on." | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.18.3/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin | ||
shell: bash | ||
|
||
- name: Get released version | ||
shell: bash | ||
id: get-released-version | ||
run: | | ||
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 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/target/semver-checks/cache | ||
key: semver-checks-cache-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }} | ||
|
||
- run: cargo semver-checks check-release --package ${{ inputs.crate }} --verbose | ||
shell: bash | ||
env: | ||
CARGO_TERM_VERBOSE: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters