Minor bugfixes.

This commit is contained in:
Predrag Gruevski 2022-07-20 19:41:14 -04:00
parent 9167e38cae
commit bf71005d20

View file

@ -11,47 +11,47 @@ inputs:
default: 'v' default: 'v'
runs: runs:
using: "composite" using: "composite"
runs-on: ubuntu-latest
steps: steps:
- name: Install rust - name: Install rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: nightly toolchain: nightly
profile: minimal profile: minimal
- run: | - name: Build rustdoc and check it
# Colorize output, since GitHub Actions terminals support color. run: |
export CARGO_TERM_COLOR=always # Colorize output, since GitHub Actions terminals support color.
export CARGO_TERM_COLOR=always
# Record the current git sha, so we can come back to it after generating the baseline. # Record the current git sha, so we can come back to it after generating the baseline.
export CURRENT_GIT_SHA="$(git rev-parse HEAD)" export CURRENT_GIT_SHA="$(git rev-parse HEAD)"
# Ensure this action's scripts are available to run on the path. # Ensure this action's scripts are available to run on the path.
echo "${{ github.action_path }}" >> $GITHUB_PATH echo "${{ github.action_path }}" >> $GITHUB_PATH
export PACKAGE_NAME="${{ inputs.crate-name }}" export PACKAGE_NAME="${{ inputs.crate-name }}"
if [[ "$PACKAGE_NAME" == '' ]]; then if [[ "$PACKAGE_NAME" == '' ]]; then
export PACKAGE_NAME="$(find_workspace_crates.sh)" export PACKAGE_NAME="$(find_workspace_crates.sh)"
fi fi
export PACKAGE_NAME_WITH_UNDERSCORES="$(echo $"PACKAGE_NAME" | tr '-' '_')" export PACKAGE_NAME_WITH_UNDERSCORES="$(echo $"PACKAGE_NAME" | tr '-' '_')"
# Switch to the tag for the correct baseline version, # Switch to the tag for the correct baseline version,
# then build rustdoc JSON. # then build rustdoc JSON.
# #
# We *do not* want to record and reuse the target directory path # We *do not* want to record and reuse the target directory path
# across different git commits, since it may be at a different location # across different git commits, since it may be at a different location
# in different commits. # in different commits.
git checkout "${{ inputs.version-tag-prefix }}$(find_comparison_version.sh "$PACKAGE_NAME")" git checkout "${{ inputs.version-tag-prefix }}$(find_comparison_version.sh "$PACKAGE_NAME")"
cargo +nightly rustdoc -- -Zunstable-options --output-format json cargo +nightly rustdoc -- -Zunstable-options --output-format json
mv "$(cargo metadata --format-version 1 | jq -r .target_directory)/doc/$PACKAGE_NAME_WITH_UNDERSCORES.json" /tmp/baseline.json mv "$(cargo metadata --format-version 1 | jq -r .target_directory)/doc/$PACKAGE_NAME_WITH_UNDERSCORES.json" /tmp/baseline.json
# Return to the original git sha. # Return to the original git sha.
git checkout "$CURRENT_GIT_SHA" git checkout "$CURRENT_GIT_SHA"
# Build rustdoc JSON for the current version, and move it to /tmp/ # Build rustdoc JSON for the current version, and move it to /tmp/
# so it doesn't get overwritten by the baseline build. # so it doesn't get overwritten by the baseline build.
cargo +nightly rustdoc -- -Zunstable-options --output-format json cargo +nightly rustdoc -- -Zunstable-options --output-format json
mv "$(cargo metadata --format-version 1 | jq -r .target_directory)/doc/$PACKAGE_NAME_WITH_UNDERSCORES.json" /tmp/current.json mv "$(cargo metadata --format-version 1 | jq -r .target_directory)/doc/$PACKAGE_NAME_WITH_UNDERSCORES.json" /tmp/current.json
# Check for semver violations. # Check for semver violations.
cargo install cargo-semver-checks cargo install cargo-semver-checks
cargo semver-checks check-release --current /tmp/current.json --baseline /tmp/baseline.json cargo semver-checks check-release --current /tmp/current.json --baseline /tmp/baseline.json