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 15, 2024
1 parent dc14e25 commit 7e69c96
Show file tree
Hide file tree
Showing 4 changed files with 26 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 @@ -35,7 +35,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 @@ -61,4 +61,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
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ Starting a cluster without running any test is possible with `make up`.
Before sending a pull request, it is a good idea to run `make ci` locally (or `make dockerized-ci` if on macOS).
It will perform a format check, `cargo check`, linter check (clippy), build and `cargo test`.

### 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)\
Expand Down
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 7e69c96

Please sign in to comment.