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

adding cargo-semver-checks #72

Open
anonrig opened this issue Aug 3, 2024 · 3 comments
Open

adding cargo-semver-checks #72

anonrig opened this issue Aug 3, 2024 · 3 comments
Labels
good first issue Good for newcomers

Comments

@anonrig
Copy link
Member

anonrig commented Aug 3, 2024

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

@anonrig anonrig added the good first issue Good for newcomers label Aug 3, 2024
@obi1kenobi
Copy link
Collaborator

obi1kenobi commented Aug 3, 2024

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!

@anonrig
Copy link
Member Author

anonrig commented Aug 3, 2024

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

@obi1kenobi
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants