2011-11-10 03:27:56 +00:00
|
|
|
language: php
|
|
|
|
|
2015-05-12 10:50:02 +01:00
|
|
|
sudo: false
|
|
|
|
|
2016-02-22 16:04:21 +00:00
|
|
|
git:
|
|
|
|
depth: 1
|
|
|
|
|
2015-05-12 10:50:02 +01:00
|
|
|
addons:
|
2015-08-18 15:04:52 +01:00
|
|
|
apt_packages:
|
|
|
|
- parallel
|
|
|
|
- language-pack-fr-base
|
2016-01-28 13:54:41 +00:00
|
|
|
- ldap-utils
|
|
|
|
- slapd
|
2015-05-12 10:50:02 +01:00
|
|
|
|
2015-12-11 18:21:41 +00:00
|
|
|
env:
|
|
|
|
global:
|
2015-12-18 15:43:53 +00:00
|
|
|
- MIN_PHP=5.5.9
|
2016-03-16 13:40:51 +00:00
|
|
|
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/5.6/bin/php
|
2015-10-13 09:49:36 +01:00
|
|
|
|
2013-12-14 12:00:39 +00:00
|
|
|
matrix:
|
2014-07-06 15:36:42 +01:00
|
|
|
include:
|
2016-06-02 07:29:41 +01:00
|
|
|
# Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
|
2017-03-08 09:04:21 +00:00
|
|
|
- php: hhvm-3.18
|
2016-06-02 07:29:41 +01:00
|
|
|
sudo: required
|
|
|
|
dist: trusty
|
|
|
|
group: edge
|
2014-12-26 09:21:27 +00:00
|
|
|
- php: 5.5
|
2015-07-02 09:26:24 +01:00
|
|
|
- php: 5.6
|
2016-09-01 16:15:52 +01:00
|
|
|
- php: 7.1
|
2017-05-24 16:30:25 +01:00
|
|
|
env: deps=high
|
|
|
|
- php: 7.0
|
2015-08-27 08:55:57 +01:00
|
|
|
env: deps=low
|
2014-12-26 09:21:27 +00:00
|
|
|
fast_finish: true
|
2013-01-04 08:48:20 +00:00
|
|
|
|
2015-12-11 18:21:41 +00:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- .phpunit
|
|
|
|
- php-$MIN_PHP
|
2013-12-20 14:57:17 +00:00
|
|
|
|
2016-01-19 13:27:46 +00:00
|
|
|
services:
|
2016-12-15 17:37:16 +00:00
|
|
|
- memcached
|
2016-01-19 13:27:46 +00:00
|
|
|
- mongodb
|
|
|
|
- redis-server
|
2014-07-06 15:36:42 +01:00
|
|
|
|
2014-09-02 15:17:55 +01:00
|
|
|
before_install:
|
2017-04-18 16:01:04 +01:00
|
|
|
- |
|
|
|
|
# General configuration
|
|
|
|
stty cols 120
|
2017-04-19 21:17:50 +01:00
|
|
|
mkdir /tmp/slapd
|
|
|
|
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
|
2017-04-18 16:01:04 +01:00
|
|
|
PHP=$TRAVIS_PHP_VERSION
|
|
|
|
[ -d ~/.composer ] || mkdir ~/.composer
|
|
|
|
cp .composer/* ~/.composer/
|
|
|
|
export PHPUNIT=$(readlink -f ./phpunit)
|
|
|
|
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
|
|
|
|
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
|
|
|
|
|
|
|
|
# tfold is a helper to create folded reports
|
|
|
|
tfold () {
|
|
|
|
title=$1
|
|
|
|
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
|
|
|
|
shift
|
|
|
|
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
|
|
|
|
bash -xc "$*" 2>&1 &&
|
|
|
|
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
|
|
|
|
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
|
|
|
|
}
|
|
|
|
export -f tfold
|
|
|
|
|
|
|
|
# php.ini configuration
|
|
|
|
if [[ $PHP = hhvm* ]]; then
|
|
|
|
INI=/etc/hhvm/php.ini
|
|
|
|
else
|
|
|
|
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
|
|
|
phpenv config-rm xdebug.ini || echo "xdebug not available"
|
|
|
|
fi
|
|
|
|
echo date.timezone = Europe/Paris >> $INI
|
|
|
|
echo memory_limit = -1 >> $INI
|
|
|
|
echo session.gc_probability = 0 >> $INI
|
|
|
|
echo opcache.enable_cli = 1 >> $INI
|
|
|
|
echo hhvm.jit = 0 >> $INI
|
|
|
|
echo apc.enable_cli = 1 >> $INI
|
|
|
|
echo extension = ldap.so >> $INI
|
2017-04-19 21:17:50 +01:00
|
|
|
echo extension = redis.so >> $INI
|
2017-04-19 21:25:39 +01:00
|
|
|
echo extension = memcached.so >> $INI
|
2017-04-18 16:01:04 +01:00
|
|
|
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
|
2017-05-18 13:41:01 +01:00
|
|
|
if [[ $PHP = 5.* ]]; then
|
|
|
|
echo extension = mongo.so >> $INI
|
|
|
|
elif [[ $PHP = 7.* ]]; then
|
|
|
|
echo extension = mongodb.so >> $INI
|
|
|
|
fi
|
2017-04-18 16:01:04 +01:00
|
|
|
|
|
|
|
# Matrix lines for intermediate PHP versions are skipped for pull requests
|
|
|
|
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
|
|
|
|
deps=skip
|
|
|
|
skip=1
|
|
|
|
else
|
|
|
|
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
|
|
|
fi
|
|
|
|
|
|
|
|
- |
|
|
|
|
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
|
|
|
if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
|
|
|
wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj &&
|
|
|
|
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
|
|
|
|
fi
|
|
|
|
|
|
|
|
- |
|
|
|
|
# Install extra PHP extensions
|
|
|
|
if [[ ! $skip && $PHP = 5.* ]]; then
|
|
|
|
([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
|
|
|
|
tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
|
|
|
|
elif [[ ! $skip && $PHP = 7.* ]]; then
|
|
|
|
tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
|
|
|
|
fi
|
2013-09-12 22:41:34 +01:00
|
|
|
|
2017-04-19 21:17:50 +01:00
|
|
|
- |
|
|
|
|
# Load fixtures
|
|
|
|
if [[ ! $skip ]]; then
|
|
|
|
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif &&
|
|
|
|
ldapadd -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif
|
|
|
|
fi
|
2013-09-12 22:41:34 +01:00
|
|
|
|
2014-09-02 15:17:55 +01:00
|
|
|
install:
|
2017-04-18 16:01:04 +01:00
|
|
|
- |
|
|
|
|
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
|
|
|
if [[ ! $deps ]]; then
|
|
|
|
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
|
|
|
|
elif [[ ! $skip ]]; then
|
|
|
|
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
|
|
|
cp composer.json composer.json.orig &&
|
|
|
|
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
|
|
|
|
php .github/build-packages.php HEAD^ $COMPONENTS &&
|
|
|
|
mv composer.json composer.json.phpunit &&
|
|
|
|
mv composer.json.orig composer.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
- |
|
|
|
|
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
|
|
|
|
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
|
|
|
|
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
|
|
|
|
git fetch origin $SYMFONY_VERSION &&
|
|
|
|
git checkout -m FETCH_HEAD &&
|
|
|
|
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
|
|
|
|
elif [[ ! $skip ]]; then
|
|
|
|
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
|
|
|
|
fi
|
|
|
|
|
|
|
|
- |
|
|
|
|
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
|
|
|
|
[[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy
|
|
|
|
|
|
|
|
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
|
|
if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
|
|
|
|
|
2017-05-18 13:41:01 +01:00
|
|
|
if [[ ! $skip && $PHP = 7.* ]]; then
|
|
|
|
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb)
|
|
|
|
fi
|
|
|
|
|
2017-04-18 16:01:04 +01:00
|
|
|
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
|
2017-01-03 07:41:06 +00:00
|
|
|
- if [[ ! $skip ]]; then ./phpunit install; fi
|
2017-04-18 16:01:04 +01:00
|
|
|
- |
|
|
|
|
# phpinfo
|
|
|
|
if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
|
|
|
|
|
|
|
|
- |
|
|
|
|
run_tests () {
|
|
|
|
set -e
|
|
|
|
if [[ $skip ]]; then
|
|
|
|
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
|
|
|
|
elif [[ $deps = high ]]; then
|
|
|
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
|
|
|
|
elif [[ $deps = low ]]; then
|
2017-04-19 21:17:50 +01:00
|
|
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" &&
|
|
|
|
# Test the PhpUnit bridge on PHP 5.3, using the original phpunit script
|
|
|
|
tfold src/Symfony/Bridge/PhpUnit \
|
2017-04-19 21:29:12 +01:00
|
|
|
"cd src/Symfony/Bridge/PhpUnit && wget https://phar.phpunit.de/phpunit-4.8.phar && phpenv global 5.3 && composer update --no-progress --ansi && php phpunit-4.8.phar"
|
2017-04-18 16:01:04 +01:00
|
|
|
elif [[ $PHP = hhvm* ]]; then
|
|
|
|
$PHPUNIT --exclude-group benchmark,intl-data
|
|
|
|
else
|
|
|
|
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
|
|
|
|
tfold tty-group $PHPUNIT --group tty
|
|
|
|
if [[ $PHP = ${MIN_PHP%.*} ]]; then
|
2017-04-19 21:25:39 +01:00
|
|
|
echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} SYMFONY_DEPRECATIONS_HELPER=weak ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"
|
2017-04-18 16:01:04 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2014-09-02 15:17:55 +01:00
|
|
|
|
2013-09-12 22:41:34 +01:00
|
|
|
script:
|
2017-04-18 16:01:04 +01:00
|
|
|
- (run_tests)
|