Skip to content

Commit 1b5717d

Browse files
committed
Send coverage only for PHP 5.6
1 parent 6ccdc1e commit 1b5717d

5 files changed

+25
-12
lines changed

.gitattributes

-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@
77
/*.md export-ignore
88
/phpunit.xml export-ignore
99
/getTravis.php export-ignore
10-
/setSymfonyVersion.php export-ignore

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ matrix:
109109
sudo: required
110110
before_script:
111111
- travis_retry composer self-update
112-
- if [ "$SYMFONY_VERSION" != "" ]; then travis_retry php setSymfonyVersion.php $SYMFONY_VERSION; fi;
112+
- if [ "$SYMFONY_VERSION" != "" ]; then travis_retry php tests/setSymfonyVersion.php $SYMFONY_VERSION; fi;
113113
- travis_retry composer update --no-interaction --prefer-stable
114114
- chmod -R 0777 tests/project
115115
script:
116116
- vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.xml
117117
after_script:
118-
- vendor/bin/test-reporter --coverage-report coverage.xml
118+
- php tests/sendCoverage.php
119119
after_success:
120120
- bash <(curl -s https://codecov.io/bash)
121121
addons:

genTravis.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434
$matrix = [
3535
'5.4' => ['2.7.*', '2.8.*'],
36-
'5.5' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*'],
37-
'5.6' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*'],
38-
'7.0' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*'],
39-
'7.1' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '4.0.x-dev as 3.99'],
40-
'7.2' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '4.0.x-dev as 3.99'],
41-
'hhvm' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*'],
36+
'5.5' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4'],
37+
'5.6' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4'],
38+
'7.0' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4'],
39+
'7.1' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4', '4.0.x-dev as 3.99'],
40+
'7.2' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4', '4.0.x-dev as 3.99'],
41+
'hhvm' => ['2.7.*', '2.8.*', '3.0.*', '3.1.*', '3.2.*', '3.3.*', '3.4.x-dev as 3.4'],
4242
];
4343

4444
foreach ($matrix as $phpVersion => $symfonyVersions) {

tests/sendCoverage.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
if (version_compare(PHP_VERSION, '5.6') >= 0 && version_compare(PHP_VERSION, '7.1') < 0) {
4+
echo 'Send coverage report for ' . PHP_VERSION;
5+
chdir(__DIR__ . '/..');
6+
exec('vendor/bin/test-reporter --coverage-report coverage.xml', $output, $status);
7+
echo implode("\n", $output) . "\n";
8+
exit($status);
9+
}
10+
11+
echo 'Coverage report ignored for ' . PHP_VERSION;
12+
exit(0);

setSymfonyVersion.php tests/setSymfonyVersion.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?php
22

33
$version = implode(' ', array_slice($argv, 1));
4-
5-
$composer = file_get_contents(__DIR__ . '/composer.json');
4+
$composerFile = __DIR__ . '/../composer.json';
5+
$composer = file_get_contents($composerFile);
66
$newContent = preg_replace('/"symfony\/symfony"\s*:\s*"[^"]+"/', '"symfony/symfony": "' . $version . '"', $composer);
7+
78
if ($newContent === $composer) {
89
echo 'symfony/symfony not found in ./composer.json';
910

1011
exit(1);
1112
}
12-
if (empty($newContent) || !file_put_contents(__DIR__ . '/composer.json', $newContent)) {
13+
14+
if (empty($newContent) || !file_put_contents($composerFile, $newContent)) {
1315
echo './composer.json cannot be updated';
1416

1517
exit(1);

0 commit comments

Comments
 (0)