Skip to content

Commit e228575

Browse files
committed
✨ chore: Update GitHub Actions workflow for pytest coverage reporting
- Adjusted paths for pytest coverage output and JUnit XML to reflect the correct directory structure. - Added a step to update the README.md with the latest coverage information and commit the changes automatically.
1 parent 1c94374 commit e228575

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/lint-and-test.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,20 @@ jobs:
4646
- name: Run tests
4747
run: |
4848
cd backend
49-
YET_ANOTHER_CALENDAR_TUTOR_SECRET_KEY='test' uv run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov-fail-under=80 --cov=yet_another_calendar/web yet_another_calendar/tests/* | tee pytest-coverage.txt
50-
49+
YET_ANOTHER_CALENDAR_TUTOR_SECRET_KEY='test' uv run pytest --junitxml=../pytest.xml --cov-report=term-missing:skip-covered --cov-fail-under=80 --cov=yet_another_calendar/web yet_another_calendar/tests/* | tee ../pytest-coverage.txt
50+
5151
- name: Pytest coverage comment
5252
uses: MishaKav/pytest-coverage-comment@main
5353
with:
54-
pytest-coverage-path: ./backend/pytest-coverage.txt
55-
junitxml-path: ./backend/pytest.xml
56-
54+
pytest-coverage-path: ./pytest-coverage.txt
55+
junitxml-path: ./pytest.xml
5756

58-
- name: Coverage comment
59-
uses: MishaKav/pytest-coverage-comment@main
57+
- name: Update README
58+
run: |
59+
sed -i '/<!-- Pytest Coverage Comment:Begin -->/,/<!-- Pytest Coverage Comment:End -->/c\<!-- Pytest Coverage Comment:Begin -->\n${{ steps.coverage.outputs.coverageHtml }}\n<!-- Pytest Coverage Comment:End -->' ./README.md
60+
61+
- name: Commit changes
62+
uses: stefanzweifel/git-auto-commit-action@v5
6063
with:
61-
pytest-coverage-path: ./backend/pytest-coverage.txt
62-
junitxml-path: ./backend/pytest.xml
64+
commit_message: 'docs: update coverage badge'
65+
file_pattern: README.md

0 commit comments

Comments
 (0)