feat: added code coverage reporting (#9081)

* added code coverage reporting

* fix issues

* more cleanup

* fix action configs

* cleanup token debug

* added comments to codecov.yml config

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
This commit is contained in:
Eric Pinzur 2025-07-21 10:03:34 -04:00 committed by GitHub
commit 65a977cba2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 128 additions and 1 deletions

View file

@ -171,12 +171,15 @@ jobs:
secrets:
OPENAI_API_KEY: "${{ secrets.OPENAI_API_KEY }}"
ANTHROPIC_API_KEY: "${{ secrets.ANTHROPIC_API_KEY }}"
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
test-frontend-unit:
needs: [path-filter, set-ci-condition]
name: Run Frontend Unit Tests
if: ${{ needs.path-filter.outputs.frontend == 'true' && needs.set-ci-condition.outputs.should-run-tests == 'true' }}
uses: ./.github/workflows/jest_test.yml
secrets:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
test-frontend:
needs: [path-filter, set-ci-condition]

View file

@ -2,6 +2,9 @@ name: Run Frontend Jest Unit Tests
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
inputs:
ref:
description: "(Optional) ref to checkout"
@ -65,6 +68,16 @@ jobs:
junitxml-title: Unit Test Results
junitxml-path: src/frontend/test-results/junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: src/frontend/coverage/lcov.info
flags: frontend
name: frontend-coverage
fail_ci_if_error: false
directory: src/frontend/coverage/
- name: Upload Coverage Reports
uses: actions/upload-artifact@v4
if: always()

View file

@ -7,6 +7,8 @@ on:
required: true
ANTHROPIC_API_KEY:
required: true
CODECOV_TOKEN:
required: false
inputs:
python-versions:
description: "(Optional) Python versions to test"
@ -50,11 +52,13 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
id: setup-node
with:
node-version: ${{ env.NODE_VERSION }}
- name: "Setup Environment"
uses: astral-sh/setup-uv@v6
with:
@ -62,15 +66,37 @@ jobs:
cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python-version }}
prune-cache: false
- name: Install the project
run: uv sync
- name: Run unit tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 12
max_attempts: 2
command: make unit_tests args="-x -vv --splits ${{ matrix.splitCount }} --group ${{ matrix.group }} --reruns 5"
command: make unit_tests args="-x -vv --splits ${{ matrix.splitCount }} --group ${{ matrix.group }} --reruns 5 --cov --cov-report=xml --cov-report=html"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: matrix.python-version == '3.10'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
flags: backend
name: backend-coverage-group-${{ matrix.group }}
fail_ci_if_error: false
directory: ./
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.10'
with:
name: backend-coverage-report-group-${{ matrix.group }}
path: |
coverage.xml
htmlcov/
retention-days: 30
integration-tests: