From ae02bd0e583e07a9536aaba0b032962d23e74c5a Mon Sep 17 00:00:00 2001 From: Ovtcharov Date: Thu, 28 May 2026 20:31:19 -0700 Subject: [PATCH 1/2] ci(coverage): add Codecov integration with 60% project gate Unit tests already ran pytest-cov but never uploaded the data. Now coverage.xml is generated and uploaded to Codecov on the py3.12 matrix leg, with a 60% project target and 70% patch target. pytest-cov is declared as a dev dependency so local runs pick it up too. Closes #879 --- .codecov.yml | 24 ++++++++++++++++++++++++ .github/workflows/test_unit.yml | 12 +++++++++++- setup.py | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..d8895a859 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,24 @@ +# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved. +# SPDX-License-Identifier: MIT + +codecov: + require_ci_to_pass: true + +coverage: + status: + project: + default: + target: 60% + threshold: 2% + patch: + default: + target: 70% + +ignore: + - "tests/" + - "docs/" + - "scripts/" + - "workshop/" + - "src/gaia/eval/" + - "src/gaia/apps/webui/" + - "setup.py" diff --git a/.github/workflows/test_unit.yml b/.github/workflows/test_unit.yml index dead53e1d..2ac10175e 100644 --- a/.github/workflows/test_unit.yml +++ b/.github/workflows/test_unit.yml @@ -85,7 +85,17 @@ jobs: echo "=== Running Unit Tests ===" echo "These are fast tests for core SDK components" echo "" - pytest tests/unit/ -v --tb=short --cov=src/gaia --cov-report=term-missing + pytest tests/unit/ -v --tb=short \ + --cov=src/gaia --cov-report=term-missing --cov-report=xml:coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + files: coverage.xml + flags: unit + fail_ci_if_error: false + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Run DatabaseMixin integration tests env: diff --git a/setup.py b/setup.py index 46301977f..3ea1512a8 100644 --- a/setup.py +++ b/setup.py @@ -181,6 +181,7 @@ ], "dev": [ "pytest", + "pytest-cov", "pytest-benchmark", "pytest-mock", "pytest-asyncio", From 01d0345ff3c1a9f1ee7433274d2114632c84f3ad Mon Sep 17 00:00:00 2001 From: Ovtcharov Date: Thu, 28 May 2026 23:41:03 -0700 Subject: [PATCH 2/2] ci(coverage): upload on failure + upgrade to codecov-action v5 Add `if: always()` so partial-run coverage is still uploaded when tests fail. Upgrade to codecov-action@v5 and move token from env to the `with` block per the v5 migration guide. --- .github/workflows/test_unit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_unit.yml b/.github/workflows/test_unit.yml index 2ac10175e..cafd73051 100644 --- a/.github/workflows/test_unit.yml +++ b/.github/workflows/test_unit.yml @@ -89,13 +89,13 @@ jobs: --cov=src/gaia --cov-report=term-missing --cov-report=xml:coverage.xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + if: always() + uses: codecov/codecov-action@v5 with: files: coverage.xml flags: unit + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Run DatabaseMixin integration tests env: