Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Codecov support for better code coverage tracking #315

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,24 @@ jobs:
run: |
set -o pipefail
source /usr/local/Modules/init/sh
pytest --cov=. --cov-report html -cov-config=jade.coveragerc | tee pytest_output.log
pytest --cov=. -cov-config=jade.coveragerc --cov-report xml
env:
ACCESS_TOKEN_GITHUB: ${{ secrets.ACCESS_TOKEN_GITHUB }}

# Activate environment and run pytest
- name: Testing - Windows
if: runner.os == 'Windows'
run: |
pytest --cov=. --cov-report html -cov-config="jade.coveragerc" | tee pytest_output.log
pytest
env:
ACCESS_TOKEN_GITHUB: ${{ secrets.ACCESS_TOKEN_GITHUB }}

- name: Archive test results
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest_output_${{matrix.os}}_${{matrix.python-version}}.log
path: pytest_output.log

- name: Archive test coverage
if: always()
uses: actions/upload-artifact@v4

# Upload coverage to Codecov. Do it only for one case of the matrix.
- name: Upload coverage to Codecov
# do it only once for python 3.10
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
name: htmlcov${{matrix.os}}_${{matrix.python-version}}
path: htmlcov/
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Testing](https://github.com/JADE-V-V/JADE/actions/workflows/pytest.yml/badge.svg?branch=master)](https://github.com/JADE-V-V/JADE/actions/workflows/pytest.yml)
[![Documentation Status](https://readthedocs.org/projects/jade-a-nuclear-data-libraries-vv-tool/badge/?version=latest)](https://jade-a-nuclear-data-libraries-vv-tool.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/JADE-V-V/JADE/graph/badge.svg?token=C0Q75M9FVH)](https://codecov.io/gh/JADE-V-V/JADE)

<img src="https://user-images.githubusercontent.com/25747626/118662537-5f124900-b7f0-11eb-8d69-282305f795c4.png" width="300" />

Expand Down
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# sample regex patterns
ignore:
- "tests" # ignore folders and all its contents
6 changes: 3 additions & 3 deletions jade.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
[run]
omit =
# No need to cover the test files
tests/*
*/tests/*
# The following are not developed directly by JADE
MCTAL_READER2.py
xsdirpyne.py
*/MCTAL_READER2.py
*/xsdirpyne.py
[html]
show_contexts = True