name: CI
on:
push:
branches:
- "main"
paths:
- ".github/workflows/ci.yaml"
- "Cargo.toml"
- "Cargo.lock"
- "src/**"
- "tests/**"
pull_request: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Lint (rustfmt)
run: cargo fmt --all --check
- name: Lint (clippy)
run: cargo clippy --all-targets --all-features -- -D warnings
msrv:
name: MSRV (1.85)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.85"
- uses: Swatinem/rust-cache@v2
- run: cargo build --all-features --locked
build:
name: Build and test
strategy:
fail-fast: false
matrix:
rust-version:
- stable
- beta
runner:
- "ubuntu-24.04"
- "ubuntu-24.04-arm"
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-version }}
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@nextest
- name: Run all tests
run: cargo nextest run --all-features
- name: Run doctests
run: cargo test --doc --all-features
dependabot:
needs: [lint, msrv, build]
runs-on: ubuntu-24.04
permissions:
pull-requests: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
steps:
- id: metadata
uses: dependabot/fetch-metadata@v3
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: gh pr comment "$PR_URL" --body "@dependabot merge"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}