Skip to content

add semver checks to CI#277

Merged
michaelkirk merged 2 commits into
mainfrom
mkirk/semver-checks
Apr 28, 2026
Merged

add semver checks to CI#277
michaelkirk merged 2 commits into
mainfrom
mkirk/semver-checks

Conversation

@michaelkirk
Copy link
Copy Markdown
Member

@michaelkirk michaelkirk commented Apr 24, 2026

  • I agree to follow the project's code of conduct.
  • [n/a] I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

I've been personally hit by a few problems which were the result of other dependencies not following semver:

  • cargo error'ing because it can't unify versions
  • compiler failures due to breaking changes in minor/patch releases

It's worth saying that having semver checks in our libraries won't fix issues with our dependencies avoiding semver, but I figure it's worthwhile implementing ourselves.

For one, it's good to be able to point to a working example of what people can do to improve their situation. As I haven't used these tools historically, this is a learning exercise for me.

Secondly, semver lawyering is complicated and requires a lot of vigalence. If I haven't already run afoul of it, it's probably only a matter of time before I do.

I tend to be a CI minimalist, so this is a bit of an experiment.

The way it will work, is the next time someone opens a PR with breaking changes, they'll be required to bump the version appropriately within their PR before CI will pass. This is different from my historic approach of leaving any "BREAKING" notes along with the CHANGELOG entry, and consulting those notes at release time to determine how to bump the version.

Caveats

  1. It seems like there are some cases that aren't caught by semver-checks1, like changing the return type of an existing method. I haven't looked into why this failure happens. The tool doesn't have to be perfect. We should still review changes with semver breakage in mind, and be ready to manually bump the version when we notice a breaking change.

  2. I'm curious how nicely this will work within a workspace like https://github.com/georust/geo/blob/main/Cargo.toml, which patches local dependencies, e.g. so that the local geo build uses the local geo-types crate, not the published one. I think it'd be fine? In any case, we don't have to adopt this everywhere all at once.

  3. From what I can tell, semver-checks doesn't fail for additive/patch changes, only breaking changes. At publication time, if no "breaking" bump has already occurred, the publisher might need to make a "minor" or "patch" version bump commit before publishing will succeed. As such, it will be important to continue to document "Added" (minor bump) changes in the CHANGELOG.

Footnotes

  1. I did some testing here: https://github.com/michaelkirk/semver_checks_demo/pull/1. In particular, see the "change type" commits which should have failed the semver check.

Not a big deal, but there are some additional details in the org PR
request.

Mostly just trying to consolidate on the default, unless there's a
reason to duplicate/fork.
Historically, we bump the version number just before release. With this
new CI tool, we'd need to switch to the model where the first breaking
change in a release bumps the version.
Copy link
Copy Markdown
Member

@lnicola lnicola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's give it a try!

@michaelkirk michaelkirk added this pull request to the merge queue Apr 28, 2026
Merged via the queue into main with commit 7896e45 Apr 28, 2026
4 checks passed
@michaelkirk michaelkirk deleted the mkirk/semver-checks branch April 28, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants