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 24, 2024
1 parent 7e92cc2 commit ee643d8
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 @@ -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"
Expand Down Expand Up @@ -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
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)\
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 ee643d8

Please sign in to comment.