name: CI
on:
push:
branches: [main]
pull_request:
workflow_call:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
check:
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --check
- name: Clippy, every feature
run: cargo clippy --all-features --all-targets --locked
- name: Clippy, no features
run: cargo clippy --no-default-features --all-targets --locked
- name: Test, every feature
run: cargo test --all-features --locked
- name: Test, no features
run: cargo test --no-default-features --locked
docs:
name: Docs, pictures, changelog and package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: API docs
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --all-features --no-deps --locked
- name: Pictures are current
run: |
cargo test --all-features --locked --test docs_pictures -- --ignored
git diff --exit-code -- docs/images || {
echo "::error::docs/images is out of date: run cargo test --all-features --test docs_pictures -- --ignored and commit the pictures"
exit 1
}
test -z "$(git ls-files --others --exclude-standard docs/images)" || {
echo "::error::new pictures in docs/images aren't committed"
exit 1
}
- name: Changelog
shell: pwsh
run: ./templates/release-notes.ps1 -Check -Changelog CHANGELOG.md
- name: Package
run: cargo publish --dry-run --locked
audit:
name: Security advisories
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: taiki-e/install-action@v2
with:
tool: cargo-audit
- name: Audit
run: cargo audit