name: "Build & Test"
on:
workflow_call:
defaults:
run:
shell: bash
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: Retrieve MSRV
id: msrv
run: echo "MSRV=$(grep -Po '(?<=rust-version = ")([\d\.]+)' Cargo.toml)" >> "$GITHUB_OUTPUT"
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.MSRV }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
- uses: taiki-e/install-action@v2
with:
tool: cargo-rdme, cargo-nextest
- name: Fmt
run: cargo fmt --check
- name: Clippy & Build
run: cargo clippy --all-targets --all-features --workspace -- -Dwarnings
- name: Test
run: cargo nextest run --all-features --all-targets --workspace
- name: Doc
run: cargo doc --no-deps --all-features
- name: cargo-rdme
run: cargo rdme --check --no-fail-on-warnings