diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index bbb9f1a602..410196ac8f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -114,6 +114,22 @@ jobs: exit 1 fi + - name: Generate coverage XML + if: always() + run: | + uv run coverage xml --rcfile=.coveragerc + + - name: Upload coverage to Codecov + if: always() + uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5 + with: + files: ./coverage.xml + flags: python-${{ matrix.python-version }} + env_vars: MATRIX_TEST + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + MATRIX_TEST: ${{ matrix.test }} + - name: remove slashes from test name run: | test=$(echo ${{ matrix.test }} | sed 's/\//__/g') @@ -126,47 +142,3 @@ jobs: include-hidden-files: true name: Snapshot Report ${{ env.test }} path: ./snapshot_report.html - - - name: Upload coverage - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 - with: - include-hidden-files: true - name: coverage_py${{ matrix.python-version }}_${{ env.test }} - path: .coverage - - coverage: - needs: test - runs-on: - - runs-on=${{ github.run_id }}-coverage - - runner=2cpu-linux-x64 - steps: - - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6 - - name: Set up Python 3.14 - uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6 - with: - python-version: "3.14" - - - name: Install coverage - run: pip install coverage - - - name: move coveragerc file up - run: | - mv .github/.coveragerc . - - - name: Download all artifacts - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6 - with: - pattern: coverage_* - - - name: Run coverage - run: | - coverage combine --keep coverage_*/.coverage* - coverage report - coverage xml - - - uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5 - with: - files: coverage.xml - disable_search: true # we already know the file to upload - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index dac1598d91..fe11ab2ef4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Switch from pre-commit to prek for pre-commit hooks in development([#3899](https://github.com/nf-core/tools/pull/3899)) - switch to uv and pyproject.toml ([#3925](https://github.com/nf-core/tools/pull/3925)) - Pin j178/prek-action action to 91fd7d7 ([#3931](https://github.com/nf-core/tools/pull/3931)) +- Simplify coverage reporting in pytest.yml ([#3934](https://github.com/nf-core/tools/pull/3934)) - add pre-commit hook to keep uv.lock in sync ([#3933](https://github.com/nf-core/tools/pull/3933)) ### Template