.travis.yml
language: php
php:
- 5.4
- 5.5
- 5.6
- 7.0
- nightly
- hhvm
matrix:
allow_failures:
- php: hhvm
branches:
except:
- gh-pages
services:
- mysql
- redis-server
- mongodb
env:
- DB=mysql
cache:
directories:
- vendor
- $HOME/.composer/cache
install:
- echo $TRAVIS_PHP_VERSION
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:*"
- travis_retry composer require "yiisoft/yii2-redis:*"
- |
if [ $TRAVIS_PHP_VERSION = '5.6' ]; then
phpenv config-add tests/data/php5.6.ini
travis_retry composer require "yiisoft/yii2-mongodb:*"
elif [ $TRAVIS_PHP_VERSION = '5.5' ]; then
phpenv config-add tests/data/php5.6.ini
travis_retry composer require "yiisoft/yii2-mongodb:*"
elif [ $TRAVIS_PHP_VERSION = '5.4' ]; then
phpenv config-add tests/data/php5.6.ini
travis_retry composer require "yiisoft/yii2-mongodb:*"
fi
- export PATH="$HOME/.composer/vendor/bin/:$PATH"
- travis_retry composer install --prefer-dist --no-interaction
before_script:
- php -r "echo INTL_ICU_VERSION . \"\n\";"
- php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
- php -v
- |
if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then
php -m
fi
- mysql --version
- mysql -uroot < tests/data/yii2-models.sql
- |
if [ $TRAVIS_PHP_VERSION = 'nightly' ]; then
travis_retry wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
EXCLUDE_FLAGS="--exclude-group mongo"
elif [ $TRAVIS_PHP_VERSION = 'hhvm' ]; then
travis_retry wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
EXCLUDE_FLAGS="--exclude-group mongo"
elif [ $TRAVIS_PHP_VERSION = '7.0' ]; then
travis_retry wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
EXCLUDE_FLAGS="--exclude-group mongo"
elif [ $TRAVIS_PHP_VERSION = '5.6' ]; then
travis_retry wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
fi
- redis-cli flushall
- mongo yii2-models --eval "db.addUser(\"user\", \"123456\");"
- mongo yii2-models --eval "db.auth(\"user\", \"123456\");db.entity.drop();db.blameable.drop();db.message.drop();db.notification.drop();db.notification.read.drop();"
script:
- |
if [ $TRAVIS_PHP_VERSION = 'nightly' ]; then
php phpunit.phar --verbose $EXCLUDE_FLAGS
elif [ $TRAVIS_PHP_VERSION = 'hhvm' ]; then
php phpunit.phar --verbose $EXCLUDE_FLAGS
elif [ $TRAVIS_PHP_VERSION = '7.0' ]; then
php phpunit.phar --verbose $EXCLUDE_FLAGS
elif [ $TRAVIS_PHP_VERSION = '5.6' ]; then
php phpunit.phar --verbose $PHPUNIT_FLAGS
else
phpunit --verbose
fi
after_script:
- |
if [ $TRAVIS_PHP_VERSION = '5.6' ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi