Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

ci: simplify Rust checks and remove wheel PR comments (#39975)

yujonglee728d0953af94
diff --git a/.github/workflows/report-rust-release-wheel.yml b/.github/workflows/report-rust-release-wheel.yml
deleted file mode 100644
index 74e6be69604..00000000000
--- a/.github/workflows/report-rust-release-wheel.yml
+++ /dev/null
@@ -1,129 +0,0 @@
-name: Report LiteLLM Rust release wheel
-
-on: # zizmor: ignore[dangerous-triggers] reporter executes no PR code and consumes no PR artifacts or outputs
- workflow_run:
- workflows:
- - LiteLLM Rust
- types:
- - completed
-
-permissions: {}
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.workflow_run.pull_requests[0].number || github.event.workflow_run.id }}
- cancel-in-progress: false
-
-jobs:
- report-release-wheel:
- name: report release wheel
- if: >-
- github.event.workflow_run.event == 'pull_request' &&
- github.event.workflow_run.path == '.github/workflows/test-rust.yml' &&
- github.event.workflow_run.head_repository.full_name == github.repository &&
- github.event.workflow_run.pull_requests[0].number != null
- runs-on: ubuntu-latest
- timeout-minutes: 5
- permissions:
- pull-requests: write
-
- steps:
- - name: Link release wheel report on PR
- uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
- env:
- COMMENT_MARKER: "<!-- litellm-release-wheel-size -->"
- with:
- script: |
- const marker = process.env.COMMENT_MARKER;
- const workflowRun = context.payload.workflow_run;
- const allowedConclusions = new Set([
- "action_required",
- "cancelled",
- "failure",
- "neutral",
- "skipped",
- "stale",
- "startup_failure",
- "success",
- "timed_out",
- ]);
- if (
- !allowedConclusions.has(workflowRun.conclusion) ||
- workflowRun.event !== "pull_request" ||
- workflowRun.path !== ".github/workflows/test-rust.yml" ||
- workflowRun.head_repository?.full_name !==
- `${context.repo.owner}/${context.repo.repo}` ||
- workflowRun.pull_requests?.length !== 1
- ) {
- throw new Error("unexpected source workflow");
- }
- const pullRequest = workflowRun.pull_requests[0];
- const pullRequestNumber = pullRequest.number;
- const headSha = workflowRun.head_sha;
- const runId = workflowRun.id;
- if (
- !Number.isSafeInteger(pullRequestNumber) ||
- pullRequestNumber <= 0 ||
- !Number.isSafeInteger(runId) ||
- runId <= 0 ||
- !/^[0-9a-f]{40}$/.test(headSha) ||
- pullRequest.head?.sha !== headSha
- ) {
- throw new Error("invalid source workflow metadata");
- }
- const runUrl =
- `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` +
- `/actions/runs/${runId}`;
- const result =
- workflowRun.conclusion === "success"
- ? "successfully"
- : `with \`${workflowRun.conclusion}\``;
- const body = [
- marker,
- "## LiteLLM Rust workflow",
- "",
- `Workflow completed ${result} for \`${headSha}\``,
- "",
- `[View workflow run](${runUrl})`,
- ].join("\n");
- const comments = await github.paginate(github.rest.issues.listComments, {
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: pullRequestNumber,
- per_page: 100,
- });
- const existing = comments.find(
- (comment) =>
- comment.user?.login === "github-actions[bot]" &&
- comment.body?.startsWith(marker),
- );
- const currentPullRequest = (
- await github.rest.pulls.get({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: pullRequestNumber,
- })
- ).data;
- if (
- currentPullRequest.state !== "open" ||
- currentPullRequest.head.repo?.full_name !==
- `${context.repo.owner}/${context.repo.repo}` ||
- currentPullRequest.head.sha !== headSha
- ) {
- core.info("source workflow no longer matches the current pull request head");
- return;
- }
- if (existing) {
- await github.rest.issues.updateComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- comment_id: existing.id,
- body,
- });
- } else {
- await github.rest.issues.createComment({
- owner: context.repo.owner,
- repo: context.repo.repo,
- issue_number: pullRequestNumber,
- body,
- });
- }
diff --git a/.github/workflows/test-rust.yml b/.github/workflows/test-rust.yml
index 9b8b132df62..4f56e78ddee 100644
--- a/.github/workflows/test-rust.yml
+++ b/.github/workflows/test-rust.yml
@@ -7,6 +7,7 @@ on:
- ".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"
@@ -22,6 +23,7 @@ on:
- ".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"
@@ -34,102 +36,89 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
+env:
+ CARGO_TERM_COLOR: always
+
jobs:
- rust-checks:
- name: rustfmt, clippy, test
+ rust-lint:
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: litellm-rust
- env:
- CARGO_TERM_COLOR: always
-
steps:
- - name: Checkout repository
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
+ - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- - name: Set up Rust
- run: rustup toolchain install
+ - run: rustup toolchain install --no-self-update
+
+ - run: cargo fmt --check
- - name: Cache Cargo registry and target
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
+ - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.cargo/registry
~/.cargo/git
litellm-rust/target
- key: ${{ runner.os }}-cargo-${{ hashFiles('rust-toolchain.toml', 'litellm-rust/Cargo.lock') }}
+ key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'litellm-rust/Cargo.lock') }}
restore-keys: |
- ${{ runner.os }}-cargo-
-
- - name: Check Rust formatting
- run: cargo fmt --check
-
- - name: Run Clippy
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
-
- - name: Run Clippy with Bedrock auth
- run: cargo clippy -p litellm-core --all-targets --features bedrock-auth --locked -- -D warnings
+ ${{ runner.os }}-cargo-${{ github.job }}-
- - name: Run Clippy with all gateway features
- run: cargo clippy -p litellm-ai-gateway --all-targets --all-features --locked -- -D warnings
+ - run: cargo clippy --workspace --all-targets --locked -- -D warnings
- - name: Run Rust tests
- run: cargo test --workspace --locked
+ - run: cargo clippy -p litellm-core --all-targets --features bedrock-auth --locked -- -D warnings
- - name: Run core tests with Bedrock auth
- run: cargo test -p litellm-core --features bedrock-auth --locked
+ - run: cargo clippy -p litellm-ai-gateway --all-targets --all-features --locked -- -D warnings
- # Not --all-features: python-config links libpython, which this job does not install.
- - name: Run gateway tests with the server feature
- run: cargo test -p litellm-ai-gateway --features server --locked
-
- release-wheel:
- name: release wheel
+ rust-test:
runs-on: ubuntu-latest
- timeout-minutes: 20
- permissions:
- contents: read
- env:
- CARGO_TERM_COLOR: always
+ timeout-minutes: 30
steps:
- - name: Checkout repository
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
+ - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- - name: Set up Python
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- - name: Set up uv
- uses: ./.github/actions/setup-uv-with-retries
+ - uses: ./.github/actions/setup-uv-with-retries
with:
version: "0.10.9"
- - name: Set up Rust
- run: rustup toolchain install
+ - 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
- - name: Build release wheel
- run: uv build --wheel --out-dir dist
+ - run: cargo test -p litellm-core --features bedrock-auth --locked
+ working-directory: litellm-rust
- - name: Build panic contract wheel
- run: >-
- uv build --wheel --out-dir panic-dist
- --config-setting "maturin.build-args=--features panic-test,extension-module"
+ - run: cargo test -p litellm-ai-gateway --features server --locked
+ working-directory: litellm-rust
- - name: Smoke-test native panic unwinding
- run: python .github/scripts/smoke_test_native_wheel.py panic-dist/*.whl
+ - run: uv build --wheel --out-dir dist
- - name: Verify stripped native extension
+ - 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 .github/scripts/verify_linux_native_wheel.py dist/*.whl
- - name: Test native route wheel
- run: python tests/test_litellm/rust_bridge/native_route_wheel_test.py dist/*.whl
+ - 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