Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Permit skipping cargo-semver-checks step #2084

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,25 @@ jobs:
export RUSTDOCFLAGS="${{ matrix.toolchain == 'nightly' && '-Z unstable-options --document-hidden-items $METADATA_DOCS_RS_RUSTDOC_ARGS'|| '' }} $RUSTDOCFLAGS"
./cargo.sh +${{ matrix.toolchain }} doc --document-private-items --package ${{ matrix.crate }} ${{ matrix.features }}

# If the commit message contains the line `SKIP_CARGO_SEMVER_CHECKS=1`, then
# skip the cargo-semver-checks step.
- name: Check whether to skip cargo-semver-checks
run: |
set -eo pipefail

if [ "${{ github.event_name }}" == "pull_request" ]; then
# Invoked from a PR - get the PR body directly
MESSAGE="${{ github.event.pull_request.body }}"
else
# Invoked from the merge queue - get the commit message
MESSAGE="$(git log -1 --pretty=%B ${{ github.sha }})"
fi

if echo "$MESSAGE" | grep '^\s*SKIP_CARGO_SEMVER_CHECKS=1\s*$' > /dev/null; then
echo "Found 'SKIP_CARGO_SEMVER_CHECKS=1' in commit message; skipping cargo-semver-checks..." | tee -a $GITHUB_STEP_SUMMARY
echo "ZC_SKIP_CARGO_SEMVER_CHECKS=1" >> $GITHUB_ENV
fi

# Check semver compatibility with the most recently-published version on
# crates.io. We do this in the matrix rather than in its own job so that it
# gets run on different targets. Some of our API is target-specific (e.g.,
Expand Down Expand Up @@ -511,7 +530,8 @@ jobs:
matrix.crate == 'zerocopy' &&
matrix.features == '--features __internal_use_only_features_that_work_on_stable' &&
matrix.toolchain == 'stable' &&
matrix.target != 'wasm32-wasi'
matrix.target != 'wasm32-wasi' &&
env.ZC_SKIP_CARGO_SEMVER_CHECKS != '1'

# TODO(#453): Doing this as a matrix step is a hack that allows us to depend
# on the fact that toolchains have already been installed. We currently only
Expand Down
Loading