2011-11-10 03:27:56 +00:00
|
|
|
language: php
|
|
|
|
|
2017-09-06 09:30:21 +01:00
|
|
|
dist: trusty
|
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
|
2018-03-13 16:34:51 +00:00
|
|
|
- librabbitmq-dev
|
2015-05-12 10:50:02 +01:00
|
|
|
|
2015-12-11 18:21:41 +00:00
|
|
|
env:
|
|
|
|
global:
|
2017-05-18 08:23:23 +01:00
|
|
|
- MIN_PHP=7.1.3
|
2017-10-11 13:06:43 +01:00
|
|
|
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
|
2018-03-13 16:34:51 +00:00
|
|
|
- MESSENGER_AMQP_DSN=amqp://localhost/%2f/messages
|
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:
|
2018-08-03 13:33:19 +01:00
|
|
|
- php: 7.1
|
2017-05-17 19:41:56 +01:00
|
|
|
- php: 7.1
|
2016-07-19 07:52:31 +01:00
|
|
|
env: deps=high
|
2017-10-11 13:06:43 +01:00
|
|
|
- php: 7.2
|
2015-08-27 08:55:57 +01:00
|
|
|
env: deps=low
|
2017-10-11 13:06:43 +01:00
|
|
|
|
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
|
2018-02-22 12:59:51 +00:00
|
|
|
- ~/php-ext
|
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
|
2018-03-13 16:34:51 +00:00
|
|
|
- rabbitmq
|
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
|
2018-08-02 07:56:36 +01:00
|
|
|
set -e
|
2017-04-18 16:01:04 +01:00
|
|
|
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
|
|
|
[ -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'
|
2018-08-03 12:20:06 +01:00
|
|
|
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
|
2018-08-02 07:56:36 +01:00
|
|
|
find ~/.phpenv -name xdebug.ini -delete
|
2017-04-18 16:01:04 +01:00
|
|
|
|
2018-08-02 07:56:36 +01:00
|
|
|
nanoseconds () {
|
2017-08-24 09:32:12 +01:00
|
|
|
local cmd="date"
|
|
|
|
local format="+%s%N"
|
|
|
|
local os=$(uname)
|
|
|
|
if hash gdate > /dev/null 2>&1; then
|
|
|
|
cmd="gdate"
|
|
|
|
elif [[ "$os" = Darwin ]]; then
|
|
|
|
format="+%s000000000"
|
|
|
|
fi
|
|
|
|
$cmd -u $format
|
|
|
|
}
|
|
|
|
export -f nanoseconds
|
|
|
|
|
2017-04-18 16:01:04 +01:00
|
|
|
# tfold is a helper to create folded reports
|
|
|
|
tfold () {
|
2018-08-02 07:56:36 +01:00
|
|
|
local title="🐘 $PHP $1"
|
2017-08-24 09:32:12 +01:00
|
|
|
local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
|
2017-04-18 16:01:04 +01:00
|
|
|
shift
|
2017-08-24 09:32:12 +01:00
|
|
|
local id=$(printf %08x $(( RANDOM * RANDOM )))
|
|
|
|
local start=$(nanoseconds)
|
|
|
|
echo -e "travis_fold:start:$fold"
|
|
|
|
echo -e "travis_time:start:$id"
|
|
|
|
echo -e "\\e[1;34m$title\\e[0m"
|
|
|
|
|
|
|
|
bash -xc "$*" 2>&1
|
|
|
|
local ok=$?
|
|
|
|
local end=$(nanoseconds)
|
|
|
|
echo -e "\\ntravis_time:end:$id:start=$start,finish=$end,duration=$(($end-$start))"
|
|
|
|
(exit $ok) &&
|
2017-04-18 16:01:04 +01:00
|
|
|
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
|
2017-08-24 09:32:12 +01:00
|
|
|
echo -e "\\e[41mKO\\e[0m $title\\n"
|
|
|
|
(exit $ok)
|
2017-04-18 16:01:04 +01:00
|
|
|
}
|
|
|
|
export -f tfold
|
|
|
|
|
2018-02-04 09:26:21 +00:00
|
|
|
# tpecl is a helper to compile and cache php extensions
|
|
|
|
tpecl () {
|
|
|
|
local ext_name=$1
|
|
|
|
local ext_so=$2
|
2018-02-22 12:51:03 +00:00
|
|
|
local INI=$3
|
2018-02-04 09:26:21 +00:00
|
|
|
local ext_dir=$(php -r "echo ini_get('extension_dir');")
|
2018-02-22 12:59:51 +00:00
|
|
|
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
|
2018-02-04 09:26:21 +00:00
|
|
|
|
|
|
|
if [[ -e $ext_cache/$ext_so ]]; then
|
|
|
|
echo extension = $ext_cache/$ext_so >> $INI
|
|
|
|
else
|
2018-08-02 07:56:36 +01:00
|
|
|
rm ~/.pearrc /tmp/pear 2>/dev/null || true
|
2018-02-04 09:26:21 +00:00
|
|
|
mkdir -p $ext_cache
|
|
|
|
echo yes | pecl install -f $ext_name &&
|
|
|
|
cp $ext_dir/$ext_so $ext_cache
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
export -f tpecl
|
|
|
|
|
2017-04-18 16:01:04 +01:00
|
|
|
- |
|
|
|
|
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
2018-08-03 13:33:19 +01:00
|
|
|
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
2017-05-18 08:23:23 +01:00
|
|
|
wget http://php.net/get/php-$MIN_PHP.tar.bz2/from/this/mirror -O - | tar -xj &&
|
2017-04-18 16:01:04 +01:00
|
|
|
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
|
|
|
|
fi
|
|
|
|
|
2018-08-02 07:56:36 +01:00
|
|
|
- |
|
|
|
|
# php.ini configuration
|
|
|
|
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
|
2018-08-03 12:13:38 +01:00
|
|
|
phpenv global $PHP 2>/dev/null || (cd / && wget https://s3.amazonaws.com/travis-php-archives/binaries/ubuntu/14.04/x86_64/php-$PHP.tar.bz2 -O - | tar -xj)
|
|
|
|
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
|
2018-08-02 07:56:36 +01:00
|
|
|
echo date.timezone = Europe/Paris >> $INI
|
|
|
|
echo memory_limit = -1 >> $INI
|
|
|
|
echo session.gc_probability = 0 >> $INI
|
|
|
|
echo opcache.enable_cli = 1 >> $INI
|
|
|
|
echo apc.enable_cli = 1 >> $INI
|
2018-08-03 11:42:44 +01:00
|
|
|
echo extension = redis.so >> $INI
|
|
|
|
echo extension = memcached.so >> $INI
|
2018-08-02 07:56:36 +01:00
|
|
|
done
|
|
|
|
|
2017-04-18 16:01:04 +01:00
|
|
|
- |
|
|
|
|
# Install extra PHP extensions
|
2018-08-02 07:56:36 +01:00
|
|
|
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
|
|
|
|
export PHP=$PHP
|
|
|
|
phpenv global $PHP
|
|
|
|
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
|
2018-08-03 12:13:38 +01:00
|
|
|
|
2018-03-13 16:34:51 +00:00
|
|
|
# Install librabbitmq
|
|
|
|
wget http://ftp.debian.org/debian/pool/main/libr/librabbitmq/librabbitmq-dev_0.5.2-2_amd64.deb
|
|
|
|
wget http://ftp.debian.org/debian/pool/main/libr/librabbitmq/librabbitmq1_0.5.2-2_amd64.deb
|
|
|
|
sudo dpkg -i librabbitmq1_0.5.2-2_amd64.deb librabbitmq-dev_0.5.2-2_amd64.deb
|
|
|
|
|
2018-02-05 15:46:42 +00:00
|
|
|
# install libsodium
|
2018-02-22 14:57:11 +00:00
|
|
|
sudo add-apt-repository ppa:ondrej/php -y
|
|
|
|
sudo apt-get update -q
|
|
|
|
sudo apt-get install libsodium-dev -y
|
2018-02-05 15:46:42 +00:00
|
|
|
|
2018-02-22 12:51:03 +00:00
|
|
|
tfold ext.apcu tpecl apcu-5.1.6 apcu.so $INI
|
2018-02-22 12:52:41 +00:00
|
|
|
tfold ext.libsodium tpecl libsodium sodium.so $INI
|
2018-06-27 22:01:14 +01:00
|
|
|
tfold ext.mongodb tpecl mongodb-1.5.0 mongodb.so $INI
|
2018-03-13 16:34:51 +00:00
|
|
|
tfold ext.amqp tpecl amqp-1.9.3 amqp.so $INI
|
2018-06-19 20:18:37 +01:00
|
|
|
tfold ext.igbinary tpecl igbinary-2.0.6 igbinary.so $INI
|
2018-08-02 07:56:36 +01:00
|
|
|
done
|
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
|
2018-08-02 07:56:36 +01:00
|
|
|
else
|
2017-04-18 16:01:04 +01:00
|
|
|
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 &&
|
2018-04-29 15:58:54 +01:00
|
|
|
COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
|
2018-08-02 07:56:36 +01:00
|
|
|
else
|
2017-04-18 16:01:04 +01:00
|
|
|
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
|
2018-08-02 07:56:36 +01:00
|
|
|
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
|
2017-05-18 13:41:01 +01:00
|
|
|
|
2017-05-18 18:40:51 +01:00
|
|
|
- php -i
|
2017-04-18 16:01:04 +01:00
|
|
|
|
|
|
|
- |
|
|
|
|
run_tests () {
|
|
|
|
set -e
|
2018-08-02 07:56:36 +01:00
|
|
|
export PHP=$1
|
|
|
|
if [[ $PHP != $TRAVIS_PHP_VERSION && $TRAVIS_PULL_REQUEST != false ]]; then
|
2017-04-18 16:01:04 +01:00
|
|
|
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
|
2018-08-02 07:56:36 +01:00
|
|
|
break
|
|
|
|
fi
|
2018-08-03 12:13:38 +01:00
|
|
|
phpenv global $PHP
|
2018-08-02 07:56:36 +01:00
|
|
|
tfold 'composer update' $COMPOSER_UP
|
|
|
|
tfold 'phpunit install' ./phpunit install
|
2018-08-03 12:20:06 +01:00
|
|
|
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb)
|
2018-08-02 07:56:36 +01:00
|
|
|
if [[ $deps = high ]]; then
|
2017-04-18 16:01:04 +01:00
|
|
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
|
|
|
|
elif [[ $deps = low ]]; then
|
2017-09-06 18:21:48 +01:00
|
|
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
|
2017-04-18 16:01:04 +01:00
|
|
|
else
|
|
|
|
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
|
2018-08-02 07:56:36 +01:00
|
|
|
tfold src/Symfony/Component/Console.tty $PHPUNIT src/Symfony/Component/Console --group tty
|
2018-08-03 13:33:19 +01:00
|
|
|
if [[ $PHP = ${MIN_PHP%.*} ]]; then
|
|
|
|
export PHP=$MIN_PHP
|
2017-07-04 12:07:48 +01:00
|
|
|
tfold src/Symfony/Component/Process.sigchild SYMFONY_DEPRECATIONS_HELPER=weak php-$MIN_PHP/sapi/cli/php ./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:
|
2018-08-02 07:56:36 +01:00
|
|
|
- for PHP in $TRAVIS_PHP_VERSION $php_extra; do (run_tests $PHP); done
|