Skip to content

Commit

Permalink
Adding code coverage comment in the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachinbisht27 committed Sep 13, 2023
1 parent b28bdc3 commit 8e43206
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/unit-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,21 @@ jobs:
- name: Run Test Suit
run: |
vendor/bin/phpunit --coverage-clover coverage.xml --cov > coverage.txt
vendor/bin/phpunit --coverage-clover coverage.xml
- name: Convert Coverage to HTML
- name: Print Coverage report
run: |
php-coveralls/php-coveralls coverage:clover --output coverage-html
coverage.xml --cov > coverage.txt
cat coverage.txt
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

- name: Post Code Coverage Comment
run: |
echo "Code Coverage Report"
echo "Code Coverage Report" > coverage_comment.txt
echo "![Coverage](https://img.shields.io/badge/coverage-$(grep -oP 'covered="(\K[^"]+)' coverage.xml)%25-brightgreen)" >> coverage_comment.txt
echo "Coverage details are available [here](./coverage.txt)." >> coverage_comment.txt
echo "Coverage details are available [here](./coverage.xml)." >> coverage_comment.txt
# Post the comment using the GitHub API with PR number directly
curl -X POST \
Expand Down

0 comments on commit 8e43206

Please sign in to comment.