Skip to content

Commit

Permalink
chore(coverage-diff): update diff base coverage calc and hide files s…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
Orkuncakilkaya committed Sep 2, 2024
1 parent d06c244 commit e6d46e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/coverage-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ jobs:
- name: Create coverage report for Base
id: base_coverage
run: |
php ./coverage.php
COVERAGE_BASE=$(jq -r '.total.statements.pct' cov/json/index.json)
COVERAGE_BASE=0
if [ -f "./coverage.php" ]; then
php ./coverage.php
fi
if [ -f "cov/json/index.json" ]; then
COVERAGE_BASE=$(jq -r '.total.statements.pct' cov/json/index.json)
fi
echo "COVERAGE_BASE=$COVERAGE_BASE" >> $GITHUB_ENV
- name: Compare coverage
Expand Down
5 changes: 4 additions & 1 deletion coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
$percentage
);

$markdown .= "\n## Files Coverage\n\n";
$markdown .= "\n<details>\n";
$markdown .= "<summary>Files Coverage</summary>\n\n";
$markdown .= "| File | Methods | Conditionals | Statements | Total Coverage |\n";
$markdown .= "|------|-------------------|-------------------------|------------------------|----------------|\n";

Expand All @@ -66,4 +67,6 @@
);
}

$markdown .= "\n</details>\n";

file_put_contents($markdownPath . "coverage_report.md", $markdown);

0 comments on commit e6d46e0

Please sign in to comment.