Skip to content

Commit 8542189

Browse files
committed
Fix the upload of the code coverage to Scrutinizer
PHP 7 and HHVM are not able to generate code coverage on Travis. If ocular is called in this case, it will report to Scrutinizer that the code coverage has not been collected, which will cancel the scrutinizer analysis if it is the first Travis job to finish (which is likely as generating code coverage would slow down the other jobs).
1 parent cdad036 commit 8542189

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ before_script:
3636
# Install NGINX
3737
- sh ./tests/install-nginx.sh
3838
# Starting webserver
39-
- sh -c "if [ '$TRAVIS_PHP_VERSION' = 'hhvm' ]; then ./tests/ci/install-apache-hhvm.sh; fi"
39+
- if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ]; then ./tests/ci/install-apache-hhvm.sh; fi
4040

4141
script:
4242
- phpunit --coverage-clover=coverage.clover
4343
- make -C doc SPHINXOPTS='-nW' html
4444
- make -C doc spelling
4545

4646
after_script:
47-
- wget https://scrutinizer-ci.com/ocular.phar
48-
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
47+
# avoid uploading the code coverage for PHP 7 and HHVM as they cannot generate it (PHPUnit dropped the old HHVM driver
48+
# and the XDebug API is not implemented in HHVM 3.5) and we don't want to cancel the Scrutinizer analysis by notifying
49+
# it than no coverage data is available
50+
- if [[ "$TRAVIS_PHP_VERSION" != "7" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
4951

5052
after_failure:
5153
- cat /tmp/fos_nginx_error.log

0 commit comments

Comments
 (0)