diff --git a/.github/workflows/semver_checks.yml b/.github/workflows/semver_checks.yml index ee1022268e..022dbbdcdc 100644 --- a/.github/workflows/semver_checks.yml +++ b/.github/workflows/semver_checks.yml @@ -48,7 +48,7 @@ jobs: id: semver-pr-check run: | set +e - cargo semver-checks -p scylla -p scylla-cql --baseline-rev "$PR_BASE" + make semver-rev rev="$PR_BASE" exitcode=$? echo "exitcode=$exitcode" >> $GITHUB_OUTPUT exit "$exitcode" @@ -84,4 +84,4 @@ jobs: - name: Install semver-checks run: cargo install cargo-semver-checks --no-default-features - name: Verify that's it's safe to publish the version. - run: cargo semver-checks -p scylla -p scylla-cql + run: make semver-version diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec4c7c6bed..20fd9d10a1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,6 +86,16 @@ There are a few scenarios: using command like `cargo update -p toml_datetime --precise 0.6.3` and go back to step 3. 5. Rename `Cargo.lock` to `Cargo.lock.msrv`. +### Semver checking + +Our CI runs cargo semver-checks and labels PRs that introduce breaking changes. +If you don't intend to change public API, you can perform the checks locally, +using command `make semver-rev`. Make sure you have semver-checks installed first, +you can install it using `cargo install cargo-semver-checks`. + +`make semver-rev` will check for API breaking changes using `main` branch as baseline. +To use different branch / commit call `make semver-rev rev=BRANCH`. + ## Contributing to the book The documentation book is written using [mdbook](https://github.com/rust-lang/mdBook)\ diff --git a/Makefile b/Makefile index e09ee6bc60..91d4485bf9 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,14 @@ build: docs: mdbook build docs +.PHONY: semver-rev +semver-rev: + ./scripts/semver-checks.sh $(if $(rev),--baseline-rev $(rev),--baseline-rev main) + +.PHONY: semver-version +semver-version: + ./scripts/semver-checks.sh $(if $(version),--baseline-version $(version),) + .PHONY: up up: $(COMPOSE) up -d --wait diff --git a/scripts/semver-checks.sh b/scripts/semver-checks.sh new file mode 100755 index 0000000000..43badbfc25 --- /dev/null +++ b/scripts/semver-checks.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -x + +cargo semver-checks -p scylla -p scylla-cql $@ \ No newline at end of file