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]

[Infra] Remove Redundant Matrix Unit Test Workflow (#25251)

yuneng-jiangd132b1bf51cb
diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml
index f1ae30e67d7..d8dec73c428 100644
--- a/.github/workflows/_test-unit-base.yml
+++ b/.github/workflows/_test-unit-base.yml
@@ -27,6 +27,10 @@ on:
required: false
type: number
default: 10
+ artifact-name:
+ description: "Unique name for the coverage artifact (must be unique per run)"
+ required: true
+ type: string
permissions:
contents: read
@@ -93,4 +97,46 @@ jobs:
--reruns "${RERUNS}" \
--reruns-delay 1 \
--dist=loadscope \
- --durations=20
+ --durations=20 \
+ --cov=litellm \
+ --cov-report=xml:coverage.xml \
+ --cov-config=pyproject.toml
+
+ - name: Save coverage report
+ if: always()
+ uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
+ with:
+ name: coverage-${{ inputs.artifact-name }}-${{ github.run_id }}-${{ github.run_attempt }}
+ path: coverage.xml
+ retention-days: 1
+
+ upload-coverage:
+ name: Upload coverage to Codecov
+ needs: run
+ if: always()
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ pull-requests: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
+ with:
+ persist-credentials: false
+
+ - name: Download coverage report
+ uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+ with:
+ pattern: coverage-${{ inputs.artifact-name }}-${{ github.run_id }}-${{ github.run_attempt }}
+ path: coverage-reports
+ merge-multiple: true
+
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
+ with:
+ use_oidc: true
+ directory: coverage-reports
+ root_dir: ${{ github.workspace }}
+ fail_ci_if_error: false
diff --git a/.github/workflows/_test-unit-services-base.yml b/.github/workflows/_test-unit-services-base.yml
index d53a9e8822a..7af3ab16c35 100644
--- a/.github/workflows/_test-unit-services-base.yml
+++ b/.github/workflows/_test-unit-services-base.yml
@@ -37,6 +37,11 @@ on:
required: false
type: boolean
default: false
+ artifact-name:
+ description: "Unique name for the coverage artifact (must be unique per run)"
+ required: false
+ type: string
+ default: "run"
secrets:
REDIS_HOST:
required: false
@@ -151,7 +156,10 @@ jobs:
--maxfail="${MAX_FAILURES}" \
--reruns "${RERUNS}" \
--reruns-delay 1 \
- --durations=20
+ --durations=20 \
+ --cov=litellm \
+ --cov-report=xml:coverage.xml \
+ --cov-config=pyproject.toml
else
poetry run pytest ${TEST_PATH:?} \
--tb=short -vv \
@@ -160,5 +168,47 @@ jobs:
--reruns "${RERUNS}" \
--reruns-delay 1 \
--dist=loadscope \
- --durations=20
+ --durations=20 \
+ --cov=litellm \
+ --cov-report=xml:coverage.xml \
+ --cov-config=pyproject.toml
fi
+
+ - name: Save coverage report
+ if: always()
+ uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
+ with:
+ name: coverage-${{ inputs.artifact-name }}-${{ github.run_id }}-${{ github.run_attempt }}
+ path: coverage.xml
+ retention-days: 1
+
+ upload-coverage:
+ name: Upload coverage to Codecov
+ needs: run
+ if: always()
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ id-token: write
+ pull-requests: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
+ with:
+ persist-credentials: false
+
+ - name: Download coverage report
+ uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
+ with:
+ pattern: coverage-${{ inputs.artifact-name }}-${{ github.run_id }}-${{ github.run_attempt }}
+ path: coverage-reports
+ merge-multiple: true
+
+ - name: Upload to Codecov
+ uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
+ with:
+ use_oidc: true
+ directory: coverage-reports
+ root_dir: ${{ github.workspace }}
+ fail_ci_if_error: false
diff --git a/.github/workflows/test-litellm-matrix.yml b/.github/workflows/test-litellm-matrix.yml
deleted file mode 100644
index dafabe4d83e..00000000000
--- a/.github/workflows/test-litellm-matrix.yml
+++ /dev/null
@@ -1,214 +0,0 @@
-name: LiteLLM Unit Tests (Matrix)
-
-on:
- pull_request:
- branches: [main]
-
-permissions:
- contents: read
-
-# Cancel in-progress runs for the same PR
-concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
- cancel-in-progress: true
-
-jobs:
- test:
- runs-on: ubuntu-latest
- timeout-minutes: 20 # Increased from 15 to 20
- strategy:
- fail-fast: false
- matrix:
- test-group:
- # tests/test_litellm split by subdirectory (~560 files total)
- # Vertex AI tests separated for better isolation (prevent auth/env pollution)
- - name: "llms-vertex"
- path: "tests/test_litellm/llms/vertex_ai"
- workers: 1
- reruns: 2
- - name: "llms-other"
- path: "tests/test_litellm/llms --ignore=tests/test_litellm/llms/vertex_ai"
- workers: 2
- reruns: 2
- # tests/test_litellm/proxy split by subdirectory (~180 files total)
- - name: "proxy-guardrails"
- path: "tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/management_helpers"
- workers: 2
- reruns: 2
- - name: "proxy-core"
- path: "tests/test_litellm/proxy/auth tests/test_litellm/proxy/client tests/test_litellm/proxy/db tests/test_litellm/proxy/hooks tests/test_litellm/proxy/policy_engine"
- workers: 2
- reruns: 2
- - name: "proxy-misc"
- path: "tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/agent_endpoints tests/test_litellm/proxy/anthropic_endpoints tests/test_litellm/proxy/common_utils tests/test_litellm/proxy/discovery_endpoints tests/test_litellm/proxy/experimental tests/test_litellm/proxy/google_endpoints tests/test_litellm/proxy/health_endpoints tests/test_litellm/proxy/image_endpoints tests/test_litellm/proxy/middleware tests/test_litellm/proxy/openai_files_endpoint tests/test_litellm/proxy/pass_through_endpoints tests/test_litellm/proxy/prompts tests/test_litellm/proxy/public_endpoints tests/test_litellm/proxy/response_api_endpoints tests/test_litellm/proxy/spend_tracking tests/test_litellm/proxy/ui_crud_endpoints tests/test_litellm/proxy/vector_store_endpoints tests/test_litellm/proxy/test_*.py"
- workers: 2
- reruns: 2
- - name: "integrations"
- path: "tests/test_litellm/integrations"
- workers: 2
- reruns: 3 # Integration tests tend to be flakier
- - name: "core-utils"
- path: "tests/test_litellm/litellm_core_utils"
- workers: 2
- reruns: 1
- - name: "other-1"
- # responses (5942) + caching (1723) + types (819) ≈ 8.5k lines
- path: "tests/test_litellm/responses tests/test_litellm/caching tests/test_litellm/types"
- workers: 2
- reruns: 2
- - name: "other-2"
- # enterprise (3062) + google_genai (2511) + router_utils (1982) ≈ 7.6k lines
- path: "tests/test_litellm/enterprise tests/test_litellm/google_genai tests/test_litellm/router_utils"
- workers: 2
- reruns: 2
- - name: "other-3"
- # remaining dirs ≈ 8.0k lines
- path: "tests/test_litellm/router_strategy tests/test_litellm/secret_managers tests/test_litellm/a2a_protocol tests/test_litellm/anthropic_interface tests/test_litellm/completion_extras tests/test_litellm/containers tests/test_litellm/experimental_mcp_client tests/test_litellm/images tests/test_litellm/interactions tests/test_litellm/passthrough tests/test_litellm/vector_stores"
- workers: 2
- reruns: 2
- - name: "root"
- path: "tests/test_litellm/test_*.py"
- workers: 2
- reruns: 2
- # tests/proxy_unit_tests split alphabetically (~48 files total)
- - name: "proxy-unit-a1"
- # test_[a-j]*.py: jwt (1564) + auth_checks (978) + google_gemini (478) + e2e_pod_lock (437) + rest
- path: "tests/proxy_unit_tests/test_[a-j]*.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-a2"
- # test_[k-o]*.py: key_generate_prisma (4346) + key_generate_dynamodb + models_fallback
- path: "tests/proxy_unit_tests/test_[k-o]*.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b1"
- # lighter config/utility proxy tests (prisma, project, prompt, proxy_[c-r]*)
- path: "tests/proxy_unit_tests/test_prisma*.py tests/proxy_unit_tests/test_project*.py tests/proxy_unit_tests/test_prompt*.py tests/proxy_unit_tests/test_proxy_[c-r]*.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b2"
- # proxy_server.py alone (2750 lines) - isolated to avoid blocking smaller tests
- path: "tests/proxy_unit_tests/test_proxy_server.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b3"
- # proxy_server_* (618) + proxy_setting_guardrails (71) - smaller server-related tests
- path: "tests/proxy_unit_tests/test_proxy_server_*.py tests/proxy_unit_tests/test_proxy_setting_guardrails.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b4"
- # proxy_utils.py alone (2339 lines) - isolated to avoid blocking token counter
- path: "tests/proxy_unit_tests/test_proxy_utils.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b5"
- # proxy_token_counter (1279) - runs independently from utils
- path: "tests/proxy_unit_tests/test_proxy_token_counter.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b6"
- # test_[r-t]*.py: response_polling (1399) + search_api_logging (202) + server_root (64) + skills_db (261) + realtime_cache (62)
- path: "tests/proxy_unit_tests/test_[r-t]*.py"
- workers: 2
- reruns: 1
- - name: "proxy-unit-b7"
- # test_[u-z]*.py: user_api_key_auth (1136) + zero_cost (590) + update_spend (305) + unit_test_* (206) + ui_path (157)
- path: "tests/proxy_unit_tests/test_[u-z]*.py"
- workers: 2
- reruns: 1
-
- name: test (${{ matrix.test-group.name }})
-
- steps:
- - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- with:
- persist-credentials: false
-
- - name: Set up Python
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
- with:
- python-version: "3.12"
-
- - name: Install Poetry
- run: pip install 'poetry==2.3.2'
-
- - name: Cache Poetry dependencies
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.0.0
- with:
- path: |
- ~/.cache/pypoetry
- ~/.cache/pip
- .venv
- key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- restore-keys: |
- ${{ runner.os }}-poetry-
-
- - name: Install dependencies
- run: |
- poetry config virtualenvs.in-project true
- poetry install --with dev,proxy-dev --extras "proxy semantic-router"
- # pytest-rerunfailures and pytest-xdist are in pyproject.toml dev dependencies
- poetry run pip install google-genai==1.22.0 \
- google-cloud-aiplatform==1.115.0 fastapi-offline==1.7.3 python-multipart==0.0.22 openapi-core==0.23.0
-
- - name: Setup litellm-enterprise
- run: |
- poetry run pip install --force-reinstall --no-deps -e enterprise/
-
- - name: Generate Prisma client
- env:
- PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache
- run: |
- poetry run pip install nodejs-wheel-binaries==24.13.1
- poetry run prisma generate --schema litellm/proxy/schema.prisma
-
- - name: Run tests - ${{ matrix.test-group.name }}
- run: |
- poetry run pytest ${{ matrix.test-group.path }} \
- --tb=short -vv \
- --maxfail=10 \
- -n ${{ matrix.test-group.workers }} \
- --reruns ${{ matrix.test-group.reruns }} \
- --reruns-delay 1 \
- --dist=loadscope \
- --durations=20 \
- --cov=litellm \
- --cov-report=xml:coverage-${{ matrix.test-group.name }}.xml \
- --cov-config=pyproject.toml
-
- - name: Save coverage report
- if: always()
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
- with:
- name: coverage-${{ matrix.test-group.name }}
- path: coverage-${{ matrix.test-group.name }}.xml
- retention-days: 1
-
- upload-coverage:
- name: Upload coverage to Codecov
- needs: test
- if: always()
- runs-on: ubuntu-latest
- permissions:
- contents: read
- id-token: write # Required for OIDC tokenless upload
- pull-requests: write # Required for Codecov PR comments
-
- steps:
- - name: Checkout code
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
-
- - name: Download all coverage reports
- uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
- with:
- pattern: coverage-*
- path: coverage-reports
- merge-multiple: true
-
- - name: Upload to Codecov
- uses: codecov/codecov-action@aa56896cf108bd10b5eb883cd1d24196da57f695 # v5.5.4
- with:
- use_oidc: true
- directory: coverage-reports
- root_dir: ${{ github.workspace }}
- fail_ci_if_error: false
diff --git a/.github/workflows/test-unit-caching-redis.yml b/.github/workflows/test-unit-caching-redis.yml
index ca274324f2f..36305afc617 100644
--- a/.github/workflows/test-unit-caching-redis.yml
+++ b/.github/workflows/test-unit-caching-redis.yml
@@ -8,6 +8,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -29,6 +31,7 @@ jobs:
timeout-minutes: 20
enable-redis: true
enable-postgres: false
+ artifact-name: caching-redis
secrets:
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
diff --git a/.github/workflows/test-unit-core-utils.yml b/.github/workflows/test-unit-core-utils.yml
index 2f3698fdf60..9696cea5616 100644
--- a/.github/workflows/test-unit-core-utils.yml
+++ b/.github/workflows/test-unit-core-utils.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -18,3 +20,4 @@ jobs:
test-path: "tests/test_litellm/litellm_core_utils"
workers: 2
reruns: 1
+ artifact-name: core-utils
diff --git a/.github/workflows/test-unit-enterprise-routing.yml b/.github/workflows/test-unit-enterprise-routing.yml
index 13ae3efedba..986de119535 100644
--- a/.github/workflows/test-unit-enterprise-routing.yml
+++ b/.github/workflows/test-unit-enterprise-routing.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -22,3 +24,4 @@ jobs:
tests/test_litellm/router_strategy
workers: 2
reruns: 2
+ artifact-name: enterprise-routing
diff --git a/.github/workflows/test-unit-integrations.yml b/.github/workflows/test-unit-integrations.yml
index 2789f99d81c..e73c09d6cd8 100644
--- a/.github/workflows/test-unit-integrations.yml
+++ b/.github/workflows/test-unit-integrations.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -18,3 +20,4 @@ jobs:
test-path: "tests/test_litellm/integrations"
workers: 2
reruns: 3
+ artifact-name: integrations
diff --git a/.github/workflows/test-unit-llm-providers.yml b/.github/workflows/test-unit-llm-providers.yml
index 6c00272b0c8..2fb4cf8c1db 100644
--- a/.github/workflows/test-unit-llm-providers.yml
+++ b/.github/workflows/test-unit-llm-providers.yml
@@ -14,16 +14,26 @@ concurrency:
jobs:
vertex-ai:
name: Vertex AI
+ permissions:
+ contents: read
+ id-token: write
+ pull-requests: write
uses: ./.github/workflows/_test-unit-base.yml
with:
test-path: "tests/test_litellm/llms/vertex_ai"
workers: 1
reruns: 2
+ artifact-name: llm-vertex-ai
other-providers:
name: All Other Providers
+ permissions:
+ contents: read
+ id-token: write
+ pull-requests: write
uses: ./.github/workflows/_test-unit-base.yml
with:
test-path: "tests/test_litellm/llms --ignore=tests/test_litellm/llms/vertex_ai"
workers: 2
reruns: 2
+ artifact-name: llm-other-providers
diff --git a/.github/workflows/test-unit-misc.yml b/.github/workflows/test-unit-misc.yml
index 9228decd7cc..e44133867e6 100644
--- a/.github/workflows/test-unit-misc.yml
+++ b/.github/workflows/test-unit-misc.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -29,3 +31,4 @@ jobs:
tests/test_litellm/test_*.py
workers: 2
reruns: 2
+ artifact-name: misc
diff --git a/.github/workflows/test-unit-proxy-auth.yml b/.github/workflows/test-unit-proxy-auth.yml
index e71821db701..5e427a39f35 100644
--- a/.github/workflows/test-unit-proxy-auth.yml
+++ b/.github/workflows/test-unit-proxy-auth.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -18,3 +20,4 @@ jobs:
test-path: "tests/test_litellm/proxy/auth tests/test_litellm/proxy/hooks tests/test_litellm/proxy/policy_engine tests/test_litellm/proxy/client"
workers: 2
reruns: 2
+ artifact-name: proxy-auth
diff --git a/.github/workflows/test-unit-proxy-db.yml b/.github/workflows/test-unit-proxy-db.yml
index bdfb6efeef1..1c764a96a3d 100644
--- a/.github/workflows/test-unit-proxy-db.yml
+++ b/.github/workflows/test-unit-proxy-db.yml
@@ -14,6 +14,10 @@ concurrency:
jobs:
proxy-db:
+ permissions:
+ contents: read
+ id-token: write
+ pull-requests: write
strategy:
fail-fast: false
matrix:
@@ -39,6 +43,7 @@ jobs:
timeout-minutes: ${{ matrix.timeout }}
enable-redis: false
enable-postgres: true
+ artifact-name: proxy-db-${{ matrix.test-group }}
secrets:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
diff --git a/.github/workflows/test-unit-proxy-endpoints.yml b/.github/workflows/test-unit-proxy-endpoints.yml
index caff3b3ae06..67d35ef794e 100644
--- a/.github/workflows/test-unit-proxy-endpoints.yml
+++ b/.github/workflows/test-unit-proxy-endpoints.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -33,3 +35,4 @@ jobs:
tests/test_litellm/proxy/ui_crud_endpoints
workers: 2
reruns: 2
+ artifact-name: proxy-endpoints
diff --git a/.github/workflows/test-unit-proxy-infra.yml b/.github/workflows/test-unit-proxy-infra.yml
index 4dfbbe317ed..56801569345 100644
--- a/.github/workflows/test-unit-proxy-infra.yml
+++ b/.github/workflows/test-unit-proxy-infra.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -26,3 +28,4 @@ jobs:
tests/test_litellm/proxy/test_*.py
workers: 2
reruns: 2
+ artifact-name: proxy-infra
diff --git a/.github/workflows/test-unit-responses-caching-types.yml b/.github/workflows/test-unit-responses-caching-types.yml
index 7f3acac2803..771a695a70c 100644
--- a/.github/workflows/test-unit-responses-caching-types.yml
+++ b/.github/workflows/test-unit-responses-caching-types.yml
@@ -6,6 +6,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -18,3 +20,4 @@ jobs:
test-path: "tests/test_litellm/responses tests/test_litellm/caching tests/test_litellm/types"
workers: 2
reruns: 2
+ artifact-name: responses-caching-types
diff --git a/.github/workflows/test-unit-security.yml b/.github/workflows/test-unit-security.yml
index b38c82b1c24..2e496d92636 100644
--- a/.github/workflows/test-unit-security.yml
+++ b/.github/workflows/test-unit-security.yml
@@ -7,6 +7,8 @@ on:
permissions:
contents: read
+ id-token: write
+ pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -22,6 +24,7 @@ jobs:
timeout-minutes: 20
enable-redis: false
enable-postgres: true
+ artifact-name: security
secrets:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}