name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
check:
name: Check & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy (all features)
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Type check (default features)
run: cargo check
- name: Type check (no default features)
run: cargo check --no-default-features
- name: Type check (all features)
run: cargo check --all-features --all-targets
- name: Doc warnings
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Audit
run: cargo audit
deny:
name: Supply Chain (cargo-deny)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
test:
name: Test (${{ matrix.os }})
needs: [check]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --all-features
- name: Run doc tests
run: cargo test --doc
test-features:
name: Feature Matrix
needs: [check]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- ""
- "ollama"
- "openai,anthropic"
- "dlp"
- "all-providers"
- "all-providers,dlp,tools"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test with features '${{ matrix.features }}'
run: cargo test --no-default-features --features "${{ matrix.features }}"
msrv:
name: MSRV (1.89)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.89"
- uses: Swatinem/rust-cache@v2
- name: Check with MSRV
run: cargo check
- name: Test with MSRV
run: cargo test
semver:
name: SemVer Check
runs-on: ubuntu-latest
needs: [check]
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-semver-checks
run: cargo install cargo-semver-checks
- name: Check semver compliance
run: cargo semver-checks check-release
coverage:
name: Coverage
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Generate coverage
run: cargo llvm-cov --all-features --lcov --output-path lcov.info
- name: Upload coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
fuzz:
name: Fuzz (smoke)
runs-on: ubuntu-latest
needs: [check]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Fuzz inference request (60s)
run: cargo +nightly fuzz run fuzz_inference_request -- -max_total_time=60
- name: Fuzz message content (60s)
run: cargo +nightly fuzz run fuzz_message_content -- -max_total_time=60
bench:
name: Benchmarks
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run synthetic benchmarks
run: cargo bench --bench routing --bench providers --bench hot_path --bench e2e -- --noplot
- name: Upload benchmark artifacts
uses: actions/upload-artifact@v4
with:
name: criterion-results
path: target/criterion/
retention-days: 30