I use /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
but I think the path is not correct. My report is not uploading on GitHub Actions.
Asked
Active
Viewed 529 times
1

Eftal Gezer
- 191
- 1
- 8
2 Answers
1
The coverage file is located at /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
. In general, it is /home/runner/work/<project>/<project>/coverage.xml
.
I solved it with the following code.
- name: Generate Report
run: |
pip install codecov
pip install pytest-cov
pytest --cov=./ --cov-report=xml
codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
files: /home/runner/work/SIESTAstepper/SIESTAstepper/coverage.xml
flags: tests
Full code is here.

Eftal Gezer
- 191
- 1
- 8
-
Good feedback. Upvoted. I have edited my answer accordingly. – VonC Sep 19 '22 at 19:36
0
From your last run, check if the "Upload coverage to CodeCov" is actually executed.
The workflow seems to stop before that, in the test with pytest
step:
/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/distutils/file_util.py:44: DistutilsFileError
=========================== short test summary info ============================
FAILED tests/__main__.py::test_merge_ani - distutils.errors.DistutilsFileErro...
FAILED tests/tests.py::test_merge_ani - distutils.errors.DistutilsFileError: ...
========================= 2 failed, 30 passed in 4.23s =========================
If it does not stop before that, you need to check if the file is indeed created, considering the error message is:
None of the following appear to exist as files: ./coverage.xml

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
Yes, I am aware of that. The test fails. But the tests which do not fail do not upload the coverage report. https://github.com/eftalgezer/SIESTAstepper/actions/runs/3077712442/jobs/4972763464 – Eftal Gezer Sep 19 '22 at 09:33
-
This is the latest run: https://github.com/eftalgezer/SIESTAstepper/actions/runs/3081602423/jobs/4980339719 – Eftal Gezer Sep 19 '22 at 10:20
-
@EftalGezer "None of the following appear to exist as files: ./coverage.xml": Can you add steps to do a `pwd`, `ls -alrth`, and a `cat ./coverage.xml`? That way we will know if the file were there (and where ('there' is) – VonC Sep 19 '22 at 12:14
-
The coverage report was not created. I have solved it, it works now. I am adding it as an answer. – Eftal Gezer Sep 19 '22 at 16:24