Skip to content

Commit 14c2fe5

Browse files
committed
Store the code coverage files on each test run for CI.
1 parent 0397b95 commit 14c2fe5

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ jobs:
7070
DB_PASSWORD: debug_toolbar
7171
DB_HOST: 127.0.0.1
7272
DB_PORT: 3306
73+
COVERAGE_FILE: ".coverage.mysql.${{ matrix.python_version }}"
74+
75+
- name: Store coverage file
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: coverage-mysql-${{ matrix.python_version }}
79+
path: .coverage.mysql.${{ matrix.python_version }}
80+
include-hidden-files: true
7381

7482

7583
postgres:
@@ -163,6 +171,14 @@ jobs:
163171
DB_HOST: localhost
164172
DB_PORT: 5432
165173
DJANGO_SELENIUM_TESTS: ${{ matrix.env.DJANGO_SELENIUM_TESTS }}
174+
COVERAGE_FILE: ".coverage.postgres.${{ matrix.python_version }}"
175+
176+
- name: Store coverage file
177+
uses: actions/upload-artifact@v4
178+
with:
179+
name: coverage-postgres-${{ matrix.python_version }}
180+
path: .coverage.postgres.${{ matrix.python_version }}
181+
include-hidden-files: true
166182

167183
sqlite:
168184
runs-on: ubuntu-latest
@@ -207,6 +223,14 @@ jobs:
207223
env:
208224
DB_BACKEND: sqlite3
209225
DB_NAME: ":memory:"
226+
COVERAGE_FILE: ".coverage.sqlite.${{ matrix.python_version }}"
227+
228+
- name: Store coverage file
229+
uses: actions/upload-artifact@v4
230+
with:
231+
name: coverage-sqlite-${{ matrix.python_version }}
232+
path: .coverage.sqlite.${{ matrix.python_version }}
233+
include-hidden-files: true
210234

211235
lint:
212236
runs-on: ubuntu-latest
@@ -244,3 +268,38 @@ jobs:
244268
245269
- name: Test with tox
246270
run: tox -e docs,packaging
271+
272+
coverage:
273+
name: Coverage
274+
runs-on: ubuntu-latest
275+
needs:
276+
- mysql
277+
- postgres
278+
- sqlite
279+
permissions:
280+
pull-requests: write
281+
contents: write
282+
steps:
283+
- uses: actions/checkout@v4
284+
with:
285+
persist-credentials: false
286+
287+
- uses: actions/download-artifact@v4
288+
id: download
289+
with:
290+
pattern: coverage-*
291+
merge-multiple: true
292+
293+
- name: Coverage comment
294+
id: coverage_comment
295+
uses: py-cov-action/python-coverage-comment-action@6494290850a5098c2836298dad8f11082b4ceaa9 # v3
296+
with:
297+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
298+
MERGE_COVERAGE_FILES: true
299+
300+
- name: Store Pull Request comment to be posted
301+
uses: actions/upload-artifact@v4
302+
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
303+
with:
304+
name: python-coverage-comment-action
305+
path: python-coverage-comment-action.txt

docs/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Pending
66

77
* Deprecated ``RedirectsPanel`` in favor of ``HistoryPanel`` for viewing
88
toolbar data from redirected requests.
9+
* Fixed support for generating code coverage comments in PRs.
910

1011
6.1.0 (2025-10-30)
1112
------------------

0 commit comments

Comments
 (0)