litellm-rs 0.6.0

A high-performance AI Gateway written in Rust, providing OpenAI-compatible APIs with intelligent routing, load balancing, and enterprise features
Documentation
name: CI Fast

on:
  pull_request:
    branches: [ main, develop ]
    paths-ignore:
      - "**/*.md"
      - "docs/**"

concurrency:
  group: ci-fast-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  FEATURES: "postgres sqlite redis s3 metrics tracing websockets analytics"

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # v1
        with:
          toolchain: 1.96.1
          components: rustfmt, clippy

      - name: Cache
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-lint-fast-${{ hashFiles('**/Cargo.lock') }}

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Run clippy
        run: cargo clippy --lib --tests --bins --features "$FEATURES" -- -D warnings --force-warn clippy::collapsible-if

      - name: Provider consistency guards
        run: |
          cargo test test_catalog_entries_are_supported_selectors --lib
          cargo test test_catalog_entries_are_creatable_via_factory --lib
          cargo test core::router::gateway_config::tests:: --lib

      - name: Schema duplication guards
        run: bash scripts/guards/check_schema_duplicates.sh

      - name: API/runtime boundary guard
        run: bash scripts/guards/check_api_runtime_boundary.sh

      - name: Core subsystem registry guard
        run: bash scripts/guards/check_core_subsystem_registry.sh

      - name: Provider runtime HTTP boundary guard
        run: bash scripts/guards/check_outbound_http_clients.sh

      - name: Install guard dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y ripgrep

      - name: Log PII guard
        run: bash scripts/guards/check_log_pii.sh

      - name: PR scope guard
        if: github.event_name == 'pull_request'
        run: |
          git fetch origin main --depth=1
          bash scripts/guards/check_pr_scope.sh origin/main

  feature-matrix:
    name: Feature Matrix
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: lite
            features: "lite"
          - name: sqlite-redis
            features: "sqlite,redis"
          - name: postgres-redis
            features: "postgres,redis"
          - name: sqlite-redis-observability
            features: "sqlite,redis,metrics,tracing"
          - name: postgres-redis-s3-observability
            features: "postgres,redis,s3,metrics,tracing"
          - name: current-ci-bundle
            features: "postgres,sqlite,redis,s3,metrics,tracing,websockets,analytics"
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # v1
        with:
          toolchain: 1.96.1

      - name: Cache
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-feature-matrix-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}

      - name: Check feature combo (${{ matrix.name }})
        run: cargo check --lib --locked --no-default-features --features "${{ matrix.features }}"

  test:
    name: Test
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:15
        env:
          POSTGRES_PASSWORD: postgres
          POSTGRES_DB: gateway_test
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - 5432:5432

      redis:
        image: redis:7
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          - 6379:6379

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # v1
        with:
          toolchain: 1.96.1

      - name: Cache
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-test-fast-${{ hashFiles('**/Cargo.lock') }}

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y libpq-dev

      - name: Run tests
        run: cargo test --lib --tests --bins --features "$FEATURES" --verbose
        env:
          DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gateway_test
          REDIS_URL: redis://localhost:6379
          JWT_SECRET: test-secret-key-for-ci
          RUST_LOG: debug

  audit:
    name: Security Audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # v1
        with:
          toolchain: 1.96.1

      - name: Install cargo-audit
        run: cargo install cargo-audit --locked

      - name: Run audit
        run: cargo audit