diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000000..c00a1ca9322 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,3 @@ +src_dir: . +coverage_clover: ./tmp/clover.xml +json_path: ./tmp/coveralls-upload.json diff --git a/.travis.yml b/.travis.yml index 6ea8824e898..7b140e2a793 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,10 @@ matrix: env: WP_VERSION=latest WP_MULTISITE=0 before_script: - - bash tests/install-wp-tests.sh woocommerce_test root '' localhost $WP_VERSION + - bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION + - bash tests/bin/travis.sh before script: phpunit -c phpunit.xml.dist + +after_script: + - bash tests/bin/travis.sh after diff --git a/tests/install-wp-tests.sh b/tests/bin/install.sh similarity index 100% rename from tests/install-wp-tests.sh rename to tests/bin/install.sh diff --git a/tests/bin/travis.sh b/tests/bin/travis.sh new file mode 100644 index 00000000000..e9960a45f95 --- /dev/null +++ b/tests/bin/travis.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# usage: travis.sh before|after + +if [ $1 == 'before' ]; then + + # composer install fails in PHP 5.2 + [ $TRAVIS_PHP_VERSION == '5.2' ] && exit; + + # install php-coveralls to send coverage info + composer init --require=satooshi/php-coveralls:0.7.x-dev -n + composer install --no-interaction + +elif [ $1 == 'after' ]; then + + # no Xdebug and therefore no coverage in PHP 5.2 + [ $TRAVIS_PHP_VERSION == '5.2' ] && exit; + + # send coverage data to coveralls + php vendor/bin/coveralls --verbose --exclude-no-stmt +fi