name: ci
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: clippy
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-targets --all-features
audit:
name: cargo-audit
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- uses: actions/checkout@v7
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
test:
name: test
runs-on: ubuntu-latest
if: github.event.pull_request.draft != true
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Configure git identity (integration tests need it)
run: |
git config --global user.email "ci@example.com"
git config --global user.name "CI"
- run: cargo build --verbose
- run: cargo test --verbose