ci(coverage): run coverage workflows on push and fix measurement gaps

Codecov tracks litellm_internal_staging, but only the proxy-db and
security shards ran on push to it; every other coverage workflow ran on
pull_request only. Their flags reached the branch through Codecov
carryforward, and with squash merges the fresh PR uploads are not in the
branch ancestry, so a flag can silently lag. proxy/utils.py reads 66% on
the branch while every PR measures it near 84%, because its coverage
comes from the PR-only proxy-endpoints flag. Adding a push trigger on the
trunk branches to the coverage-uploading unit-test workflows makes each
flag upload first-party on the branch HEAD instead of being carried
forward

A coverage exclude list stops TYPE_CHECKING blocks, abstract and overload
stubs, and __main__ guards from counting as missed lines. test-mcp now
uploads its coverage under an mcp flag instead of computing and
discarding it. The Router component path glob, which matched no files and
reported null, is corrected
This commit is contained in:
Yuneng Jiang 2026-06-03 19:22:22 -07:00
parent e9417603a3
commit 1904d8cf53
No known key found for this signature in database
13 changed files with 78 additions and 2 deletions

View file

@ -1,6 +1,11 @@
name: LiteLLM MCP Tests (folder - tests/mcp_tests)
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main
@ -10,6 +15,7 @@ on:
permissions:
contents: read
id-token: write
jobs:
test:
@ -43,4 +49,13 @@ jobs:
- name: Run MCP tests
run: |
uv run --no-sync pytest tests/mcp_tests -x -vv -n 4 --cov=./litellm --cov-report=xml --durations=5
uv run --no-sync pytest tests/mcp_tests -x -vv -n 4 --cov=./litellm --cov-report=xml --cov-config=pyproject.toml --durations=5
- name: Upload coverage to Codecov
if: success()
uses: codecov/codecov-action@75cd11691c0faa626561e295848008c8a7dddffe # v5.5.4
with:
use_oidc: true
files: coverage.xml
flags: mcp
fail_ci_if_error: false

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Core Utilities"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Enterprise, Google GenAI & Routing"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Integrations (Callbacks & Logging)"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: LLM Provider Transformations"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: MCP, Secrets, Containers & Misc"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Proxy Auth & Key Management"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Proxy API Endpoints"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Proxy Infrastructure"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Proxy Management-Endpoint Behavior Pinning"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -1,6 +1,11 @@
name: "Unit Tests: Responses, Caching & Types"
on:
push:
branches:
- main
- litellm_internal_staging
- litellm_oss_branch
pull_request:
branches:
- main

View file

@ -17,7 +17,9 @@ component_management:
individual_components:
- component_id: "Router"
paths:
- "router"
- "*/router.py"
- "*/router_strategy/*"
- "*/router_utils/*"
- component_id: "LLMs"
paths:
- "*/llms/*"

View file

@ -323,3 +323,12 @@ pytest_add_cli_args = [
source = ["litellm"]
relative_files = true
[tool.coverage.report]
exclude_also = [
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
"@(typing\\.)?overload",
]