From 69591259b8ace8a4319234a091da71448469b2a5 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Wed, 20 Nov 2024 10:16:06 -0800 Subject: [PATCH] [ci] Permit skipping cargo-semver-checks step This is triggered when the most recent commit in a PR has a commit message which contains the string `SKIP_CARGO_SEMVER_CHECKS=1` on its own line. SKIP_CARGO_SEMVER_CHECKS=1 Closes #2083 gherrit-pr-id: Iffcecec3b7abfd48a67011d5979aa075b68da0ba --- .github/workflows/ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c6a033897..df8aabdeff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -482,6 +482,20 @@ 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 + + COMMIT_ID="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}" + + git log -3 $COMMIT_ID | tee -a $GITHUB_STEP_SUMMARY + if git log -1 --pretty=%B $COMMIT_ID | grep '^SKIP_CARGO_SEMVER_CHECKS=1$' > /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., @@ -511,7 +525,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