@@ -23,17 +23,54 @@ sudo: false
23
23
24
24
language : php
25
25
26
- php :
27
- - 5.4
28
- - 5.5
29
- - 5.6
30
- - 7.0
31
- - 7.1
32
- - nightly
26
+ env :
27
+ global :
28
+ - DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader"
29
+ - TASK_TESTS_PHP=1
30
+ - TASK_TESTS_JS=0
31
+ - TASK_TESTS_CS=0
32
+ - TASK_TESTS_COVERAGE=0
33
+
34
+
35
+ services :
36
+ - memcached
37
+ - mysql
38
+ - postgresql
39
+
40
+ # cache vendor dirs
41
+ cache :
42
+ directories :
43
+ - vendor
44
+ - $HOME/.composer/cache
45
+ - $HOME/.npm
46
+
47
+ # try running against postgres 9.3
48
+ addons :
49
+ postgresql : " 9.3"
50
+ code_climate :
51
+ repo_token : 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
33
52
34
53
matrix :
35
54
fast_finish : true
36
55
include :
56
+ # test coding standards
57
+ - php : 7.1
58
+ env : TASK_TESTS_PHP=0 TASK_TESTS_CS=1
59
+ # overwrite services used for PHP tests
60
+ services :
61
+
62
+ # run tests coverage on PHP 7.1
63
+ - php : 7.1
64
+ env : TASK_TESTS_COVERAGE=1
65
+
66
+ - php : 7.0
67
+
68
+ - php : 5.6
69
+
70
+ - php : 5.5
71
+
72
+ - php : 5.4
73
+
37
74
# Test against HHVM 3.12 LTS version by using trusty
38
75
- php : hhvm-3.12
39
76
sudo : true
@@ -49,6 +86,7 @@ matrix:
49
86
- mysql-client-5.6
50
87
services :
51
88
- mysql
89
+
52
90
# test against the latest HHVM version by using a newer image
53
91
- php : hhvm
54
92
sudo : true
@@ -66,98 +104,111 @@ matrix:
66
104
services :
67
105
- mysql
68
106
- postgresql
107
+
108
+ - php : nightly
109
+
69
110
# have a separate branch for javascript tests
70
111
- language : node_js
71
112
node_js : 6
113
+ env : TASK_TESTS_PHP=0 TASK_TESTS_JS=1
72
114
dist : trusty
73
- # overwrite php related settings
74
- php :
115
+ # overwrite services used for PHP tests
75
116
services :
76
- addons :
77
- install :
78
- - travis_retry npm install
79
- # disable xdebug for performance in composer
80
- - phpenv config-rm xdebug.ini || echo "xdebug is not installed"
81
- - travis_retry composer self-update && composer --version
82
- - travis_retry composer install --prefer-dist --no-interaction
83
- before_script :
84
- - node --version
85
- - npm --version
86
- - php --version
87
- - composer --version
88
- script : npm test
89
- after_script :
90
117
91
118
allow_failures :
92
119
- php : nightly
93
120
121
+ install :
122
+ - |
123
+ if [[ $TASK_TESTS_COVERAGE != 1 && $TRAVIS_PHP_VERSION != hhv* ]]; then
124
+ # disable xdebug for performance reasons when code coverage is not needed. note: xdebug on hhvm is disabled by default
125
+ phpenv config-rm xdebug.ini || echo "xdebug is not installed"
126
+ fi
94
127
95
- services :
96
- - memcached
97
- - mysql
98
- - postgresql
99
-
100
- # cache vendor dirs
101
- cache :
102
- directories :
103
- - vendor
104
- - $HOME/.composer/cache
105
- - $HOME/.npm
128
+ # install composer dependencies
129
+ - travis_retry composer self-update
130
+ - export PATH="$HOME/.composer/vendor/bin:$PATH"
131
+ - |
132
+ if [[ $TRAVIS_PHP_VERSION == "hhvm-3.12" ]]; then
133
+ # remove php-cs-fixer from composer dependencies on hhvm-3.12 - php-cs-fixer requires at least hhvm-3.18
134
+ composer remove friendsofphp/php-cs-fixer --dev
135
+ fi
136
+ - travis_retry composer install $DEFAULT_COMPOSER_FLAGS
106
137
107
- # try running against postgres 9.3
108
- addons :
109
- postgresql : " 9.3"
110
- code_climate :
111
- repo_token : 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
138
+ # setup PHP extension
139
+ - |
140
+ if [ $TASK_TESTS_PHP == 1 ]; then
141
+ tests/data/travis/apc-setup.sh
142
+ tests/data/travis/memcache-setup.sh
143
+ tests/data/travis/imagick-setup.sh
144
+ fi
112
145
113
- install :
146
+ # setup JS test
114
147
- |
115
- if [[ $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != hhv* ]]; then
116
- # disable xdebug for performance reasons when code coverage is not needed. note: xdebug on hhvm is disabled by default
117
- phpenv config-rm xdebug.ini || echo "xdebug is not installed"
148
+ if [ $TASK_TESTS_JS == 1 ]; then
149
+ travis_retry npm install
118
150
fi
119
- - travis_retry composer self-update && composer --version
120
- - export PATH="$HOME/.composer/vendor/bin:$PATH"
121
- # core framework:
122
- - travis_retry composer install --prefer-dist --no-interaction
123
- - tests/data/travis/apc-setup.sh
124
- - tests/data/travis/memcache-setup.sh
125
- - tests/data/travis/imagick-setup.sh
126
151
127
152
before_script :
128
153
# Disable the HHVM JIT for faster Unit Testing
129
154
- if [[ $TRAVIS_PHP_VERSION = hhv* ]]; then echo 'hhvm.jit = 0' >> /etc/hhvm/php.ini; fi
155
+
130
156
# show some versions and env information
131
- - php -r "echo INTL_ICU_VERSION . \"\n\";"
132
- - php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
133
- - mysql --version
134
- - psql --version
157
+ - php --version
158
+ - composer --version
159
+ - |
160
+ if [ $TASK_TESTS_PHP == 1 ]; then
161
+ php -r "echo INTL_ICU_VERSION . \"\n\";"
162
+ php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
163
+ psql --version
164
+ mysql --version
165
+ fi
166
+ - |
167
+ if [ $TASK_TESTS_JS == 1 ]; then
168
+ node --version
169
+ npm --version
170
+ fi
135
171
136
172
# initialize databases
137
- - travis_retry mysql -e 'CREATE DATABASE `yiitest`;';
138
- - mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;";
139
- - mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;";
140
- - psql -U postgres -c 'CREATE DATABASE yiitest;';
173
+ - |
174
+ if [ $TASK_TESTS_PHP == 1 ]; then
175
+ travis_retry mysql -e 'CREATE DATABASE `yiitest`;';
176
+ mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;";
177
+ mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;";
178
+ psql -U postgres -c 'CREATE DATABASE yiitest;';
179
+ fi
141
180
142
- # enable code coverage on PHP 7.1, only one PHP version needs to generate coverage data
181
+ # enable code coverage
143
182
- |
144
- if [ $TRAVIS_PHP_VERSION = '7.1' ]; then
183
+ if [ $TASK_TESTS_COVERAGE == 1 ]; then
145
184
PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
146
185
fi
147
186
148
187
149
188
script :
150
- # ensure no files contain UTF-8 byte order mark
151
- - if ! grep -rlI $'\xEF\xBB\xBF' framework/ ; then echo "no utf8 BOM found"; else echo "found utf8 BOM in some files. See above."; exit 1; fi
152
- # validate composer.json
153
- - composer validate --no-check-lock
154
- - cd framework && composer validate --no-check-lock && cd ..
155
- # run PHPUnit
156
- - vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,xcache,zenddata,cubrid
189
+ # test coding standards
190
+ - |
191
+ if [ $TASK_TESTS_CS == 1 ]; then
192
+ composer validate --no-check-lock
193
+ cd framework && composer validate --no-check-lock && cd ..
194
+ vendor/bin/php-cs-fixer --diff --dry-run -v fix
195
+ fi
196
+
197
+ # PHP tests
198
+ - |
199
+ if [ $TASK_TESTS_PHP == 1 ]; then
200
+ vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,xcache,zenddata,cubrid
201
+ fi
202
+
203
+ # JS tests
204
+ - |
205
+ if [ $TASK_TESTS_JS == 1 ]; then
206
+ npm test
207
+ fi
157
208
158
209
after_script :
159
210
- |
160
- if [ $TRAVIS_PHP_VERSION = '7.1' ]; then
211
+ if [ $TASK_TESTS_COVERAGE == 1 ]; then
161
212
travis_retry wget https://scrutinizer-ci.com/ocular.phar
162
213
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
163
214
fi
0 commit comments