name: CI/CD Pipeline
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
test-and-lint:
name: Test, Lint & Doc Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.91.1
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format Check
run: cargo fmt --all -- --check
- name: Clippy Lint
run: cargo clippy -- -D warnings -W clippy::missing_docs_in_private_items
- name: Unit & Integration Tests
run: cargo test --all-features --verbose
- name: Doc Test Execution
run: cargo test --doc --quiet
- name: Strict rustdoc Generation
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
benchmark-verify:
name: Benchmark Compilation & Quick Run
runs-on: ubuntu-latest
needs: test-and-lint
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.91.1
- uses: Swatinem/rust-cache@v2
- name: Compile Benchmarks
run: cargo bench --bench benchmark --no-run --verbose
- name: Quick Benchmark Execution
run: cargo bench --bench benchmark -- --noplot --sample-size 10
publish-dry-run:
name: Crates.io Publish Dry Run
runs-on: ubuntu-latest
needs: [test-and-lint, benchmark-verify]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.91.1
- uses: Swatinem/rust-cache@v2
- name: Package Validation
run: cargo package --verbose
- name: Publish Dry Run
run: cargo publish --dry-run --verbose