Skip to content

Commit

Permalink
coverage check
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4git committed Aug 20, 2024
1 parent 4524268 commit 3c57c17
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions check_coverage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

$xmlContent = file_get_contents('.coverage/cobertura.xml');
$matches = [];
preg_match("#coverage line-rate=\"(.*)\" branch-rate#", $xmlContent, $matches);

$coverage = (int) ((float) $matches[1] * 1000)/10.0;

echo "Coverage: " . $coverage . "%\n";

if ($coverage < 80) {
echo "Test coverage is below 80%\n";
exit(1); // Gibt einen Fehlercode zurück, der den Build fehlschlagen lässt
}

echo "Test coverage is sufficient.\n";
exit(0);

0 comments on commit 3c57c17

Please sign in to comment.