Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI job to run cargo-semver-checks #1202

Merged
merged 9 commits into from
Jan 16, 2024
Merged

Add CI job to run cargo-semver-checks #1202

merged 9 commits into from
Jan 16, 2024

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Jan 8, 2024

What

Add CI job to run cargo-semver-checks

Why

To monitor whether the changes being made to the soroban-sdk and its exports are a match for the version being targeted.

Close #1195

@leighmcculloch leighmcculloch requested a review from graydon January 8, 2024 02:34
@leighmcculloch leighmcculloch marked this pull request as ready for review January 11, 2024 13:21
@leighmcculloch
Copy link
Member Author

leighmcculloch commented Jan 11, 2024

The semver check tooling is not going to detect breaking changes to types in the env packages that are reexported unfortunately. I tried a few different test cases, things like removing a trait impl such as the Default impl on Val, which doesn't appear to be used by anything but is visible in the soroban-sdk docs on the Val type, so should be considered part of the public API. And nothing in the env repo exported seems to get detected.

This is due to limitations in rustdoc and cargo-semver-checks. See these issues for more details:

I'm still going ahead with this change because some API checking is better than none.

I've also opened an issue on the env repo so that we track breaking changes there too since they are exported out of soroban-sdk:

github-merge-queue bot pushed a commit to stellar/rs-soroban-env that referenced this pull request Jan 16, 2024
### What
Add CI job to run cargo-semver-checks that will error if we make a
breaking change to a patch or minor release.

### Why
To monitor whether the changes being made to the soroban-sdk and its
exports are a match for the version being targeted. The
soroban-env-common and some of the guest and host crates are reexported
by the soroban-sdk and essentially part of its API.

Due to issues outlined in the comment below these checks cannot all be
done on the soroban-sdk:
-
stellar/rs-soroban-sdk#1202 (comment)

Also, independent of the above not breaking semver rules is relatively
important in the Rust ecosystem because cargo favors selecting newer
(maximum) instead of older (minimum) versions. While lock files exist,
they aren't respected by default in some contexts like `cargo install`
meaning introducing breaking changes into a crate can break downstream
tools. (We avoid this on the products we publish by pinning exact
versions of the env, but that is not common practice in the Rust
ecosystem.)

Close stellar/rs-soroban-sdk#1195

---------

Co-authored-by: Graydon Hoare <graydon@pobox.com>
@leighmcculloch leighmcculloch added this pull request to the merge queue Jan 16, 2024
Merged via the queue into main with commit 25750fb Jan 16, 2024
21 checks passed
@leighmcculloch leighmcculloch deleted the i1195 branch January 16, 2024 19:54
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.

Add semver API checks to CI / release process
2 participants