Skip to content

Commit

Permalink
Merge pull request #315 from JADE-V-V/add-codecov-support
Browse files Browse the repository at this point in the history
Add Codecov support for better code coverage tracking
  • Loading branch information
alexvalentine94 authored Sep 23, 2024
2 parents 63b6250 + b211844 commit 5590cee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
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

0 comments on commit 5590cee

Please sign in to comment.