-
Notifications
You must be signed in to change notification settings - Fork 13
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 option to generate test coverage report without codecov #207
base: main
Are you sure you want to change the base?
add option to generate test coverage report without codecov #207
Conversation
8a31636
to
fba02a5
Compare
I tried this out on sunpy and it seems to explode. sunpy/sunpy#7668 |
It seems that it's not picking up the coverage.xml to upload here: https://github.com/sunpy/sunpy/actions/runs/9445798095/job/26014155532?pr=7668#step:14:16 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for taking a swing at this!
.github/workflows/tox.yml
Outdated
- run: python -Im pip install --upgrade coverage[toml] | ||
- run: python -Im coverage combine | ||
- run: python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to add the ability to fail this job based on either total coverage % or diff coverage %.
tl;dr -- this does not generate patch coverage, right? |
Not yet, but I found a way to make it. |
For patch coverage we'd need to store the coverage from |
325b539
to
156160e
Compare
I am trying this out too at spacetelescope/acstools#205 and it still crashes: https://github.com/spacetelescope/acstools/actions/runs/9463279566/job/26068438067?pr=205 |
oh whoops, I fixed the artifact issue: |
d8c63d1
to
c5b70cf
Compare
c5b70cf
to
f891927
Compare
f891927
to
430ed7e
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Even when CI passes, it failed with the same error.
|
it should be uploading / downloading the |
it looks like pytest --pyargs acstools --cov-report=xml --cov=acstools /home/runner/work/acstools/acstools/doc --cov --remote-data -v |
running
|
What is the difference between |
I'm not intimately familiar with it, but as far as I know We could use |
Tried to debug at #209 but no luck. I see the coverage ran but the the upload failed: https://github.com/spacetelescope/acstools/actions/runs/9483014271/job/26134042811?pr=205 |
could you also add |
Ah, yes, added. New log: https://github.com/spacetelescope/acstools/actions/runs/9483014271/job/26138000458?pr=205 |
for more information, see https://pre-commit.ci
242272f
to
88ebba9
Compare
.github/workflows/tox.yml
Outdated
|
||
- if: ${{ (success() || failure()) && contains(matrix.coverage, 'github') && matrix.pytest == 'true' }} | ||
name: add run info to coverage filename | ||
run: mv $(find ~ -name .coverage) .coverage.${{ github.sha }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.toxenv }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to be having trouble with this line.
I am trying this out on the dkist repo: DKISTDC/dkist#471 and by default tox puts .coverage
in the .tmp/py312/
directory. Even if I move the .coverage
file up into the root repo directory this still doesn't seem to find it.
Should this in fact be this:
run: mv $(find ~ -name .coverage) .coverage.${{ github.sha }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.toxenv }} | |
run: mv $(find . -name .coverage) .coverage.${{ github.sha }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.toxenv }} |
i.e. look in the current directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good catch, it should be using the working directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I can't figure out is if there's an way of doing the equivalent of this:
rf"--cov-report=xml:${{GITHUB_WORKSPACE}}{sep}coverage.xml ")
Where we can set the .coverage path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coverage
makes a .coverage
database by default, if you don't specify a --cov-report
type. I don't think you can set a location for .coverage
though. You CAN specify --cov-report=
to be html xml json lcov annotate
(see https://pytest-cov.readthedocs.io/en/latest/reporting.html), but as far as I can tell the markdown table generator (python -Im coverage report -i -m --format=markdown
) can only ingest the .coverage
database so another format report is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's the inability to specify the path of the coverage db that seems to be a problem.
Even with the last commit I don't seem to be finding the db file: https://github.com/DKISTDC/dkist/actions/runs/12161554758/job/33916444661?pr=471#step:14:1
Testing this out locally seems to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you don't mind, but I pushed a couple of experimental commits to make it search from the root workspace dir down. Let's see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok well the plot thickens: https://github.com/DKISTDC/dkist/actions/runs/12161554758/job/33918322027#step:14:1
The find command finds the file, but then it fails to upload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah! Maybe add an ls
in there to see if the mv
command actually worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to go a different way and let the upload action figure it out: https://github.com/DKISTDC/dkist/actions/runs/12161554758/job/33921111684#step:14:16
It did not go well.
Co-authored-by: Stuart Mumford <[email protected]>
pre-commit.ci autofix |
using the guide here: https://hynek.me/articles/ditch-codecov-python/
This does not create coverage diffs or report to PRs, just creates a markdown summary table
closes #189
EDIT: here's what the summary table looks like: