Photo by Marian Kroell on Unsplash
I've just finished creating a GitHub template that you can use to set up a new Rust project that GitHub Actions for Rust as a CI pipeline.
What this means, is that your project from day one will always perform the following cargo commands against any code changes (PRs, pushes, etc):
-
check
- Check a local package and all of its dependencies for errors -
test
- Execute all unit and integration tests and build examples of a local package -
fmt
- This utility formats all bin and lib files of the current crate using rustfmt -
clippy
- Checks a package to catch common mistakes and improve your Rust code
Here's how to use it
- go to my template: https://github.com/booyaa/gh-actions-template-rust
- click on the "Use this template" button
- fill out the project details using the new project wizard
- clone your new project
- cd to your project
- initialise the project using
cargo init --vcs none
or copy files from your existing Rust project - commit and push your changes up to GitHub
- sit back and relax as GitHub Actions will now perform checks against any code changes submitted to your new Rust project
If you're wondering why I don't include any Rust scaffolding, it's because cargo
already does a great job of providing this. I didn't want to perform updates as changes occur to the new project process owned by cargo
.
As an added bonus you also get Rust's dual license of MIT and Apache v2!
I'd love to know what you think of this template. :)