10000 Make .travis.yml more readable · symfony/symfony@fbaeada · GitHub
[go: up one dir, main page]

Skip to content

Commit fbaeada

Browse files
Make .travis.yml more readable
1 parent 7a9b086 commit fbaeada

File tree

3 files changed

+122
-64
lines changed

3 files changed

+122
-64
lines changed

.github/travis_fold.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

.travis.yml

Lines changed: 121 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -40,55 +40,129 @@ cache:
4040
services: mongodb
4141

4242
before_install:
43-
- stty cols 120
44-
- PHP=$TRAVIS_PHP_VERSION
45-
# Matrix lines for intermediate PHP versions are skipped for pull requests
46-
- if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi
47-
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
48-
- 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
49-
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
50-
- if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
51-
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
52-
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
53-
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
54-
- if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi
55-
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi
56-
- if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi
57-
- if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi
58-
- if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi
59-
- 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
60-
- if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi
61-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi
62-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
63-
- if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi
64-
- if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi
43+
- |
44+
# General configuration
45+
set -e
46+
stty cols 120
47+
PHP=$TRAVIS_PHP_VERSION
48+
[ -d ~/.composer ] || mkdir ~/.composer
49+
cp .composer/* ~/.composer/
50+
export PHPUNIT=$(readlink -f ./phpunit)
51+
52+
# tfold is a helper to create folded reports
53+
tfold () {
54+
title=$1
55+
fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g')
56+
shift
57+
output=$({ bash -c "$*";} 2>&1) &&
58+
echo -en "travis_fold:start:$fold\\r\\e[1;32m$title\\e[0m\\n$output\\n\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold\\r" ||
59+
( echo -en "\\e[1;31m$title\\e[0m\\n$output\\n\\e[41mKO\\e[0m $title\\n\\n" && exit 1 )
60+
}
61+
export -f tfold
62+
63+
# php.ini configuration
64+
if [[ $PHP = hhvm* ]]; then
65+
INI=/etc/hhvm/php.ini
66+
else
67+
INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
68+
phpenv config-rm xdebug.ini || echo "xdebug not available"
69+
fi
70+
echo date.timezone = Europe/Paris >> $INI
71+
echo memory_limit = -1 >> $INI
72+
echo session.gc_probability = 0 >> $INI
73+
echo opcache.enable_cli = 1 >> $INI
74+
echo hhvm.jit = 0 >> $INI
75+
echo apc.enable_cli = 1 >> $INI
76+
echo extension = ldap.so >> $INI
77+
[[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
78+
[[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
79+
80+
# Matrix lines for intermediate PHP versions are skipped for pull requests
81+
if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
82+
deps=skip
83+
skip=1
84+
fi
85+
86+
- |
87+
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
88+
if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
89+
wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj
90+
(cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2)
91+
fi
92+
93+
- |
94+
# Install extra PHP extensions
95+
if [[ ! $skip && ! $PHP = hhvm* ]]; then
96+
if [[ $PHP = 5.* ]]; then
97+
[[ $deps ]] || (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI)
98+
pecl install -f memcached-2.1.0
99+
(echo yes | pecl install -f apcu-4.0.11)
100+
else
101+
(echo yes | pecl install -f apcu-5.1.6)
102+
fi
103+
fi
65104
66105
install:
67-
- if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi
68-
- if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi
69-
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
70-
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
71-
- if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi
72-
- if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi
73-
- if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi
74-
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
75-
- 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
76-
- 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
77-
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
78-
- 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
79 B41A -
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
80-
- if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi
81-
- if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
82-
- if [[ ! $skip ]]; then composer update --no-suggest; fi
106+
- |
107+
# Configure the test suite
108+
if [[ ! $skip ]]; then
109+
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
110+
111+
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
112+
if [[ $deps ]]; then
113+
export SYMFONY_DEPRECATIONS_HELPER=weak
114+
cp composer.json composer.json.orig
115+
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json
116+
php .github/build-packages.php HEAD^ $COMPONENTS
117+
mv composer.json composer.json.phpunit
118+
mv composer.json.orig composer.json
119+
else
120+
php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
121+
fi
122+
123+
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
124+
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
125+
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//)
126+
git fetch origin $SYMFONY_VERSION
127+
git checkout -m FETCH_HEAD
128+
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
129+
else
130+
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
131+
fi
132+
133+
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
134+
[[ $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
135+
136+
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
137+
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
138+
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
139+
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
140+
fi
141+
142+
- if [[ ! $skip ]]; then $COMPOSER_UP; fi
83143
- if [[ ! $skip ]]; then ./phpunit install; fi
84-
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
85-
- . .github/travis_fold.sh
144+
- |
145+
# phpinfo
146+
if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
147+
148+
- |
149+
run_tests () {
150+
if [[ $skip ]]; then
151+
echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
152+
elif [[ $deps = high ]]; then
153+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && tfold {}.composer $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
154+
elif [[ $deps = low ]]; then
155+
echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && tfold {}.composer $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
156+
elif [[ $PHP = hhvm* ]]; then
157+
$PHPUNIT --exclude-group benchmark,intl-data
158+
else
159+
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
160+
tfold tty-group $PHPUNIT --group tty
161+
if [[ $PHP = ${MIN_PHP%.*} ]]; then
162+
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/"
163+
fi
164+
fi
165+
}
86166
87167
script:
88-
- if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi
89-
- if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu -k 'tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data {}"'; fi
90-
- if [[ ! $deps && ! $PHP = hhvm* ]]; then tfold PHPUnit.tty "$PHPUNIT --group tty"; fi
91-
- if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi
92-
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'tfold PHPUnit.sigchild "ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"'; fi
93-
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data$LEGACY"'; fi
94-
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data"'; fi
168+
- (run_tests)

src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testCollectConnections()
2424
$c = $this->createCollector(array());
2525
$c->collect(new Request(), new Response());
2626
$this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $c->getConnections());
27-
$this->assertTrue(false);
27+
$this->assertFalse(true);
2828
}
2929

3030
public function testCollectManagers()

0 commit comments

Comments
 (0)
0