The workflows in this repo all help drive the CI in this organization's Rust repos. There are a few workflows defined here that are reusable in github actions.
All these workflows take common arguments:
manifest_dir
- the directory containing Cargo.toml for the codebase under test.rust_toolchain
- the name of the rust toolchain you'd use incargo +toolchain_name test
; defaults to"stable"
. (The only workflow that doesn't accept this input isci_baseline_rust_coverage.yml
, due to unstable cli options for testing doctests. It's set to"nightly"
.)apt_install_packages
-ubuntu-latest
packages to install before running any cargo builds. These are cached and should restore quickly, but can't depend on pre/postinstall scripts.
This workflow runs cargo nextest run
with customizable settings:
cargo_test_args
- additional arguments passed tocargo test
, e.g. for feature selection.
Example github workflow job:
jobs:
rust_tests:
uses: "boinkor-net/ci-baseline-rust/.github/workflows/ci_baseline_rust_tests.yml@main"
strategy:
matrix:
rust_toolchain: [nightly, stable]
cargo_args:
- "--no-default-features --features no_std"
- "--no-default-features --features 'jitter no_std'"
- "--no-default-features --features std"
- ""
with:
rust_toolchain: ${{matrix.rust_toolchain}}
cargo_test_args: ${{matrix.cargo_test_args}}
This workflow runs some common linter checks on a repo:
cargo fmt
- to see if the code formatting is reasonable.cargo clippy
- checks if the code follows extra coding guidelines. Options:cargo_clippy_args
(default"-- -D warnings"
) - commandline arguments passed to clippy.
cargo deny
- checks licenses and vulnerable dependencies; this check is skipped if nodeny.toml
exists on the repo root.
Example job:
jobs:
rust_lints:
uses: "boinkor-net/ci-baseline-rust/.github/workflows/ci_baseline_rust_lints.yml@main"
This workflow runs tests (unit, integration and doctests) and gathers all their coverage information and uploads it to https://codecov.io. Since gathering doctest coverage requires nightly, this is nightly-only at the moment.
It requires secrets:
CODECOV_TOKEN
- the token issued by codecov.io for your repo
And comes with customization options:
cargo_test_args
- any additional args to pass to cargo (e.g., for feature selection).
Example job:
jobs:
code_coverage:
uses: boinkor-net/ci-baseline-rust/.github/workflows/ci_baseline_rust_coverage.yml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}