name: CI
on:
push:
branches: [develop]
pull_request:
branches: [main, develop]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt
run: |
cargo fmt --all
git add -A
- name: Auto-format & Vibe Index badge
uses: roxblnfk/action-vibe-index@v1
with:
update-files: README.md
commit: true
push: true
commit-message: "chore: auto-format & update Vibe Index badge [skip ci]"
check:
name: Check + Lint
runs-on: ubuntu-latest
needs: fmt
if: always() && !failure()
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.ref }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: cargo clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: cargo check
run: cargo check --workspace --all-targets
test:
name: Test
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: cargo test
run: cargo test --workspace --all-targets
doc:
name: Docs
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: cargo doc
run: cargo doc --workspace --no-deps
env:
RUSTDOCFLAGS: "-D warnings"