name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 with:
components: clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Check all features
run: cargo check --all-features --workspace
test-features:
name: Test (${{ matrix.features }})
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
features:
- "http"
- "mcp"
- "http,mcp"
- "http,security"
- "http,cache"
- "http,websocket"
- "http,grpc"
- "http,streaming"
- "full"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Run tests with features ${{ matrix.features }}
run: cargo test --features "${{ matrix.features }}" --workspace
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install protoc (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install protoc (macOS)
if: runner.os == 'macOS'
run: brew install protobuf
- name: Install protoc (Windows)
if: runner.os == 'Windows'
run: choco install protoc -y
- name: Build
run: cargo build --all-features --workspace
doc:
name: Documentation
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Build documentation
run: cargo doc --no-deps --all-features --workspace
env:
RUSTDOCFLAGS: -D warnings
security:
name: Security
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install tools
uses: taiki-e/install-action@c3ec0de9ae7f1019cea21aa96aa0a895b9552063 with:
tool: cargo-audit,cargo-deny
- name: cargo deny
run: cargo deny check
- name: cargo audit
run: cargo audit
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - uses: dtolnay/rust-toolchain@4716b85f2fac3e324e64fa2810f6b5c3905760a5 with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - name: Install cargo-llvm-cov
uses: taiki-e/install-action@c3ec0de9ae7f1019cea21aa96aa0a895b9552063 with:
tool: cargo-llvm-cov
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Generate coverage (gate ≥80% lines)
run: |
cargo llvm-cov \
--features full \
--lib \
--lcov \
--output-path lcov.info \
--fail-under-lines 80 \
--ignore-filename-regex "(examples/|temp/|macros/|src/grpc/pb/|src/benches/)"
- name: Upload coverage
if: always()
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f with:
files: lcov.info
fail_ci_if_error: false