Skip to content

Commit

Permalink
Add CI job to run cargo-semver-checks (#1323)
Browse files Browse the repository at this point in the history
### 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>
  • Loading branch information
leighmcculloch and graydon authored Jan 16, 2024
1 parent 36d33cb commit e6cc730
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# temporarily disabling publish-dry-run, it appears to be broken with recent
# changes to dependency specifications?
# needs: [fmt, cackle, cargo-deny, check-git-rev-deps, build-and-test, publish-dry-run]
needs: [fmt, cackle, cargo-deny, check-git-rev-deps, build-and-test]
needs: [fmt, cackle, cargo-deny, check-git-rev-deps, semver-checks, build-and-test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
Expand Down Expand Up @@ -63,6 +63,17 @@ jobs:
- name: Check if rust-analyzer encounters any errors parsing project
run: rust-analyzer analysis-stats . 2>&1 | (! grep ERROR)

semver-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- uses: stellar/binaries@v18
with:
name: cargo-semver-checks
version: 0.27.0
- run: cargo semver-checks

build-and-test:
strategy:
matrix:
Expand Down
3 changes: 3 additions & 0 deletions soroban-simulation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ readme = "../README.md"
edition = "2021"
rust-version.workspace = true

# Temporary until we publish, to satisfy cargo-semver-checks
publish = false

[dependencies]
# To be removed
anyhow = { version = "1.0.75", features = [] }
Expand Down

0 comments on commit e6cc730

Please sign in to comment.