ci(lfx): add coverage generation and Codecov reporting (#10266)

* chore: update dependency markers and add pytest-cov for coverage reporting

- Refined dependency markers for several packages to improve compatibility with Python 3.12 and specific platforms.
- Added pytest-cov to development dependencies for enhanced test coverage reporting.
- Updated dependencies for pyobjc frameworks to include platform-specific markers for better compatibility.

* chore: enhance lfx_tests command with coverage reporting

- Updated the lfx_tests target in the Makefile to include coverage reporting options for pytest.
- Added coverage metrics output in XML, HTML, and terminal formats to improve test visibility and analysis.

* chore: update codecov configuration for LFX coverage tracking

- Added LFX coverage target and threshold to the codecov.yml file.
- Defined separate coverage flags for frontend, backend, and LFX components.
- Updated ignore patterns to exclude LFX test and component directories from coverage reports.

* chore: add coverage upload steps to Python CI workflow

- Implemented steps to upload coverage reports to Codecov for Python 3.10.
- Added artifact upload for coverage reports, retaining them for 30 days.

* chore: update LFX coverage target in codecov configuration

- Increased the LFX coverage target from 40% to 60% to encourage aspirational improvement.
- Clarified the allowable drop in coverage threshold from 44% to 39% without failing the status check.

* chore: update coverage configuration in pyproject.toml

- Enabled branch coverage in the coverage run configuration.
- Fixed a typo in the main module check to ensure proper execution.
This commit is contained in:
Gabriel Luiz Freitas Almeida
2025-10-14 18:55:36 -03:00
committed by GitHub
parent c6a3bdbbab
commit 2a6461560d
5 changed files with 80 additions and 19 deletions

View File

@ -168,6 +168,27 @@ jobs:
env:
DO_NOT_TRACK: true # disable telemetry reporting
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: matrix.python-version == '3.10'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./src/lfx/coverage.xml
flags: lfx
name: lfx-coverage
fail_ci_if_error: false
directory: ./src/lfx/
- name: Upload coverage artifacts
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.10'
with:
name: lfx-coverage-report
path: |
src/lfx/coverage.xml
src/lfx/htmlcov/
retention-days: 30
test-cli:
name: Test CLI - Python ${{ matrix.python-version }}
runs-on: ${{ (inputs['runs-on'] && startsWith(format('{0}', inputs['runs-on']), '[') && fromJSON(inputs['runs-on'])) || inputs['runs-on'] || github.event.inputs['runs-on'] || 'ubuntu-latest' }}