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