Skip to content

Commit

Permalink
Add coverage comment to test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
owenlamont committed Dec 17, 2024
1 parent 690d512 commit 2b06844
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,27 @@ jobs:
python-version-file: ".python-version"
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests
run: uv run pytest tests
- name: Run tests with Coverage
run: uv run pytest tests --cov=. --cov-report=term > coverage_summary.txt
- name: Prepare Comment Body
run: |
echo '### Coverage Report' >> comment_body.md
echo '```txt' >> comment_body.md
cat coverage_summary.txt >> comment_body.md
echo '' >> comment_body.md
echo '```' >> comment_body.md
- name: Find Coverage Report Comment
id: find-comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: github-actions[bot]
body-includes: '### Coverage Report'
- name: Create or Update Coverage Comment
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-path: comment_body.md
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace

0 comments on commit 2b06844

Please sign in to comment.