- unit tests should return a
Result
type. Example:#[test] fn is_equal_to_42() -> anyhow::Result<()> { let x = maybe_return_42()?; assert_eq!(x, 42); Ok(()) }
To make a new release, and publish to crates.io, a new tagged commit needs to exist on the main
branch. This is done with a simple merge from the dev
branch. Do not push any other kinds of commits to the main
branch.
Steps:
- bump the version. Will need
cargo-release
crate. Example here bumps the patch version (see cargo semver when deciding which version number to bump).
$ git checkout dev
$ cargo release changes # note any changelog to add to the commit, or manually craft it
$ cargo release version patch --execute # also note to update the readme
$ git add .
$ git commit
$ git push origin dev
- merge
dev
intomain
$ git checkout main
$ git merge --no-ff dev
- tag the merge commit
$ git checkout main
$ cargo release tag --sign-tag --execute
- push with tags
$ git checkout main
$ git push
$ git push --tags