Skip to content

Commit ebf8db5

Browse files
committed
Enforce 100% line coverage with detailed checks
1 parent 14c536a commit ebf8db5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/coverage.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
coverage:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v5
11+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
1212
with:
1313
persist-credentials: false
1414

@@ -22,4 +22,11 @@ jobs:
2222
run: composer install --no-interaction --prefer-dist
2323

2424
- name: Run tests with coverage
25-
run: vendor/bin/phpunit --coverage-text --min=100
25+
run: |
26+
vendor/bin/phpunit --coverage-clover coverage.xml
27+
LINE_RATE=$(php -r '$x = simplexml_load_file("coverage.xml"); $m = $x->project->metrics; $pct = round((int)$m["coveredstatements"] / (int)$m["statements"] * 100, 2); echo $pct;')
28+
echo "Line coverage: ${LINE_RATE}%"
29+
if [ "$LINE_RATE" != "100" ]; then
30+
echo "::error::Line coverage is ${LINE_RATE}%, required 100%"
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)