Skip to content

Commit 959263a

Browse files
authored
117 (#128)
* #117 ci: gate releases on cargo-semver-checks * #117 docs: note semver-checks gate in RELEASE.md
1 parent 50d017c commit 959263a

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,33 @@ jobs:
147147
run: |
148148
RUSTDOCFLAGS="-D warnings" cargo doc --all-features
149149
150+
semver_checks:
151+
name: Semver Checks
152+
runs-on: ubuntu-latest
153+
timeout-minutes: 15
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v6
157+
158+
- name: Setup Rust toolchain
159+
uses: dtolnay/rust-toolchain@master
160+
with:
161+
toolchain: stable
162+
163+
- name: Load cached target directory
164+
uses: Swatinem/rust-cache@v2
165+
with:
166+
key: semver-checks
167+
save-if: ${{ github.ref == 'refs/heads/main' }}
168+
169+
- name: Install cargo-semver-checks
170+
uses: taiki-e/install-action@v2
171+
with:
172+
tool: cargo-semver-checks
173+
174+
- name: Compare public API against the last crates.io release
175+
run: cargo semver-checks check-release --verbose
176+
150177
no_std:
151178
name: no-std
152179
runs-on: ubuntu-latest
@@ -559,7 +586,7 @@ jobs:
559586
ci-success:
560587
name: CI Success
561588
runs-on: ubuntu-latest
562-
needs: [msrv, check, fmt, docs, no_std, security, reuse, test, coverage, benchmarks, wasm-build, lighthouse, changelog, actionlint, release]
589+
needs: [msrv, check, fmt, docs, semver_checks, no_std, security, reuse, test, coverage, benchmarks, wasm-build, lighthouse, changelog, actionlint, release]
563590
if: always()
564591
steps:
565592
- name: Check job status
@@ -570,6 +597,7 @@ jobs:
570597
echo " Check: ${{ needs.check.result }}"
571598
echo " Format: ${{ needs.fmt.result }}"
572599
echo " Docs: ${{ needs.docs.result }}"
600+
echo " Semver Checks: ${{ needs.semver_checks.result }}"
573601
echo " no-std: ${{ needs.no_std.result }}"
574602
echo " Security: ${{ needs.security.result }}"
575603
echo " REUSE: ${{ needs.reuse.result }}"
@@ -582,7 +610,7 @@ jobs:
582610
echo " Actionlint: ${{ needs.actionlint.result }}"
583611
echo " Release: ${{ needs.release.result }}"
584612
585-
if [[ "${{ needs.msrv.result }}" != "success" || "${{ needs.check.result }}" != "success" || "${{ needs.fmt.result }}" != "success" || "${{ needs.docs.result }}" != "success" || "${{ needs.no_std.result }}" != "success" || "${{ needs.security.result }}" != "success" || "${{ needs.reuse.result }}" != "success" || ("${{ needs.test.result }}" != "success" && "${{ needs.test.result }}" != "skipped") || ("${{ needs.coverage.result }}" != "success" && "${{ needs.coverage.result }}" != "skipped") || ("${{ needs.benchmarks.result }}" != "success" && "${{ needs.benchmarks.result }}" != "skipped") || "${{ needs.wasm-build.result }}" != "success" || "${{ needs.lighthouse.result }}" != "success" || ("${{ needs.changelog.result }}" != "success" && "${{ needs.changelog.result }}" != "skipped") || ("${{ needs.release.result }}" != "success" && "${{ needs.release.result }}" != "skipped") || "${{ needs.actionlint.result }}" != "success" ]]; then
613+
if [[ "${{ needs.msrv.result }}" != "success" || "${{ needs.check.result }}" != "success" || "${{ needs.fmt.result }}" != "success" || "${{ needs.docs.result }}" != "success" || "${{ needs.semver_checks.result }}" != "success" || "${{ needs.no_std.result }}" != "success" || "${{ needs.security.result }}" != "success" || "${{ needs.reuse.result }}" != "success" || ("${{ needs.test.result }}" != "success" && "${{ needs.test.result }}" != "skipped") || ("${{ needs.coverage.result }}" != "success" && "${{ needs.coverage.result }}" != "skipped") || ("${{ needs.benchmarks.result }}" != "success" && "${{ needs.benchmarks.result }}" != "skipped") || "${{ needs.wasm-build.result }}" != "success" || "${{ needs.lighthouse.result }}" != "success" || ("${{ needs.changelog.result }}" != "success" && "${{ needs.changelog.result }}" != "skipped") || ("${{ needs.release.result }}" != "success" && "${{ needs.release.result }}" != "skipped") || "${{ needs.actionlint.result }}" != "success" ]]; then
586614
echo "❌ CI failed"
587615
exit 1
588616
fi

‎RELEASE.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ After 1.0 the standard major/minor/patch rules apply.
5151

5252
6. **Open a PR**, wait for `CI Success` to pass.
5353

54-
7. **Rebase-merge to `main`.** That push triggers the `release` job in
54+
The `Semver Checks` job runs `cargo semver-checks check-release`
55+
against the previously-published crates.io version. If your changes
56+
touch the public API in a way that does not match the version bump
57+
in step 3, this job fails — re-decide the version (a wider bump or
58+
smaller change) and make the PR consistent. Update both directions
59+
here, never bypass the gate with `--allow-...` flags.
60+
61+
7. **Squash-merge to `main`.** That push triggers the `release` job in
5562
`.github/workflows/ci.yml`, which:
5663

5764
1. Reads the `version` value from `Cargo.toml`.

0 commit comments

Comments
 (0)