diff --git a/.circleci/config.yml b/.circleci/config.yml index 9a5b6da77f..32983c92e2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -409,14 +409,25 @@ jobs: --verbose \ --command="awk '/\\.py/ {print; next} {sub(/\\.[A-Z][^.]*$/, \"\"); gsub(/\\./, \"/\"); print \$0 \".py\"}' | xargs uv run --no-sync python -m pytest \ -v -x \ + --cov=./litellm --cov-report=xml \ --junitxml=test-results/junit.xml \ --durations=5 \ -n 2" no_output_timeout: 15m + - run: + name: Rename the coverage files + command: | + mv coverage.xml auth_ui_unit_tests_coverage.xml + mv .coverage auth_ui_unit_tests_coverage # Store test results - store_test_results: path: test-results + - persist_to_workspace: + root: . + paths: + - auth_ui_unit_tests_coverage.xml + - auth_ui_unit_tests_coverage litellm_router_testing: # Runs all tests with the "router" keyword docker: @@ -493,13 +504,24 @@ jobs: --verbose \ --command="awk '/\\.py/ {print; next} {sub(/\\.[A-Z][^.]*$/, \"\"); gsub(/\\./, \"/\"); print \$0 \".py\"}' | xargs uv run --no-sync python -m pytest \ -v -x \ + --cov=./litellm --cov-report=xml \ --junitxml=test-results/junit.xml \ --durations=5 \ -n 4" no_output_timeout: 15m + - run: + name: Rename the coverage files + command: | + mv coverage.xml router_unit_tests_coverage.xml + mv .coverage router_unit_tests_coverage # Store test results - store_test_results: path: test-results + - persist_to_workspace: + root: . + paths: + - router_unit_tests_coverage.xml + - router_unit_tests_coverage litellm_assistants_api_testing: # Runs all tests with the "assistants" keyword docker: - *python312_image @@ -2280,10 +2302,11 @@ jobs: - run: name: Combine Coverage command: | - uv tool run --from 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage + uv tool run --from 'coverage[toml]==7.10.6' coverage combine realtime_translation_coverage ocr_coverage search_coverage logging_coverage audio_coverage local_testing_part1_coverage local_testing_part2_coverage pass_through_unit_tests_coverage batches_coverage guardrails_coverage redis_caching_coverage agent_coverage google_generate_content_endpoint_coverage litellm_utils_coverage router_unit_tests_coverage auth_ui_unit_tests_coverage uv tool run --from 'coverage[toml]==7.10.6' coverage xml - codecov/upload: file: ./coverage.xml + flags: circleci ui_build: docker: @@ -2669,6 +2692,8 @@ workflows: - local_testing_part1 - local_testing_part2 - litellm_assistants_api_testing + - litellm_router_unit_testing + - auth_ui_unit_tests - db_migration_disable_update_check: requires: - build_docker_database_image diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.yml index 64862f3c8f..7e91341ac7 100644 --- a/.github/workflows/_test-unit-base.yml +++ b/.github/workflows/_test-unit-base.yml @@ -132,4 +132,5 @@ jobs: use_oidc: true directory: coverage-reports root_dir: ${{ github.workspace }} + flags: ${{ inputs.artifact-name }} fail_ci_if_error: false diff --git a/.github/workflows/_test-unit-services-base.yml b/.github/workflows/_test-unit-services-base.yml index 9dd668cbf3..7f973d8caf 100644 --- a/.github/workflows/_test-unit-services-base.yml +++ b/.github/workflows/_test-unit-services-base.yml @@ -186,4 +186,5 @@ jobs: use_oidc: true directory: coverage-reports root_dir: ${{ github.workspace }} + flags: ${{ inputs.artifact-name }} fail_ci_if_error: false diff --git a/.github/workflows/test-unit-caching-redis.yml b/.github/workflows/test-unit-caching-redis.yml deleted file mode 100644 index ca274324f2..0000000000 --- a/.github/workflows/test-unit-caching-redis.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: "Unit Tests: Caching (Redis)" - -# Uses cloud Redis credentials — only runs on trusted branches, not PRs. -# This prevents external PRs from accessing Redis credentials. -on: - push: - branches: [main, "litellm_*"] - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - caching-redis: - uses: ./.github/workflows/_test-unit-services-base.yml - with: - # Redis-only tests that do NOT require provider API keys. - # Tests needing API keys (test_caching.py, test_caching_ssl.py, test_prometheus_service.py, - # test_router_caching.py) are in Phase 3 integration workflows. - test-path: >- - tests/local_testing/test_dual_cache.py - tests/local_testing/test_redis_batch_optimizations.py - tests/local_testing/test_router_utils.py - workers: 2 - reruns: 2 - timeout-minutes: 20 - enable-redis: true - enable-postgres: false - secrets: - REDIS_HOST: ${{ secrets.REDIS_HOST }} - REDIS_PORT: ${{ secrets.REDIS_PORT }} - REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }} - DATABASE_URL: ${{ secrets.DATABASE_URL }} - POSTGRES_USER: ${{ secrets.POSTGRES_USER }} - POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} diff --git a/codecov.yaml b/codecov.yaml index 8609d3143d..58681b884d 100644 --- a/codecov.yaml +++ b/codecov.yaml @@ -3,6 +3,16 @@ codecov: notify: wait_for_ci: false # post as soon as expected uploads arrive, don't wait on CI +# Uploads are flagged per workflow/shard (GHA) or "circleci". carryforward makes +# a re-upload of a flag replace its prior session instead of accumulating a +# conflicting one, and lets a commit reuse a flag from its parent when that flag +# was not re-uploaded. Required because the same commit can receive the +# push-triggered workflows more than once (re-runs / branches cut at the same +# SHA); flagless overlapping sessions made Codecov drop the largest files. +flag_management: + default_rules: + carryforward: true + component_management: individual_components: - component_id: "Router"