diff --git a/.github/workflows/semver_checks.yml b/.github/workflows/semver_checks.yml index 6a39d29b47..d5a870e38a 100644 --- a/.github/workflows/semver_checks.yml +++ b/.github/workflows/semver_checks.yml @@ -33,7 +33,7 @@ jobs: run: cargo install cargo-semver-checks --no-default-features - name: Verify the API compatibilty with PR base id: semver-pr-check - run: cargo semver-checks -p scylla -p scylla-cql --baseline-rev "$PR_BASE" + run: make semver-rev rev="$PR_BASE" continue-on-error: true - name: Remove breaking label on success run: gh pr edit "$PR_ID" --remove-label semver-checks-breaking @@ -59,4 +59,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 174c11cb8b..ae55a5bb3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,3 +100,13 @@ cargo build --examples mdbook test -L target/debug/deps/ docs ``` + +## 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`. 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