1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
name: CI
on:
push:
# Avoid duplicate builds on PRs.
branches:
- main
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Update Rust toolchain
# Most of the time this will be a no-op, since GitHub releases new images every week
# which include the latest stable release of Rust, Rustup, Clippy and rustfmt.
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2.8.1
- name: Clippy
# Using --all-targets so tests are checked and --deny to fail on warnings.
# Not using --locked here and below since Cargo.lock is in .gitignore.
run: cargo clippy --all-targets --all-features -- --deny warnings
- name: rustfmt
run: cargo fmt -- --check
- name: Check docs
# Using RUSTDOCFLAGS until `cargo doc --check` is stabilised:
# https://github.com/rust-lang/cargo/issues/10025
run: RUSTDOCFLAGS="-D warnings" cargo doc --all-features --document-private-items --no-deps
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2.8.1
- name: Run unit tests
run: cargo test --all-features
readme-updated:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Update Rust toolchain
run: rustup update
- name: Rust Cache
uses: Swatinem/rust-cache@v2.8.1
- name: Install cargo readme
run: cargo install cargo-rdme
- name: Check if README.md is up-to-date (see README.md for updating instructions)
run: cargo rdme --check
|