128 lines
3.9 KiB
YAML
128 lines
3.9 KiB
YAML
language: php
|
|
|
|
dist: bionic
|
|
|
|
git:
|
|
depth: 1
|
|
|
|
addons:
|
|
apt_packages:
|
|
- parallel
|
|
- zookeeperd
|
|
- libzookeeper-mt-dev
|
|
- libsodium-dev
|
|
|
|
matrix:
|
|
include:
|
|
- php: 7.3
|
|
fast_finish: true
|
|
|
|
cache:
|
|
directories:
|
|
- .phpunit
|
|
- ~/php-ext
|
|
|
|
before_install:
|
|
- |
|
|
# General configuration
|
|
set -e
|
|
stty cols 120
|
|
sudo sed -i 's/127\.0\.1\.1 localhost/127.0.0.1 localhost/' /etc/hosts
|
|
cp .github/composer-config.json "$(composer config home)/config.json"
|
|
|
|
nanoseconds () {
|
|
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
|
|
|
|
# tfold is a helper to create folded reports
|
|
tfold () {
|
|
local title="$PHP $1 $FLIP"
|
|
local fold=$(echo $title | sed -r 's/[^-_A-Za-z0-9]+/./g')
|
|
shift
|
|
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) &&
|
|
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
|
|
echo -e "\\e[41mKO\\e[0m $title\\n"
|
|
(exit $ok)
|
|
}
|
|
export -f tfold
|
|
|
|
# tpecl is a helper to compile and cache php extensions
|
|
tpecl () {
|
|
local ext_name=$1
|
|
local ext_so=$2
|
|
local INI=$3
|
|
local input=${4:-yes}
|
|
local ext_dir=$(php -r "echo ini_get('extension_dir');")
|
|
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
|
|
|
|
if [[ -e $ext_cache/$ext_so ]]; then
|
|
echo extension = $ext_cache/$ext_so >> $INI
|
|
else
|
|
rm ~/.pearrc /tmp/pear 2>/dev/null || true
|
|
mkdir -p $ext_cache
|
|
echo $input | pecl -q install -f $ext_name &&
|
|
cp $ext_dir/$ext_so $ext_cache
|
|
fi
|
|
}
|
|
export -f tpecl
|
|
|
|
- |
|
|
# php.ini configuration
|
|
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
|
|
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
|
|
echo date.timezone = Europe/Paris >> $INI
|
|
echo memory_limit = -1 >> $INI
|
|
echo default_socket_timeout = 10 >> $INI
|
|
echo session.gc_probability = 0 >> $INI
|
|
echo opcache.enable_cli = 1 >> $INI
|
|
echo apc.enable_cli = 1 >> $INI
|
|
done
|
|
find ~/.phpenv -name xdebug.ini -delete
|
|
|
|
composer self-update
|
|
composer self-update --2
|
|
|
|
- |
|
|
# Install extra PHP extensions
|
|
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
|
|
export PHP=$PHP
|
|
phpenv global $PHP
|
|
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
|
|
if ! php --ri sodium > /dev/null; then
|
|
tfold ext.libsodium tpecl libsodium sodium.so $INI
|
|
fi
|
|
if [[ $PHP != 8.* ]]; then
|
|
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
|
|
fi
|
|
done
|
|
|
|
install:
|
|
- export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
|
|
- export COMPOSER_ROOT_VERSION=$(grep ' VERSION = ' src/Symfony/Component/HttpKernel/Kernel.php | grep -P -o '[0-9]+\.[0-9]+').x-dev
|
|
- composer update --no-progress --ansi
|
|
- ./phpunit install
|
|
|
|
script:
|
|
- echo "$COMPONENTS" | parallel --gnu -j +3 "tfold {} ./phpunit --exclude-group tty,benchmark,intl-data {}"
|
|
- tfold src/Symfony/Component/Console.tty ./phpunit src/Symfony/Component/Console --group tty
|
|
- tfold src/Symfony/Bridge/Twig.tty ./phpunit src/Symfony/Bridge/Twig --group tty
|