rust icon indicating copy to clipboard operation
rust copied to clipboard

adding cargo-semver-checks

Open anonrig opened this issue 1 year ago • 3 comments

@obi1kenobi 's cargo-semver-checks would likely improve our stability. let's use it! https://github.com/obi1kenobi/cargo-semver-checks

anonrig avatar Aug 03 '24 00:08 anonrig

If you might be planning to switch to GitHub-workflow-based publishing, that'd be the easiest place to add cargo-semver-checks today.

It's also possible to use it on PRs, but the workflow there isn't as smooth or ergonomic yet! In that situation, I recommend having it configured as a job that's allowed to fail without breaking CI, so that breaking changes that are merged but not yet released don't break CI.

I'm happy to answer any questions and help you get started!

obi1kenobi avatar Aug 03 '24 01:08 obi1kenobi

I'm more than happy to move to workflow based publishing. Do you have any recommendation/example with semver-checks?

anonrig avatar Aug 03 '24 01:08 anonrig

I use GitHub workflows for publishing in almost all my repos — this setup is probably the most straightforward: https://github.com/obi1kenobi/trustfall-rustdoc-adapter/blob/83ffd07d4230dfc12ac900eae3393a1784b9ffc2/.github/workflows/ci.yml#L91-L163

The basic idea is:

  • When running on the main branch, first lint & test everything; then,
  • check if the version in Cargo.toml is already on crates.io; if not, then
  • run pre-publish checks like cargo-semver-checks
  • run cargo publish

To publish a new version, make a PR that bumps the version in Cargo.toml and Cargo.lock, and merge it. Post-merge, the CI run on the main branch will publish that version.

If you wanted to extend it with extra steps, the cargo-semver-checks repo's release workflow has some additional functionality, like tagging the version, creating a GitHub release, building & attaching binary artifacts to the release, etc.

obi1kenobi avatar Aug 03 '24 03:08 obi1kenobi

Hello, can i work on this ? Thanks

Jayllyz avatar Dec 19 '24 09:12 Jayllyz

Hello, can i work on this ? Thanks

Yes. feel free to open a PR

anonrig avatar Dec 19 '24 12:12 anonrig