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