This repository has been archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01a8a80
commit 2eb0d7e
Showing
4 changed files
with
14 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
service: travis-ci | ||
reportFile: | ||
input: | ||
type: lcov | ||
file: script/report.lcov | ||
output: script/coveralls.json | ||
repositoryDirectory: . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,12 @@ | ||
<?php | ||
|
||
namespace cloak\example; | ||
namespace cloak\reporter; | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use coverallskit\ConfigurationLoader; | ||
use coverallskit\ReportBuilderFactory; | ||
use coverallskit\entity\Coverage; | ||
use coverallskit\entity\Repository; | ||
use coverallskit\entity\SourceFile; | ||
use coverallskit\exception\LineOutOfRangeException; | ||
|
||
/** | ||
* Get the code coverage | ||
*/ | ||
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); | ||
|
||
$argv = ['../vendor/bin/pho']; | ||
|
||
require_once __DIR__ . "/../vendor/bin/pho"; | ||
|
||
$result = xdebug_get_code_coverage(); | ||
xdebug_stop_code_coverage(); | ||
|
||
/** | ||
* Generate a json file | ||
*/ | ||
$factory = new ReportBuilderFactory(new ConfigurationLoader()); | ||
|
||
$builder = $factory->createFromConfigurationFile(__DIR__ . '/../coveralls.yml'); | ||
|
||
foreach ($result as $file => $coverage) { | ||
if (preg_match('/vendor/', $file) || preg_match('/spec/', $file)) { | ||
continue; | ||
} | ||
|
||
$source = new SourceFile($file); | ||
|
||
foreach ($coverage as $line => $status) { | ||
try { | ||
if ($status === 1) { | ||
$source->addCoverage(Coverage::executed($line)); | ||
} else if ($status === -1) { | ||
$source->addCoverage(Coverage::unused($line)); | ||
} | ||
} catch (LineOutOfRangeException $exception) { | ||
echo $source->getName() . PHP_EOL; | ||
echo $exception->getMessage() . PHP_EOL; | ||
} | ||
} | ||
|
||
$builder->addSource($source); | ||
} | ||
use coverallskit\Configuration; | ||
use coverallskit\ReportBuilder; | ||
|
||
$configuration = Configuration::loadFromFile('.coveralls.yml'); | ||
$builder = ReportBuilder::fromConfiguration($configuration); | ||
$builder->build()->save()->upload(); |