2 releases
0.1.1 | Jan 15, 2022 |
---|---|
0.1.0 | Jan 15, 2022 |
#30 in #reusable
7KB
@rraval's reusable GitHub workflows
Repository for common workflows so I only have to bother getting it right once.
.github/workflows/rust_dev.yml
A comprehensive set of Rust checks intended to catch errors during development:
- Runs the test suite with
cargo test
. - Collects source-based coverage with
grcov
and uploads it to Coveralls. - Reports errors with
cargo check
. - Lints with
clippy
. - Checks formatting with
rustfmt
.
Usage
Add a workflow file to your repository like .github/workflows/dev.yml
with the following contents:
name: Dev
on: [push, pull_request]
jobs:
all:
uses: rraval/workflows/.github/workflows/rust_dev.yml@v1
Demo
See .github/workflows/rust_dev.example.yml for a demo that checks a toy Rust crate from this repository.
- A commit passing all checks
- A pull request that fails most checks
- Coverage for toy example
- Coverage for a real project:
git-nomad
.github/workflows/rust_publish.yml
Publishes the crate to crates.io with cargo publish
.
Usage
Navigate to https://crates.io/settings/tokens and generate a new token specific to your repository.
Follow the GitHub instructions for creating a repository secret and create a secret named CRATES_IO_TOKEN
with the value from https://crates.io/settings/tokens.
Add a workflow file to your repository like .github/workflows/publish.yml
with the following contents:
name: Publish
on:
release:
types: [published]
jobs:
all:
uses: rraval/workflows/.github/workflows/rust_publish.yml@v1
secrets:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
Demo
See .github/workflows/rust_publish.example.yml for a demo that publishes a toy Rust crate from this repository.
.github/workflows/rust_release_binary.yml
Builds Rust binaries (Linux and Mac OS X) and uploads them as artifacts to a GitHub release.
Usage
Add a workflow file to your repository like .github/workflows/release.yml
with the following contents, replacing <NAME-OF-YOUR-CRATE-BINARY>
with the binary to build as specified in the Cargo.toml
(if you're not doing anything fancy, this is usually the same as the Cargo package name).
name: Release
on:
release:
types: [published]
jobs:
main:
uses: rraval/workflows/.github/workflows/rust_release_binary.yml@v1
with:
CARGO_BINARY_NAME: <NAME-OF-YOUR-CRATE-BINARY>
Demo
See .github/workflows/rust_release_binary.example.yml for a demo that builds and uploads 2 binaries for a toy Rust crate from this repository.
- Automatic
cargo build
of release v1.0.0-rc2.