Skip to content

Commit e098d47

Browse files
Add pytest coverage comment to PRs
Add MishaKav/pytest-coverage-comment action to post code coverage summary as a PR comment. Changes include: - Add pull-requests: write permission - Add --junitxml=pytest.xml flag for test summary - Add coverage comment step with per-file breakdown Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e9891d7 commit e098d47

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Test Workflow with Coverage - Code-Gen
22
permissions:
33
contents: read
44
actions: read
5+
pull-requests: write
56
on:
67
push:
78
branches:
@@ -112,10 +113,22 @@ jobs:
112113
if: env.skip_backend_tests == 'false'
113114
run: |
114115
cd src
115-
pytest tests/backend --cov=backend --cov-report=term-missing --cov-report=xml --cov-fail-under=80
116+
pytest tests/backend --cov=backend --cov-report=term-missing --cov-report=xml --cov-fail-under=80 --junitxml=pytest.xml
116117
117118
118119
120+
- name: Pytest Coverage Comment
121+
if: |
122+
always() &&
123+
github.event_name == 'pull_request' &&
124+
github.event.pull_request.head.repo.fork == false &&
125+
env.skip_backend_tests == 'false'
126+
uses: MishaKav/pytest-coverage-comment@26f986d2599c288bb62f623d29c2da98609e9cd4 # v1.6.0
127+
with:
128+
pytest-xml-coverage-path: src/coverage.xml
129+
junitxml-path: src/pytest.xml
130+
report-only-changed-files: true
131+
119132
- name: Skip Backend Tests
120133
if: env.skip_backend_tests == 'true'
121134
run: |

0 commit comments

Comments
 (0)