# Contributing to `fibertools-rs`
Please feel free to open PRs! But first make sure you code passes tests, and please add tests for new features:
```bash
cargo test --all-features
```
Also format your code and check it with clippy before submitting a PR:
```bash
cargo fmt
cargo clippy --workspace
```
## Regression tests
End-to-end regression tests live in `tests/regression/` and compare subcommand
output against committed snapshots using [insta](https://insta.rs/). Each test
runs the `ft` binary against a fixture in `tests/data/`, projects a stable
subset of columns (so trailing/added columns aren't false positives), and
asserts the result matches the snapshot in `tests/regression/snapshots/`.
Run just the regression suite with:
```bash
cargo test --test regression
```
When you intentionally change output, regenerate snapshots with
[`cargo-insta`](https://insta.rs/docs/cli/):
```bash
cargo install cargo-insta # one-time
cargo insta test --review # walk through diffs interactively
# or, if the new output is correct as-is:
cargo insta accept
```
Inspect the resulting `.snap` diff before committing.
## Cutting a release
Releases are automated with
[release-please](https://github.com/googleapis/release-please). You do not bump
versions or create tags by hand.
1. Merge PRs to `main` using [Conventional
Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `perf:`,
`feat!:`/`BREAKING CHANGE:` for majors). Squash-merge is recommended so each
PR is one logical change.
2. release-please keeps a **release PR** open that bumps versions and updates
the changelogs. Which crate is bumped is determined by the file paths a
commit touches: changes under `molecular-annotation/` bump
`molecular-annotation`; changes elsewhere bump `fibertools-rs`.
3. When you are ready to release, merge the release PR. That creates the git
tag(s) and GitHub Release(s).
4. On the `v0.X.Y` tag, `cargo dist` builds the `ft` binaries and installer and
uploads them to the release-please Release. `publish-crates.yml` then
publishes the crates to crates.io via Trusted Publishing.
Changelogs (`CHANGELOG.md` for `fibertools-rs`,
`molecular-annotation/CHANGELOG.md` for the library) are generated by
release-please — do not edit them by hand.
### Re-triggering a failed release
If the `release.yml` (cargo-dist) run fails after the tag exists, fix the issue
(e.g. update `cargo-dist-version` in `dist-workspace.toml`, then run `dist
generate`), commit, and re-run the failed workflow from the Actions tab, or
delete the tag/Release and re-run release-please:
```bash
gh release delete v0.X.Y --yes
git push origin :refs/tags/v0.X.Y
```