Skip to content

Commit

Permalink
CI: Move semver-checking to script and Makefile
Browse files Browse the repository at this point in the history
Currently the invocation of semver-checks is very simple.
That may change soon, for example when mutually-exclusive
features are introduced.

This commit moves semver-checking commands to it's own script,
and adds Makefile targets, so it's easy to call by developer and
doesn't clutter CI files.
  • Loading branch information
Lorak-mmk committed Jan 12, 2024
1 parent 5c296fa commit 70fc2d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/semver_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions scripts/semver-checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -x

cargo semver-checks -p scylla -p scylla-cql $@

0 comments on commit 70fc2d5

Please sign in to comment.