name: "Unit Tests" on: pull_request: branches: - main - "litellm_**" push: branches: - main workflow_dispatch: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} # One caller for every tests/test_litellm shard, replacing the nine thin workflow # files that each wrapped a single call to _test-unit-base.yml. Adding a shard is # now one matrix entry rather than a new file. # # `name` is the shard id and nothing else, so each check reports as # " / Run tests" exactly as it did when the shard had its own file. Those # strings are the branch ruleset's required contexts, so they are load-bearing: # renaming an entry renames a required check and the ruleset stops matching it. # # Every entry states its timeouts even when they equal the base workflow's # defaults. An absent matrix key renders as an empty string, which is not a # number, so a partially-specified entry would fail the call rather than fall # back to the default. # # tests/unit/proxy keeps its own caller (test-unit-proxy-db.yml): it is already # a matrix and carries a shard-coverage guard that reads that file by name. # Folding it in here is a follow-up, together with generalising that guard into # assert_ci_coverage.py. # # `unit-flag` names the `.circleci/tests.yml` job that now runs part of the # shard under the same Codecov flag. That pipeline is manual-only while the # tests migrate, so the shard also runs those files on every event. jobs: unit: name: ${{ matrix.shard }} permissions: contents: read id-token: write pull-requests: write strategy: fail-fast: false matrix: include: - shard: mcp-integration artifact-name: mcp-integration test-path: "tests/mcp_tests" unit-flag: mcp-integration workers: 2 reruns: 0 timeout-minutes: 20 job-timeout-minutes: 60 - shard: core-utils artifact-name: core-utils test-path: "tests/test_litellm/litellm_core_utils" workers: 2 reruns: 1 timeout-minutes: 20 job-timeout-minutes: 60 - shard: enterprise-routing artifact-name: enterprise-routing test-path: >- tests/test_litellm/router_utils tests/test_litellm/router_strategy unit-flag: enterprise-routing workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: integrations artifact-name: integrations test-path: "" unit-flag: integrations workers: 2 reruns: 3 timeout-minutes: 20 job-timeout-minutes: 60 - shard: Vertex AI artifact-name: llm-vertex-ai test-path: "tests/test_litellm/llms/vertex_ai" unit-flag: llm-vertex-ai workers: 1 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: All Other Providers artifact-name: llm-other-providers test-path: "tests/test_litellm/llms --ignore=tests/test_litellm/llms/vertex_ai" unit-flag: llm-other-providers workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: misc artifact-name: misc test-path: >- tests/test_litellm/interactions tests/test_litellm/ocr tests/test_litellm/passthrough tests/test_litellm/rust_bridge tests/test_litellm/test_*.py unit-flag: misc workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: proxy-auth artifact-name: proxy-auth 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 timeout-minutes: 20 job-timeout-minutes: 60 - shard: proxy-endpoints artifact-name: proxy-endpoints test-path: >- tests/test_litellm/proxy/analytics_endpoints tests/test_litellm/proxy/management_endpoints tests/test_litellm/proxy/list_api tests/test_litellm/proxy/memory tests/test_litellm/proxy/guardrails tests/test_litellm/proxy/management_helpers tests/test_litellm/proxy/anthropic_endpoints tests/test_litellm/proxy/google_endpoints tests/test_litellm/proxy/openai_files_endpoint tests/test_litellm/proxy/batches_endpoints tests/test_litellm/proxy/container_endpoints tests/test_litellm/proxy/fine_tuning_endpoints tests/test_litellm/proxy/vector_store_files_endpoints tests/test_litellm/proxy/video_endpoints tests/test_litellm/proxy/response_api_endpoints tests/test_litellm/proxy/image_endpoints tests/test_litellm/proxy/ocr_endpoints tests/test_litellm/proxy/vector_store_endpoints tests/test_litellm/proxy/agent_endpoints tests/test_litellm/proxy/a2a tests/test_litellm/proxy/credential_endpoints tests/test_litellm/proxy/discovery_endpoints tests/test_litellm/proxy/health_endpoints tests/test_litellm/proxy/shutdown tests/test_litellm/proxy/public_endpoints tests/test_litellm/proxy/prompts tests/test_litellm/proxy/rag_endpoints tests/test_litellm/proxy/rerank_endpoints tests/test_litellm/proxy/realtime_endpoints tests/test_litellm/proxy/ui_crud_endpoints tests/test_litellm/proxy/config_resolvers tests/test_litellm/proxy/utils workers: 4 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: proxy-server artifact-name: proxy-server test-path: "tests/test_litellm/proxy/proxy_server" workers: 4 reruns: 2 timeout-minutes: 60 job-timeout-minutes: 100 - shard: proxy-infra artifact-name: proxy-infra test-path: >- tests/test_litellm/proxy/db tests/test_litellm/proxy/middleware tests/test_litellm/proxy/spend_tracking tests/test_litellm/proxy/pass_through_endpoints tests/test_litellm/proxy/_experimental tests/test_litellm/proxy/experimental tests/test_litellm/proxy/common_utils tests/test_litellm/proxy/enterprise_billing tests/test_litellm/proxy/types_utils tests/test_litellm/proxy/logging_endpoints tests/test_litellm/proxy/test_*.py unit-flag: proxy-infra workers: 4 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: caching-local artifact-name: caching-local test-path: "" unit-flag: caching-local workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: proxy-extras artifact-name: proxy-extras test-path: "" unit-flag: proxy-extras workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: enterprise-package artifact-name: enterprise-package test-path: "" unit-flag: enterprise-package workers: 4 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 - shard: responses-caching-types artifact-name: responses-caching-types test-path: >- tests/test_litellm/responses tests/test_litellm/caching unit-flag: responses-caching-types workers: 2 reruns: 2 timeout-minutes: 20 job-timeout-minutes: 60 uses: ./.github/workflows/_test-unit-base.yml with: test-path: ${{ matrix.test-path }} unit-flag: ${{ matrix.unit-flag || '' }} workers: ${{ matrix.workers }} reruns: ${{ matrix.reruns }} timeout-minutes: ${{ matrix.timeout-minutes }} job-timeout-minutes: ${{ matrix.job-timeout-minutes }} artifact-name: ${{ matrix.artifact-name }} legacy-mcp-peer: ${{ matrix.shard == 'mcp-integration' }}