|
1 | 1 | #!/usr/bin/env bash |
2 | 2 | # |
3 | 3 | # Pull request check. For each release crate whose version changed relative |
4 | | -# to the base commit, confirm the bump is consistent (check-invariants) and |
5 | | -# the crate still publishes (cargo publish --dry-run). No-ops when no release |
6 | | -# version changed. A sibling release crate not yet on crates.io is skipped, |
7 | | -# not failed, since a PR may bump two crates at once. |
| 4 | +# to the base commit, confirm the bump is consistent (check-invariants), the |
| 5 | +# crate still publishes (cargo publish --dry-run), and the bump is large |
| 6 | +# enough for the API changes since the base version (cargo semver-checks). |
| 7 | +# No-ops when no release version changed. A sibling release crate not yet on |
| 8 | +# crates.io is skipped, not failed, since a PR may bump two crates at once. |
8 | 9 | set -euo pipefail |
9 | 10 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
10 | 11 | # shellcheck source=contrib/release/crates.sh |
@@ -56,3 +57,23 @@ for crate in "${changed[@]}"; do |
56 | 57 | cargo publish --dry-run --locked -q -p "$crate" |
57 | 58 | echo "$crate packages and publishes cleanly" |
58 | 59 | done |
| 60 | + |
| 61 | +# Semver only binds between stable releases: any comparison involving a |
| 62 | +# pre-release is classified as a major bump, which permits everything, so |
| 63 | +# running the tool there proves nothing. Only payjoin is checked for now; |
| 64 | +# payjoin-cli has no library API and payjoin-mailroom's is not yet stable. |
| 65 | +for crate in "${changed[@]}"; do |
| 66 | + [ "$crate" = "payjoin" ] || continue |
| 67 | + new_version="$(manifest_version "$crate")" |
| 68 | + baseline="$(version_at "$base" "$crate")" |
| 69 | + if is_prerelease "$new_version" || is_prerelease "$baseline"; then |
| 70 | + echo "Skipping $crate semver check for pre-release ($baseline -> $new_version)" |
| 71 | + continue |
| 72 | + fi |
| 73 | + if ! crate_published "$crate" "$baseline"; then |
| 74 | + echo "Skipping $crate semver check; baseline $baseline not on crates.io" |
| 75 | + continue |
| 76 | + fi |
| 77 | + echo "Checking $crate $new_version API against $baseline" |
| 78 | + cargo semver-checks --package "$crate" --baseline-version "$baseline" |
| 79 | +done |
0 commit comments