|
|
|
dist: xenial
|
|
|
|
|
|
|
|
# faster builds on new travis setup not using sudo
|
|
|
|
# temporary disable, see https://github.com/travis-ci/travis-ci/issues/6842
|
|
|
|
#sudo: false
|
|
|
|
sudo: required
|
|
|
|
group: edge
|
|
|
|
|
|
|
|
# build only on master branches
|
|
|
|
# commented as this prevents people from running builds on their forks:
|
|
|
|
# https://github.com/yiisoft/yii2/commit/bd87be990fa238c6d5e326d0a171f38d02dc253a
|
|
|
|
#branches:
|
|
|
|
# only:
|
|
|
|
# - master
|
|
|
|
# - 2.1
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test Matrix
|
|
|
|
#
|
|
|
|
|
|
|
|
language: php
|
|
|
|
|
|
|
|
env:
|
|
|
|
global:
|
|
|
|
- DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader"
|
|
|
|
- TASK_TESTS_PHP=1
|
|
|
|
- TASK_TESTS_JS=0
|
|
|
|
- TASK_TESTS_COVERAGE=0
|
|
|
|
- TRAVIS_SECOND_USER=travis_two
|
|
|
|
- PHPUNIT_EXCLUDE_GROUP=mssql,oci,wincache,xcache,zenddata,cubrid
|
|
|
|
|
|
|
|
|
|
|
|
services:
|
|
|
|
- memcached
|
|
|
|
- postgresql
|
|
|
|
- docker
|
|
|
|
|
|
|
|
# cache vendor dirs
|
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- vendor
|
|
|
|
- $HOME/.composer/cache
|
|
|
|
- $HOME/.npm
|
|
|
|
|
|
|
|
# try running against postgres 9.6
|
|
|
|
addons:
|
|
|
|
postgresql: "9.6"
|
|
|
|
code_climate:
|
|
|
|
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
|
|
|
|
|
|
|
|
matrix:
|
|
|
|
fast_finish: true
|
|
|
|
include:
|
|
|
|
- php: "7.4"
|
|
|
|
env: PHPUNIT_EXCLUDE_GROUP=oci,wincache,xcache,zenddata,cubrid
|
|
|
|
|
|
|
|
- php: "7.3"
|
|
|
|
env: PHPUNIT_EXCLUDE_GROUP=oci,wincache,xcache,zenddata,cubrid
|
|
|
|
|
|
|
|
- php: "7.2"
|
|
|
|
env: PHPUNIT_EXCLUDE_GROUP=oci,wincache,xcache,zenddata,cubrid
|
|
|
|
|
|
|
|
# run tests coverage on PHP 7.1
|
|
|
|
- php: "7.1"
|
|
|
|
env:
|
|
|
|
- TASK_TESTS_COVERAGE=1
|
|
|
|
- PHPUNIT_EXCLUDE_GROUP=oci,wincache,xcache,zenddata,cubrid
|
|
|
|
|
|
|
|
- php: "7.0"
|
|
|
|
|
|
|
|
- php: "5.6"
|
|
|
|
|
|
|
|
- php: "5.5"
|
|
|
|
dist: trusty
|
|
|
|
|
|
|
|
- php: "5.4"
|
|
|
|
dist: trusty
|
|
|
|
|
|
|
|
# Test against HHVM 3.21 LTS version by using trusty
|
|
|
|
- php: hhvm-3.21
|
|
|
|
sudo: true
|
|
|
|
addons:
|
|
|
|
code_climate:
|
|
|
|
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
|
|
|
|
postgresql: "9.6"
|
|
|
|
services:
|
|
|
|
- mysql
|
|
|
|
- postgresql
|
|
|
|
|
|
|
|
# test against the latest pre 3.26 HHVM version by using a newer image.
|
|
|
|
# @see https://github.com/facebook/hhvm/issues/8192
|
|
|
|
- php: hhvm-3.24
|
|
|
|
sudo: true
|
|
|
|
addons:
|
|
|
|
code_climate:
|
|
|
|
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
|
|
|
|
postgresql: "9.6"
|
|
|
|
services:
|
|
|
|
- mysql
|
|
|
|
- postgresql
|
|
|
|
|
|
|
|
- php: nightly
|
|
|
|
services:
|
|
|
|
- mysql
|
|
|
|
- postgresql
|
|
|
|
|
|
|
|
# have a separate branch for javascript tests
|
|
|
|
- language: node_js
|
|
|
|
node_js: "6"
|
|
|
|
env: TASK_TESTS_PHP=0 TASK_TESTS_JS=1
|
|
|
|
# overwrite services used for PHP tests
|
|
|
|
services:
|
|
|
|
|
|
|
|
allow_failures:
|
|
|
|
- php: nightly
|
|
|
|
- php: hhvm-3.21
|
|
|
|
- php: hhvm-3.24
|
|
|
|
|
|
|
|
install:
|
|
|
|
- |
|
|
|
|
if [[ $TASK_TESTS_COVERAGE != 1 && $TRAVIS_PHP_VERSION != hhv* ]]; then
|
|
|
|
# disable xdebug for performance reasons when code coverage is not needed. note: xdebug on hhvm is disabled by default
|
|
|
|
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install composer dependencies
|
|
|
|
- travis_retry composer self-update
|
|
|
|
- export PATH="$HOME/.composer/vendor/bin:$PATH"
|
|
|
|
- travis_retry composer update $DEFAULT_COMPOSER_FLAGS
|
|
|
|
|
|
|
|
# setup PHP extension
|
|
|
|
- |
|
|
|
|
if [[ $TASK_TESTS_PHP == 1 && $TRAVIS_PHP_VERSION != nightly ]]; then
|
|
|
|
tests/data/travis/apc-setup.sh
|
|
|
|
tests/data/travis/memcache-setup.sh
|
|
|
|
tests/data/travis/imagick-setup.sh
|
|
|
|
source tests/data/travis/mysql-setup.sh
|
|
|
|
source tests/data/travis/mssql-setup.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# setup JS test
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_JS == 1 ]; then
|
|
|
|
travis_retry npm install
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Needed for FileCacheTest
|
|
|
|
- sudo useradd $TRAVIS_SECOND_USER --gid $(id -g) -M
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
#
|
|
|
|
# Disable:
|
|
|
|
# 1) the HHVM JIT for faster testing;
|
|
|
|
# 2) the session GC for testing stability.
|
|
|
|
#
|
|
|
|
# The second allows to avoid accidental unpredictable failings with message:
|
|
|
|
# `ps_files_cleanup_dir: opendir(/var/lib/hhvm/sessions) failed: Permission denied (13)`
|
|
|
|
#
|
|
|
|
- if [[ $TRAVIS_PHP_VERSION = hhv* ]]; then
|
|
|
|
echo 'hhvm.jit = 0' >> /etc/hhvm/php.ini;
|
|
|
|
echo 'session.gc_probability = 0' >> /etc/hhvm/php.ini;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# show some versions and env information
|
|
|
|
- php --version
|
|
|
|
- composer --version
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_PHP == 1 ]; then
|
|
|
|
php -r "echo INTL_ICU_VERSION . \"\n\";"
|
|
|
|
php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
|
|
|
|
psql --version
|
|
|
|
mysql --version
|
|
|
|
sudo mysql_upgrade || echo "MySQL is already up to date"
|
|
|
|
fi
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_JS == 1 ]; then
|
|
|
|
node --version
|
|
|
|
npm --version
|
|
|
|
fi
|
|
|
|
|
|
|
|
# initialize databases
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_PHP == 1 ]; then
|
|
|
|
travis_retry mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE `yiitest`;';
|
|
|
|
mysql -h 127.0.0.1 -u root -proot -e "SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';";
|
|
|
|
mysql -h 127.0.0.1 -u root -proot -e "CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;";
|
|
|
|
mysql -h 127.0.0.1 -u root -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;";
|
|
|
|
psql -U postgres -c 'CREATE DATABASE yiitest;';
|
|
|
|
fi
|
|
|
|
|
|
|
|
# enable code coverage
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_COVERAGE == 1 ]; then
|
|
|
|
PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Disable DEPRECATE messages during PHPUnit initialization on PHP 7.2. To fix them, PHPUnit should be updated to 6.*
|
|
|
|
# For Yii2 tests, messages will be enabled by tests/bootstrap.php
|
|
|
|
- |
|
|
|
|
if [[ $TRAVIS_PHP_VERSION == 7.2 || $TRAVIS_PHP_VERSION == 7.3 || $TRAVIS_PHP_VERSION == 7.4 || $TRAVIS_PHP_VERSION = nightly ]]; then
|
|
|
|
echo 'Disabled DEPRECATED notifications for PHP >= 7.2';
|
|
|
|
echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> /tmp/php-config.ini;
|
|
|
|
phpenv config-add /tmp/php-config.ini;
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
script:
|
|
|
|
# PHP tests
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_PHP == 1 ]; then
|
|
|
|
vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group $PHPUNIT_EXCLUDE_GROUP
|
|
|
|
fi
|
|
|
|
|
|
|
|
# JS tests
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_JS == 1 ]; then
|
|
|
|
npm test
|
|
|
|
fi
|
|
|
|
|
|
|
|
after_script:
|
|
|
|
- |
|
|
|
|
if [ $TASK_TESTS_COVERAGE == 1 ]; then
|
|
|
|
travis_retry wget https://scrutinizer-ci.com/ocular.phar
|
|
|
|
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
|
|
|
|
fi
|