Skip to content

Commit

Permalink
refactor: rename coverage.php to more explaining name and add comment…
Browse files Browse the repository at this point in the history
… what it does
  • Loading branch information
Orkuncakilkaya committed Sep 3, 2024
1 parent 9f4bd04 commit 63332de
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Create coverage report for PR
id: pr_coverage
run: |
php ./coverage.php
php ./generate_coverage_report.php
COVERAGE_PR=$(jq -r '.total.statements.pct' cov/json/index.json)
echo "COVERAGE_PR=$COVERAGE_PR" >> $GITHUB_ENV
- name: Upload coverage report markdown
Expand Down Expand Up @@ -67,8 +67,8 @@ jobs:
run: |
COVERAGE_BASE=0
if [ -f "./coverage.php" ]; then
php ./coverage.php
if [ -f "./generate_coverage_report.php" ]; then
php ./generate_coverage_report.php
fi
if [ -f "cov/json/index.json" ]; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: PHPUnit
run: docker-compose run --user "$(id -u):$(id -g)" phpunit
- name: "Parse Coverage"
run: "php ./coverage.php"
run: "php ./generate_coverage_report.php"
- name: Create Coverage Badges
uses: jaywcjlove/coverage-badges-cli@df58615045079f1c827de7867044bbab3ec22b43
with:
Expand Down
4 changes: 2 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ To generate a code coverage report, follow these steps:
- The Clover XML report will be saved in `cov/xml/clover.xml`.
- The HTML report will be saved in the `cov/html` directory.

2. To convert the Clover XML report into a markdown report, run the coverage.php script:
2. To convert the Clover XML report into a markdown report, run the generate_coverage_report.php script:
```shell
docker-compose run php php coverage.php
docker-compose run php php generate_coverage_report.php
```

The markdown report will be saved in the `cov/markdown/coverage_report.md` file. You can open this file to review the coverage details.
Expand Down
2 changes: 2 additions & 0 deletions coverage.php → generate_coverage_report.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

# This script generates JSON report for coverage badge github action and generates markdown report for coverage-diff github action

$outputPath = __DIR__ . "/cov/json/";
$markdownPath = __DIR__ . "/cov/markdown/";

Expand Down

0 comments on commit 63332de

Please sign in to comment.