minor #22461 Fold Travis CI output by component (maidmaid, nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- Fold Travis CI output by component | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Trying some tweaks on top of #22252 Commits -------cf87678a2e
Make .travis.yml more readable7a9b086d56
Fold Travis CI output by component
This commit is contained in:
commit
bc6128b486
166
.travis.yml
166
.travis.yml
@ -40,55 +40,127 @@ cache:
|
|||||||
services: mongodb
|
services: mongodb
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- stty cols 120
|
- |
|
||||||
- PHP=$TRAVIS_PHP_VERSION
|
# General configuration
|
||||||
# Matrix lines for intermediate PHP versions are skipped for pull requests
|
stty cols 120
|
||||||
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
|
PHP=$TRAVIS_PHP_VERSION
|
||||||
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
|
[ -d ~/.composer ] || mkdir ~/.composer
|
||||||
- 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
|
cp .composer/* ~/.composer/
|
||||||
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
|
export PHPUNIT=$(readlink -f ./phpunit)
|
||||||
- if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
|
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
|
||||||
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
|
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
|
||||||
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
|
|
||||||
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
|
# tfold is a helper to create folded reports
|
||||||
- if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi
|
tfold () {
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
|
title=$1
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
|
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
|
shift
|
||||||
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi
|
echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m"
|
||||||
- if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi
|
bash -xc "$*" 2>&1 &&
|
||||||
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
|
echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
|
( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
|
}
|
||||||
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
|
export -f tfold
|
||||||
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
|
|
||||||
|
# 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
|
||||||
|
[[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
|
||||||
|
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
|
||||||
|
|
||||||
|
# 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.memcached pecl install -f memcached-2.1.0 &&
|
||||||
|
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
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
|
- |
|
||||||
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
|
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
||||||
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
|
if [[ ! $deps ]]; then
|
||||||
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
|
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
|
||||||
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi
|
elif [[ ! $skip ]]; then
|
||||||
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
|
export SYMFONY_DEPRECATIONS_HELPER=weak &&
|
||||||
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi
|
cp composer.json composer.json.orig &&
|
||||||
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
|
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
|
||||||
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
|
php .github/build-packages.php HEAD^ $COMPONENTS &&
|
||||||
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then 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'); fi
|
mv composer.json composer.json.phpunit &&
|
||||||
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
|
mv composer.json.orig composer.json
|
||||||
- if [[ $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) ]]; then LEGACY=,legacy; fi
|
fi
|
||||||
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
|
|
||||||
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
|
- |
|
||||||
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit 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 [[ ! $skip ]]; then composer update --no-suggest; fi
|
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
|
||||||
|
|
||||||
|
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
|
||||||
- if [[ ! $skip ]]; then ./phpunit install; fi
|
- if [[ ! $skip ]]; then ./phpunit install; fi
|
||||||
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
|
- |
|
||||||
|
# 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
|
||||||
|
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
|
||||||
|
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
|
||||||
|
echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))'
|
- (run_tests)
|
||||||
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
|
|
||||||
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi
|
|
||||||
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi
|
|
||||||
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
|
|
||||||
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi
|
|
||||||
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi
|
|
||||||
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi
|
|
||||||
|
Reference in New Issue
Block a user