Skip to content

Commit 68529d4

Browse files
Merge pull request #548 from microsoft/psl-add-coverage-pr-comment
feat: Add pytest coverage comment to PRs
2 parents 75b3770 + 4adc353 commit 68529d4

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
@@ -37,6 +37,7 @@ on:
3737
permissions:
3838
contents: read
3939
actions: read
40+
pull-requests: write
4041
jobs:
4142
backend_tests:
4243
runs-on: ubuntu-latest
@@ -73,7 +74,19 @@ jobs:
7374
if: env.skip_backend_tests == 'false'
7475
run: |
7576
cd src/tests/ContentProcessor
76-
python -m pytest . --ignore=libs/test_models_and_entities.py --ignore=libs/test_utils_coverage_boost.py --ignore=libs/test_final_push_80.py --cov-config=.coveragerc --cov=../../ContentProcessor/src --cov-report=xml --cov-report=term --cov-fail-under=80
77+
python -m pytest . --ignore=libs/test_models_and_entities.py --ignore=libs/test_utils_coverage_boost.py --ignore=libs/test_final_push_80.py --cov-config=.coveragerc --cov=../../ContentProcessor/src --cov-report=xml --cov-report=term --cov-fail-under=80 --junitxml=pytest.xml
78+
79+
- name: Pytest Coverage Comment
80+
if: |
81+
always() &&
82+
github.event_name == 'pull_request' &&
83+
github.event.pull_request.head.repo.fork == false &&
84+
env.skip_backend_tests == 'false'
85+
uses: MishaKav/pytest-coverage-comment@26f986d2599c288bb62f623d29c2da98609e9cd4 # v1.6.0
86+
with:
87+
pytest-xml-coverage-path: src/tests/ContentProcessor/coverage.xml
88+
junitxml-path: src/tests/ContentProcessor/pytest.xml
89+
report-only-changed-files: true
7790

7891
- name: Skip Backend Tests
7992
if: env.skip_backend_tests == 'true'

0 commit comments

Comments
 (0)