* 5.0: (26 commits) [Filesystem] Handle paths on different drives [WebProfiler] Do not add src-elem CSP directives if they do not exist [Yaml] fix parse error when unindented collections contain a comment Execute docker dependent tests with github actions Update exception.html.php [3.4][Inflector] Improve testSingularize() argument name [Inflector] Fix testPluralize() arguments names [PhpUnitBridge] fix PHP 5.3 compat again Skip validation when email is an empty object fix sr_Latn translation [Validator] fix lazy property usage. Fix annotation [Debug][ErrorHandler] cleanup phpunit.xml.dist files [Translation] Fix for translation:update command updating ICU messages [PhpUnitBridge] fix compat with PHP 5.3 bumped Symfony version to 5.0.9 updated VERSION for 5.0.8 updated CHANGELOG for 5.0.8 bumped Symfony version to 4.4.9 updated VERSION for 4.4.8 ...
312 lines
14 KiB
YAML
312 lines
14 KiB
YAML
language: php
|
|
|
|
dist: xenial
|
|
|
|
git:
|
|
depth: 2
|
|
|
|
addons:
|
|
apt_packages:
|
|
- parallel
|
|
- language-pack-fr-base
|
|
- ldap-utils
|
|
- slapd
|
|
- zookeeperd
|
|
- libzookeeper-mt-dev
|
|
|
|
env:
|
|
global:
|
|
- MIN_PHP=7.2.5
|
|
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
|
|
- SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
|
|
|
|
matrix:
|
|
include:
|
|
- php: 7.2
|
|
env: php_extra="7.4"
|
|
- php: 7.3
|
|
env: deps=high
|
|
- php: 7.4
|
|
env: deps=low
|
|
fast_finish: true
|
|
|
|
cache:
|
|
directories:
|
|
- .phpunit
|
|
- php-$MIN_PHP
|
|
- ~/php-ext
|
|
|
|
before_install:
|
|
- |
|
|
# Enable extra ppa
|
|
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
|
|
sudo add-apt-repository -y ppa:ondrej/php
|
|
sudo rm /etc/apt/sources.list.d/google-chrome.list
|
|
sudo rm /etc/apt/sources.list.d/mongodb-3.4.list
|
|
sudo apt update
|
|
sudo apt install -y librabbitmq-dev libsodium-dev php-uuid zlib1g-dev
|
|
|
|
- |
|
|
# General configuration
|
|
set -e
|
|
stty cols 120
|
|
mkdir /tmp/slapd
|
|
if [ ! -e /tmp/slapd-modules ]; then
|
|
[ -d /usr/lib/openldap ] && ln -s /usr/lib/openldap /tmp/slapd-modules || ln -s /usr/lib/ldap /tmp/slapd-modules
|
|
fi
|
|
slapd -f src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf -h ldap://localhost:3389 &
|
|
[ -d ~/.composer ] || mkdir ~/.composer
|
|
cp .github/composer-config.json ~/.composer/config.json
|
|
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'
|
|
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
|
|
find ~/.phpenv -name xdebug.ini -delete
|
|
|
|
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 install -f $ext_name &&
|
|
cp $ext_dir/$ext_so $ext_cache
|
|
fi
|
|
}
|
|
export -f tpecl
|
|
|
|
- |
|
|
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
|
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
|
wget http://php.net/get/php-$MIN_PHP.tar.bz2/from/this/mirror -O - | tar -xj &&
|
|
(cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
|
|
fi
|
|
|
|
- |
|
|
# php.ini configuration
|
|
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
|
|
phpenv global $PHP 2>/dev/null || (cd / && wget https://storage.googleapis.com/travis-ci-language-archives/php/binaries/ubuntu/16.04/x86_64/php-$PHP.tar.bz2 -O - | tar -xj)
|
|
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
|
|
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
|
|
echo extension = memcached.so >> $INI
|
|
done
|
|
|
|
- |
|
|
# 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
|
|
|
|
tfold ext.apcu tpecl apcu-5.1.17 apcu.so $INI
|
|
tfold ext.mongodb tpecl mongodb-1.6.0 mongodb.so $INI
|
|
tfold ext.igbinary tpecl igbinary-3.1.2 igbinary.so $INI
|
|
tfold ext.zookeeper tpecl zookeeper-0.7.1 zookeeper.so $INI
|
|
tfold ext.amqp tpecl amqp-1.9.4 amqp.so $INI
|
|
tfold ext.redis tpecl redis-4.3.0 redis.so $INI "no"
|
|
done
|
|
- |
|
|
# List all php extensions with versions
|
|
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
|
|
|
|
- |
|
|
# 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
|
|
|
|
install:
|
|
- |
|
|
# Install the phpunit-bridge from a PR if required
|
|
#
|
|
# To run a PR with a patched phpunit-bridge, first submit the patch for the
|
|
# phpunit-bridge as a separate PR against the next feature-branch then
|
|
# uncomment and update the following line with that PR number
|
|
#SYMFONY_PHPUNIT_BRIDGE_PR=32886
|
|
|
|
if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
|
|
git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
|
|
git rm -rq src/Symfony/Bridge/PhpUnit
|
|
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
|
|
export SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
|
|
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
|
|
rm -rf .phpunit
|
|
fi
|
|
|
|
- |
|
|
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
|
git config --global user.email ""
|
|
git config --global user.name "Symfony"
|
|
|
|
if [[ ! $deps ]]; then
|
|
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit src/Symfony/Contracts
|
|
else
|
|
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^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n' | sort) &&
|
|
mv composer.json composer.json.phpunit &&
|
|
mv composer.json.orig composer.json
|
|
fi
|
|
if [[ $SYMFONY_PHPUNIT_BRIDGE_PR ]]; then
|
|
git rm -fq -- src/Symfony/Bridge/PhpUnit/composer.json
|
|
git diff --staged -- src/Symfony/Bridge/PhpUnit/ | git apply -R --index
|
|
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
|
|
export FLIP='🙃'
|
|
export SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
|
|
git fetch --depth=2 origin $SYMFONY_VERSION &&
|
|
git checkout -m FETCH_HEAD &&
|
|
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
|
|
else
|
|
export SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
|
|
fi
|
|
|
|
- |
|
|
# Skip the phpunit-bridge on not-master branches when $deps is empty
|
|
if [[ ! $deps && $TRAVIS_BRANCH != master ]]; then
|
|
export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
|
|
fi
|
|
|
|
- |
|
|
# Install symfony/flex
|
|
if [[ $deps = low ]]; then
|
|
export SYMFONY_REQUIRE='>=3.4'
|
|
else
|
|
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
|
|
fi
|
|
composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master
|
|
|
|
- |
|
|
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as 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) ]] && export LEGACY=,legacy
|
|
|
|
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
|
|
|
|
- php -i
|
|
|
|
- |
|
|
run_tests () {
|
|
set -e
|
|
export PHP=$1
|
|
phpenv global $PHP
|
|
|
|
if [[ $PHP != 7.4* && $PHP != $TRAVIS_PHP_VERSION && $TRAVIS_PULL_REQUEST != false ]]; then
|
|
echo -e "\\n\\e[33;1mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
|
|
return
|
|
fi
|
|
|
|
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb ~1.5.0)
|
|
if [[ $deps || $PHP != 7.2 ]]; then
|
|
tfold 'composer update' $COMPOSER_UP
|
|
fi
|
|
tfold 'phpunit install' ./phpunit install
|
|
if [[ $deps = high ]]; then
|
|
echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1
|
|
(cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json)
|
|
COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
|
|
|
|
if [[ $COMPONENTS && $LEGACY && $TRAVIS_BRANCH != master && $TRAVIS_PULL_REQUEST != false ]]; then
|
|
export FLIP='🙃'
|
|
SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}')
|
|
echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m"
|
|
export SYMFONY_REQUIRE=">=$SYMFONY_VERSION"
|
|
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
git fetch --depth=2 origin $SYMFONY_VERSION
|
|
git checkout -m FETCH_HEAD
|
|
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
|
|
(cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb)
|
|
[[ ! $COMPONENTS ]] || tfold 'phpunit install' SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 ./phpunit install
|
|
[[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1
|
|
fi
|
|
|
|
[[ ! $X ]] || (exit 1)
|
|
elif [[ $deps = low ]]; then
|
|
[[ -e ~/php-ext/composer-lowest.lock.tar ]] && tar -xf ~/php-ext/composer-lowest.lock.tar
|
|
tar -cf ~/php-ext/composer-lowest.lock.tar --files-from /dev/null
|
|
php .github/rm-invalid-lowest-lock-files.php $COMPONENTS
|
|
echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && ([ -e composer.lock ] && ${COMPOSER_UP/update/install} || $COMPOSER_UP --prefer-lowest --prefer-stable) && $PHPUNIT_X'"
|
|
echo "$COMPONENTS" | xargs -n1 -I{} tar --append -f ~/php-ext/composer-lowest.lock.tar {}/composer.lock
|
|
else
|
|
if [[ $PHP = 7.4* ]]; then
|
|
# add return types before running the test suite
|
|
rm src/Symfony/Contracts -Rf && mv vendor/symfony/contracts src/Symfony/Contracts
|
|
ln -sd $(realpath src/Symfony/Contracts) vendor/symfony/contracts
|
|
sed -i 's/"\*\*\/Tests\/"//' composer.json
|
|
composer install --optimize-autoloader
|
|
SYMFONY_PATCH_TYPE_DECLARATIONS=force=object php .github/patch-types.php
|
|
SYMFONY_PATCH_TYPE_DECLARATIONS=force=object php .github/patch-types.php # ensure the script is idempotent
|
|
PHPUNIT_X="$PHPUNIT_X,legacy"
|
|
fi
|
|
|
|
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
|
|
|
|
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
|
|
|
|
if [[ $PHP = ${MIN_PHP%.*} ]]; then
|
|
export PHP=$MIN_PHP
|
|
tfold src/Symfony/Component/Process.sigchild SYMFONY_DEPRECATIONS_HELPER=weak php-$MIN_PHP/sapi/cli/php ./phpunit --colors=always src/Symfony/Component/Process/
|
|
fi
|
|
fi
|
|
}
|
|
export -f run_tests
|
|
|
|
script:
|
|
echo $TRAVIS_PHP_VERSION $php_extra | xargs -n1 bash -c '(</dev/tty run_tests $0)' || false
|