1 unstable release
0.1.0 | Feb 15, 2025 |
---|
#22 in #offers
126 downloads per month
3KB
GitHub Actions Workflows for Rust
This repository contains some copy-pastable GitHub Actions Workflows suited for Rust projects.
When it comes to CI workflows, there is no one size fits all solution. This repository rather aims to offer few sizes fit many solutions.
Example Workflows
Minimal CI
The minimal-ci
workflow offers a simple CI workflow using minimal third-party tools.
The only third-party action it uses is Swatinem/rust-cache
. This is a no-brainer, and as the author, I am allowed to be biased :-)
Otherwise, it relies only on standard Rust tooling available as rustup
components.
It contains the following CI jobs:
- A lint job running
rustfmt
andclippy
. - A documentation job running doctests and checking some rustdoc lints.
- A test job running across Linux and Windows covering all non-doc targets.
Complete CI
The complete-ci
workflow has a more complete solution pulling in a bunch more tools.
- The lint job is additionally using
cargo-semver-checks
to lint for SemVer violations. - The test job is using
nextest
as the test runner andcargo-llvm-cov
to collect code coverage. - Both test results and code coverage results are pushed to
codecov
. - There is an additional benchmark job that uploads results to
codspeed
. - Last but not least, it has a miri job, running the testsuite (excluding benchmarks) through
miri
.
Missing Features
The example workflows above are quite bare-bones thus far. Either intentionally (the minimal-ci
workflow is supposed to be minimal), or because a lot of checks are just not hooked up (yet).
Here are some ideas of things that could (or really should) be checked within CI, to maintain a high code/crate quality.
Feature Combinations
I would love to add cargo-hack --feature-powerset
to this mix at some point to check every combination of features.
However, lack of mutually exclusive features makes this less than ideal right now.
The current workflows are running with --all-features
, which also does not satisfy one size fits all for crates that have mutually exclusive features.
MSRV / Minimal Versions
It would also be nice to have a job that verifies everything running well with the advertised minimum supported rust version (MSRV).
Similarly, hooking up cargo-minimal-versions
would be nice to verify that the crate builds with the advertised dependency versions, and does not use any features introduced in higher versions (necessitating a bump within Cargo.toml
).
Regular Maintenance Workflow
I started working on Swatinem/rust-maintain
which is supposed to be a workflow that runs cargo update
regularly, and applies auto-fixed from clippy
.
This does not currently work fully as intended yet however.
Apart from bumping crate dependencies, it would also be nice if that workflow could bump the Rust toolchain version, and possibly do edition updates as well.
Publish Workflow
Another thing currently missing is a workflow that publishes new crate versions, possibly using Trusted Publishing.
Dependency Audit
The lint job could also potentially be extended using a dependency audit step, using cargo-deny
or a similar tool.
Contribution
I would love to extend this collection of few sizes fit many workflows. Feel free to open a PR to add other variants of workflows solving different use-cases. Or tackle some of the missing features mentioned above.