V3lop5
October 15, 2021, 11:10am
1
Description
I use the latest version of codecov github action trying to upload the coverage.xml generated by pytest. On Codecov I receive the error message " There was an error processing coverage reports."
Commit SHAs
85802c7ee81c62970fc46e1e8a533b17fb68fabb
Repository
V3lop5/python-starter: Kickstart your python project! (github.com)
CI/CD or Build URL
Update main.yml · V3lop5/python-starter@85802c7 (github.com)
Uploader
GitHub Actions
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: test-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements**.txt') }}
- name: Install requirements
run: |
pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
- name: Run tests
run: |
pytest --cov=./ --cov-report=xml --junitxml="result.xml" ./tests
- name: Upload tests results
uses: actions/upload-artifact@v2
if: always()
with:
name: test-results
path: |
coverage.xml
result.xml
uplaod_coverage_results:
needs: test
runs-on: ubuntu-latest
name: "Upload code coverage"
if: always()
steps:
- name: Download tests results
uses: actions/download-artifact@v2
with:
name: test-results
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
with:
file: ./coverage.xml
flags: pytest
fail_ci_if_error: true
Codecov Output
The output of run Update main.yml · V3lop5/python-starter@85802c7 (github.com) :
Run codecov/codecov-action@v2.1.0
with:
file: ./coverage.xml
flags: pytest
fail_ci_if_error: true
==> linux OS detected
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
==> SHASUM file signed by key id 806bb28aed779869
==> Uploader SHASUM verified (6917761e7e822657ff453d69615c21838aea408009f3278b46d91602813eea86 codecov)
==> Running version latest
==> Running version v0.1.6
/home/runner/work/_actions/codecov/codecov-action/v2.1.0/dist/codecov -n -Q github-action-2.1.0 -Z -f ./coverage.xml -F pytest
[2021-10-15T10:55:53.681Z] ['info']
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Codecov report uploader 0.1.6
[2021-10-15T10:55:53.696Z] ['info'] => Project root located at: /home/runner/work/python-starter/python-starter
[2021-10-15T10:55:53.697Z] ['info'] -> No token specified or token is empty
[2021-10-15T10:55:53.704Z] ['info'] Searching for coverage files...
[2021-10-15T10:55:53.709Z] ['info'] => Found 1 possible coverage files:
./coverage.xml
[2021-10-15T10:55:53.709Z] ['info'] Processing ./coverage.xml...
[2021-10-15T10:55:53.711Z] ['info'] Detected GitHub Actions as the CI provider.
[2021-10-15T10:55:53.711Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.1.6&token=*******&branch=main&build=1345627329&build_url=https%3A%2F%2Fgithub.com%2FV3lop5%2Fpython-starter%2Factions%2Fruns%2F1345627329&commit=85802c7ee81c62970fc46e1e8a533b17fb68fabb&job=CI%2FCD+main&pr=&service=github-actions&slug=V3lop5%2Fpython-starter&name=&tag=&flags=pytest&parent=
[2021-10-15T10:55:54.221Z] ['info'] Uploading...
[2021-10-15T10:55:54.465Z] ['info'] {"status":"success","resultURL":"https://codecov.io/github/V3lop5/python-starter/commit/85802c7ee81c62970fc46e1e8a533b17fb68fabb"}
Expected Results
Able to see code coverage on codecov.
Actual Results
The codecov page showing the error message:
Additional Information
You can download the coverage.xml uploaded by the action here:
https://github.com/V3lop5/python-starter/suites/4063595855/artifacts/103220202
tom
October 18, 2021, 2:45pm
2
@V3lop5 the coverage file ./coverage.xml
seems to be empty. Can you try uploading to Codecov without the file
specified? Also, to debug, could you run cat ./coverage.xml
to make sure that the coverage file is populated?
V3lop5
October 19, 2021, 7:32am
3
Hi @tom , thank you for looking into it.
I updated my workflow as you wish. See the run here:
I changed:
- name: Check files
run: |
cat ./coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2.1.0
with:
flags: pytest
fail_ci_if_error: true
The output:
Run cat ./coverage.xml
4
<?xml version="1.0" ?>
5
<coverage version="6.0.2" timestamp="1634628077877" lines-valid="42" lines-covered="26" line-rate="0.619" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
6
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
7
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
8
<sources>
9
<source>/home/runner/work/python-starter/python-starter</source>
10
</sources>
11
<packages>
12
<package name="." line-rate="0" branch-rate="0" complexity="0">
13
<classes>
14
<class name="setup.py" filename="setup.py" complexity="0" line-rate="0" branch-rate="0">
15
<methods/>
16
<lines>
17
<line number="3" hits="0"/>
18
<line number="5" hits="0"/>
19
</lines>
20
</class>
21
</classes>
22
</package>
23
<package name="counter" line-rate="0.1667" branch-rate="0" complexity="0">
24
<classes>
25
<class name="__init__.py" filename="counter/__init__.py" complexity="0" line-rate="1" branch-rate="0">
26
<methods/>
27
<lines>
28
<line number="6" hits="1"/>
29
</lines>
30
</class>
31
<class name="__main__.py" filename="counter/__main__.py" complexity="0" line-rate="0" branch-rate="0">
32
<methods/>
33
<lines>
34
<line number="7" hits="0"/>
35
<line number="10" hits="0"/>
36
<line number="11" hits="0"/>
37
<line number="14" hits="0"/>
38
<line number="15" hits="0"/>
39
</lines>
40
</class>
41
</classes>
42
</package>
43
<package name="counter.core" line-rate="1" branch-rate="0" complexity="0">
44
<classes>
45
<class name="__init__.py" filename="counter/core/__init__.py" complexity="0" line-rate="1" branch-rate="0">
46
<methods/>
47
<lines>
48
<line number="1" hits="1"/>
49
</lines>
50
</class>
51
<class name="counter.py" filename="counter/core/counter.py" complexity="0" line-rate="1" branch-rate="0">
52
<methods/>
53
<lines>
54
<line number="1" hits="1"/>
55
<line number="4" hits="1"/>
56
<line number="5" hits="1"/>
57
<line number="6" hits="1"/>
58
<line number="7" hits="1"/>
59
<line number="8" hits="1"/>
60
<line number="10" hits="1"/>
61
<line number="11" hits="1"/>
62
<line number="13" hits="1"/>
63
<line number="14" hits="1"/>
64
</lines>
65
</class>
66
</classes>
67
</package>
68
<package name="counter.web" line-rate="0" branch-rate="0" complexity="0">
69
<classes>
70
<class name="__init__.py" filename="counter/web/__init__.py" complexity="0" line-rate="0" branch-rate="0">
71
<methods/>
72
<lines>
73
<line number="1" hits="0"/>
74
</lines>
75
</class>
76
<class name="app.py" filename="counter/web/app.py" complexity="0" line-rate="0" branch-rate="0">
77
<methods/>
78
<lines>
79
<line number="1" hits="0"/>
80
<line number="2" hits="0"/>
81
<line number="4" hits="0"/>
82
<line number="7" hits="0"/>
83
<line number="8" hits="0"/>
84
<line number="9" hits="0"/>
85
<line number="10" hits="0"/>
86
<line number="11" hits="0"/>
87
</lines>
88
</class>
89
</classes>
90
</package>
91
<package name="tests" line-rate="1" branch-rate="0" complexity="0">
92
<classes>
93
<class name="__init__.py" filename="tests/__init__.py" complexity="0" line-rate="1" branch-rate="0">
94
<methods/>
95
<lines/>
96
</class>
97
<class name="test_counter.py" filename="tests/test_counter.py" complexity="0" line-rate="1" branch-rate="0">
98
<methods/>
99
<lines>
100
<line number="1" hits="1"/>
101
<line number="3" hits="1"/>
102
<line number="6" hits="1"/>
103
<line number="7" hits="1"/>
104
<line number="11" hits="1"/>
105
<line number="14" hits="1"/>
106
<line number="15" hits="1"/>
107
<line number="16" hits="1"/>
108
<line number="19" hits="1"/>
109
<line number="20" hits="1"/>
110
<line number="21" hits="1"/>
111
<line number="24" hits="1"/>
112
<line number="25" hits="1"/>
113
<line number="26" hits="1"/>
114
</lines>
115
</class>
116
</classes>
117
</package>
118
</packages>
119
</coverage>
Run codecov/codecov-action@v2.1.0
5
==> linux OS detected
6
https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
7
==> SHASUM file signed by key id 806bb28aed779869
8
==> Uploader SHASUM verified (6917761e7e822657ff453d69615c21838aea408009f3278b46d91602813eea86 codecov)
9
==> Running version latest
10
==> Running version v0.1.6
11
/home/runner/work/_actions/codecov/codecov-action/v2.1.0/dist/codecov -n -Q github-action-2.1.0 -Z -F pytest
12
[2021-10-19T07:21:50.811Z] ['info']
13
_____ _
14
/ ____| | |
15
| | ___ __| | ___ ___ _____ __
16
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
17
| |___| (_) | (_| | __/ (_| (_) \ V /
18
\_____\___/ \__,_|\___|\___\___/ \_/
19
20
Codecov report uploader 0.1.6
21
[2021-10-19T07:21:50.833Z] ['info'] => Project root located at: /home/runner/work/python-starter/python-starter
22
[2021-10-19T07:21:50.834Z] ['info'] -> No token specified or token is empty
23
[2021-10-19T07:21:50.843Z] ['info'] Searching for coverage files...
24
[2021-10-19T07:21:50.856Z] ['info'] => Found 1 possible coverage files:
25
coverage.xml
26
[2021-10-19T07:21:50.856Z] ['info'] Processing /home/runner/work/python-starter/python-starter/coverage.xml...
27
[2021-10-19T07:21:50.861Z] ['info'] Detected GitHub Actions as the CI provider.
28
[2021-10-19T07:21:50.863Z] ['info'] Pinging Codecov: https://codecov.io/upload/v4?package=github-action-2.1.0-uploader-0.1.6&token=*******&branch=main&build=1358041191&build_url=https%3A%2F%2Fgithub.com%2FV3lop5%2Fpython-starter%2Factions%2Fruns%2F1358041191&commit=5730548c6fc5c2c01980a25c0c2b8f9480ad7eaa&job=CI%2FCD+main&pr=&service=github-actions&slug=V3lop5%2Fpython-starter&name=&tag=&flags=pytest&parent=
29
[2021-10-19T07:21:51.526Z] ['info'] Uploading...
30
[2021-10-19T07:21:51.717Z] ['info'] {"status":"success","resultURL":"https://codecov.io/github/V3lop5/python-starter/commit/5730548c6fc5c2c01980a25c0c2b8f9480ad7eaa"}
Still get the error message: Code coverage done right.
tom
October 19, 2021, 2:01pm
4
@V3lop5 ah! got it. I think you need run an actions/checkout
step in this run. Also, I would highly recommend installing the Codecov GitHub app .
V3lop5
October 19, 2021, 3:27pm
5
@tom thanks!
The actions/checkout did the trick!
Github Run Update main.yml · V3lop5/python-starter@fe7b372 (github.com)
Codecov looks good: Commit ⋅ V3lop5/python-starter (codecov.io)
The Codecov bot looks nice, I ll give it a try!
1 Like