@@ -40,55 +40,127 @@ cache:
40
40
services : mongodb
41
41
42
42
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 =
8000
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
+ bash -xc "$*" 2>&1 &&
60
+ echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" ||
61
+ ( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 )
62
+ }
63
+ export -f tfold
64
+
65
+ # php.ini configuration
66
+ if [[ $PHP = hhvm* ]]; then
67
+ INI=/etc/hhvm/php.ini
68
+ else
69
+ INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
70
+ phpenv config-rm xdebug.ini || echo "xdebug not available"
71
+ fi
72
+ echo date.timezone = Europe/Paris >> $INI
73
+ echo memory_limit = -1 >> $INI
74
+ echo session.gc_probability = 0 >> $INI
75
+ echo opcache.enable_cli = 1 >> $INI
76
+ echo hhvm.jit = 0 >> $INI
77
+ echo apc.enable_cli = 1 >> $INI
78
+ echo extension = ldap.so >> $INI
79
+ [[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI
80
+ [[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI
81
+
82
+ # Matrix lines for intermediate PHP versions are skipped for pull requests
83
+ if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then
84
+ deps=skip
85
+ skip=1
86
+ else
87
+ COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
88
+ fi
89
+
90
+ - |
91
+ # Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
92
+ if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
93
+ wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj &&
94
+ (cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2)
95
+ fi
96
+
97
+ - |
98
+ # Install extra PHP extensions
99
+ if [[ ! $skip && $PHP = 5.* ]]; then
100
+ ([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") &&
101
+ tfold ext.memcached pecl install -f memcached-2.1.0 &&
102
+ tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11'
103
+ elif [[ ! $skip && $PHP = 7.* ]]; then
104
+ tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6'
105
+ fi
65
106
66
107
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
108
+ - |
109
+ # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
110
+ if [[ ! $deps ]]; then
111
+ php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit
112
+ elif [[ ! $skip ]]; 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
+ fi
120
+
121
+ - |
122
+ # For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
123
+ if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
124
+ SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
125
+ git fetch origin $SYMFONY_VERSION &&
126
+ git checkout -m FETCH_HEAD &&
127
+ COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
128
+ elif [[ ! $skip ]]; then
129
+ SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
130
+ fi
131
+
132
+ - |
133
+ #
F438
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 COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
137
+ if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi
138
+
139
+ - if [[ ! $skip ]]; then $COMPOSER_UP; fi
83
140
- 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
141
+ - |
142
+ # phpinfo
143
+ if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
144
+
145
+ - |
146
+ run_tests () {
147
+ set -e
148
+ if [[ $skip ]]; then
149
+ echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
150
+ elif [[ $deps = high ]]; then
151
+ echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
152
+ elif [[ $deps = low ]]; then
153
+ echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'"
154
+ elif [[ $PHP = hhvm* ]]; then
155
+ $PHPUNIT --exclude-group benchmark,intl-data
156
+ else
157
+ echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
158
+ tfold tty-group $PHPUNIT --group tty
159
+ if [[ $PHP = ${MIN_PHP%.*} ]]; then
160
+ 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/"
161
+ fi
162
+ fi
163
+ }
86
164
87
165
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
166
+
7DAE
- (run_tests)
0 commit comments