forked from guywithnose/release-notes
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.php
More file actions
executable file
·29 lines (24 loc) · 770 Bytes
/
build.php
File metadata and controls
executable file
·29 lines (24 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env php
<?php
chdir(__DIR__);
$returnStatus = null;
passthru('composer install --optimize-autoloader', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
passthru('./vendor/bin/phpcs -n', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
passthru('./vendor/bin/phpunit --coverage-clover clover.xml --coverage-html coverage tests', $returnStatus);
if ($returnStatus !== 0) {
exit(1);
}
$xml = new SimpleXMLElement(file_get_contents('clover.xml'));
foreach ($xml->xpath('//file/metrics') as $metric) {
if ((int)$metric['elements'] !== (int)$metric['coveredelements']) {
file_put_contents('php://stderr', "Code coverage was NOT 100% but we need to get there ASAP\n");
exit(0);
}
}
echo "Code coverage was 100%\n";