Skip to content

Commit f19a091

Browse files
authored
build: fix Codecov unable to process coverage reports (#52)
The coverage reports (cobertura format) were silently erroring in Codecov's servers due to being unable to compare them against the source code. This was due to the `codecov` CLI being unable to normalize the reports (XML) as it didn't find a source code or paths that matched what it was seeing inside the XML file, e.g., it would see `/home/runner/work/pytest-django-queries/pytest-django-queries/src` in the XML files but without checkout, it wasn't able to read that file thus leading to corrupt coverage reports being uploaded.
1 parent 7426da5 commit f19a091

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

.github/workflows/test.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,18 @@ jobs:
101101
|| github.event.pull_request.head.repo.full_name == 'NyanKiyoshi/pytest-django-queries'
102102
}}
103103
runs-on: ubuntu-latest
104-
permissions: {}
105104
environment: codecov
105+
permissions:
106+
contents: read
106107

107108
needs: test
108109

109110
steps:
111+
# Codecov needs to be able to map the coverage against local files,
112+
# thus we need to checkout.
113+
- name: Checkout
114+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
115+
110116
- name: Download Reports
111117
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
112118
with:
@@ -132,11 +138,17 @@ jobs:
132138
)
133139
}}
134140
runs-on: ubuntu-latest
135-
permissions: {}
141+
permissions:
142+
contents: read
136143

137144
needs: test
138145

139146
steps:
147+
# Codecov needs to be able to map the coverage against local files,
148+
# thus we need to checkout.
149+
- name: Checkout
150+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
151+
140152
- name: Download Reports
141153
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
142154
with:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ dev = [
5959
"sphinx-rtd-theme",
6060
]
6161
test = [
62-
"codecov",
6362
"coverage",
6463
"pytest-xdist",
6564
]

uv.lock

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)