Change travis setup to exclude coverage from all but latest stable

Add PHP_LATEST_STABLE env to travis

Use same bash conditional for test scripts
This commit is contained in:
Jon Surrell 2017-01-16 19:48:59 +01:00
parent 177abef8e9
commit 9069bce4d3
4 changed files with 16 additions and 16 deletions

View File

@ -12,22 +12,20 @@ php:
- hhvm
env:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=0 PHP_LATEST_STABLE=7.1
# Additonal tests against stable PHP (min recommended version is 5.6) and past supported versions of WP.
matrix:
include:
- php: 5.6
env: WP_VERSION=latest WP_MULTISITE=1
allow_failures:
- php: 5.3
env: WP_VERSION=latest WP_MULTISITE=1 PHP_LATEST_STABLE="7.1"
before_script:
- bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
- bash tests/bin/travis.sh before
script:
- phpunit -c phpunit.xml.dist
- bash tests/bin/phpunit.sh
- bash tests/bin/travis.sh during
after_script:

View File

@ -34,7 +34,4 @@
<directory suffix=".php">./tmp/</directory>
</blacklist>
</filter>
<logging>
<log type="coverage-clover" target="./tmp/clover.xml" charset="UTF-8" />
</logging>
</phpunit>

5
tests/bin/phpunit.sh Executable file
View File

@ -0,0 +1,5 @@
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
phpunit -c phpunit.xml.dist --coverage-clover ./tmp/clover.xml
else
phpunit -c phpunit.xml.dist
fi

16
tests/bin/travis.sh Normal file → Executable file
View File

@ -4,16 +4,16 @@
if [ $1 == 'before' ]; then
# Composer install fails in PHP 5.2
[ $TRAVIS_PHP_VERSION == '5.2' ] && exit;
[[ ${TRAVIS_PHP_VERSION} == '5.2' ]] && exit;
# No Xdebug and therefore no coverage in PHP 5.3
[ $TRAVIS_PHP_VERSION == '5.3' ] && exit;
[[ ${TRAVIS_PHP_VERSION} == '5.3' ]] && exit;
composer self-update
composer install --no-interaction
## Only run on 7.0 box.
if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" ]]; then
## Only run on latest stable PHP box (defined in .travis.yml).
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
# Install CodeSniffer for WordPress Coding Standards checks. Only check once.
git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git /tmp/phpcs
# Install WordPress Coding Standards.
@ -29,8 +29,8 @@ if [ $1 == 'before' ]; then
elif [ $1 == 'during' ]; then
## Only run on 7.0 box.
if [ $TRAVIS_PHP_VERSION == "7.0" ]; then
## Only run on latest stable PHP box (defined in .travis.yml).
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
# WordPress Coding Standards.
# @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
# @link http://pear.php.net/package/PHP_CodeSniffer/
@ -49,8 +49,8 @@ elif [ $1 == 'during' ]; then
elif [ $1 == 'after' ]; then
## Only run on 7.0 box.
if [ $TRAVIS_PHP_VERSION == "7.0" ]; then
## Only run on latest stable PHP box (defined in .travis.yml).
if [[ ${TRAVIS_PHP_VERSION} == ${PHP_LATEST_STABLE} ]]; then
wget https://scrutinizer-ci.com/ocular.phar
chmod +x ocular.phar
php ocular.phar code-coverage:upload --format=php-clover ./tmp/clover.xml