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

Skip to content

Commit d5db6a1

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

File tree

3 files changed

+120
-64
lines changed

3 files changed

+120
-64
lines changed

.github/travis_fold.sh

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

.travis.yml

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ 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);
2827
}
2928

3029
public function testCollectManagers()

0 commit comments

Comments
 (0)
0