name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
check:
name: Check / Clippy / Test (stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-targets
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test
changelog-sync:
name: CHANGELOG matches Cargo.toml version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Verify CHANGELOG has a section for Cargo.toml version
run: |
VERSION=$(awk -F'"' '/^version *=/ {print $2; exit}' Cargo.toml)
if [ -z "$VERSION" ]; then
echo "::error::could not parse version from Cargo.toml"
exit 1
fi
ESCAPED="${VERSION//./\\.}"
if ! grep -qE "^## \[${ESCAPED}\]" CHANGELOG.md; then
echo "::error::Cargo.toml is at $VERSION but CHANGELOG.md has no '## [$VERSION]' section. Move [Unreleased] content to a dated section before tagging."
exit 1
fi
echo "OK: CHANGELOG.md contains a section for $VERSION"
msrv:
name: MSRV (1.88)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.88.0"
- uses: Swatinem/rust-cache@v2
with:
key: msrv
- run: cargo check --locked --lib --bins