Skip to content

Commit

Permalink
Generate code coverage report on a separate non-blocking Travis job
Browse files Browse the repository at this point in the history
Travis build is taking about 40 minutes to complete, and that is mostly because of the generation of the code coverage report.

To address that, this commit changes Travis configuration to run the command to generate code coverage report on a separate non-blocking Travis job. This way once the jobs that run the tests finishes, Travisi will mark the build as successful and will keep running code coverage on a separate job.
  • Loading branch information
rodrigoprimo committed Nov 13, 2017
1 parent a2f8e08 commit 2dcb04e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@ php:
env:
- WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1

# Additional tests against stable PHP (min recommended version is 5.6) and past supported versions of WP.
# Additional tests against stable PHP (min recommended version is 5.6) and past supported versions of WP
# and code coverage report.
matrix:
fast_finish: true
include:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1
dist: precise
- php: 5.2
env: WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1
dist: precise
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1 RUN_CODE_COVERAGE=1
allow_failures:
- env: WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1 RUN_CODE_COVERAGE=1

before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion tests/bin/phpunit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
if [[ ${TRAVIS_PHP_VERSION} == '7.1' ]]; then
if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then
phpunit -c phpunit.xml --coverage-clover=coverage.clover
else
phpunit -c phpunit.xml
Expand Down
2 changes: 1 addition & 1 deletion tests/bin/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if [ $1 == 'before' ]; then

# Remove Xdebug from PHP runtime for all PHP version except 7.1 to speed up builds.
# We need Xdebug enabled in the PHP 7.1 build job as it is used to generate code coverage.
if [[ ${TRAVIS_PHP_VERSION} != '7.1' ]]; then
if [[ ${RUN_CODE_COVERAGE} != 1 ]]; then
phpenv config-rm xdebug.ini
fi

Expand Down

0 comments on commit 2dcb04e

Please sign in to comment.