name: LiteLLM Rust on: push: paths: - "litellm-rust/**" - ".cargo/**" - "pyproject.toml" - "rust-toolchain.toml" - ".github/actions/setup-uv-with-retries/**" - ".github/scripts/smoke_test_native_wheel.py" - ".github/scripts/verify_linux_native_wheel.py" - "tests/test_litellm/rust_bridge/native_route_wheel_test.py" - ".github/workflows/test-rust.yml" pull_request: branches: - main - litellm_internal_staging - litellm_oss_staging - "litellm_**" paths: - "litellm-rust/**" - ".cargo/**" - "pyproject.toml" - "rust-toolchain.toml" - ".github/actions/setup-uv-with-retries/**" - ".github/scripts/smoke_test_native_wheel.py" - ".github/scripts/verify_linux_native_wheel.py" - "tests/test_litellm/rust_bridge/native_route_wheel_test.py" - ".github/workflows/test-rust.yml" permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: CARGO_TERM_COLOR: always jobs: rust-lint: runs-on: ubuntu-latest timeout-minutes: 10 defaults: run: working-directory: litellm-rust steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: persist-credentials: false - run: rustup toolchain install --no-self-update - run: cargo fmt --check - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | ~/.cargo/registry ~/.cargo/git litellm-rust/target key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'litellm-rust/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-${{ github.job }}- - run: cargo clippy --workspace --all-targets --locked -- -D warnings - run: cargo clippy -p litellm-core --all-targets --features bedrock-auth --locked -- -D warnings - run: cargo clippy -p litellm-ai-gateway --all-targets --all-features --locked -- -D warnings rust-test: runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 with: persist-credentials: false - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: "3.12" - uses: ./.github/actions/setup-uv-with-retries with: version: "0.10.9" - run: rustup toolchain install --no-self-update - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | ~/.cargo/registry ~/.cargo/git litellm-rust/target key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'litellm-rust/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-${{ github.job }}- - run: cargo test --workspace --locked working-directory: litellm-rust - run: cargo test -p litellm-core --features bedrock-auth --locked working-directory: litellm-rust - run: cargo test -p litellm-ai-gateway --features server --locked working-directory: litellm-rust - run: uv build --wheel --out-dir dist - run: python .github/scripts/verify_linux_native_wheel.py dist/*.whl env: RELEASE_WHEEL_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} - run: python tests/test_litellm/rust_bridge/native_route_wheel_test.py dist/*.whl - run: >- uv build --wheel --out-dir panic-dist --config-setting "maturin.build-args=--features panic-test,extension-module" - run: python .github/scripts/smoke_test_native_wheel.py panic-dist/*.whl