forked from yiisoft/yii2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
199 lines (166 loc) · 4.79 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#
# Travis Setup
#
# use ubuntu trusty for newer version of nodejs, used for JS testing
dist: trusty
# faster builds on new travis setup not using sudo
sudo: false
# build only on master branches
# commented as this prevents people from running builds on their forks:
# https://github.com/yiisoft/yii2/commit/bd87be990fa238c6d5e326d0a171f38d02dc253a
#branches:
# only:
# - master
# - 2.1
#
# Test Matrix
#
language: php
env:
global:
- DEFAULT_COMPOSER_FLAGS="--prefer-dist --no-interaction --no-progress --optimize-autoloader"
- TASK_TESTS_PHP=1
- TASK_TESTS_JS=0
- TASK_TESTS_COVERAGE=0
services:
- memcached
- mysql
- postgresql
# cache vendor dirs
cache:
directories:
- vendor
- $HOME/.composer/cache
- $HOME/.npm
# try running against postgres 9.3
addons:
postgresql: "9.3"
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
matrix:
fast_finish: true
include:
# run tests coverage on PHP 7.1
- php: 7.1
env: TASK_TESTS_COVERAGE=1
- php: 7.0
- php: 5.6
- php: 5.5
- php: 5.4
# Test against HHVM 3.12 LTS version by using trusty
- php: hhvm-3.12
sudo: true
dist: trusty
group: edge # Use edge image until the next travis CI image update
addons:
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- mysql
# test against the latest HHVM version by using a newer image
- php: hhvm
sudo: true
dist: trusty
group: edge # Use edge image until the next travis CI image update
addons:
code_climate:
repo_token: 2935307212620b0e2228ab67eadd92c9f5501ddb60549d0d86007a354d56915b
postgresql: "9.3"
apt:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- mysql
- postgresql
- php: nightly
# have a separate branch for javascript tests
- language: node_js
node_js: 6
env: TASK_TESTS_PHP=0 TASK_TESTS_JS=1
dist: trusty
# overwrite services used for PHP tests
services:
allow_failures:
- php: nightly
install:
- |
if [[ $TASK_TESTS_COVERAGE != 1 && $TRAVIS_PHP_VERSION != hhv* ]]; then
# disable xdebug for performance reasons when code coverage is not needed. note: xdebug on hhvm is disabled by default
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
fi
# install composer dependencies
- travis_retry composer self-update
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [[ $TRAVIS_PHP_VERSION == "hhvm-3.12" ]]; then
# remove php-cs-fixer from composer dependencies on hhvm-3.12 - php-cs-fixer requires at least hhvm-3.18
composer remove friendsofphp/php-cs-fixer --dev
fi
- travis_retry composer install $DEFAULT_COMPOSER_FLAGS
# setup PHP extension
- |
if [ $TASK_TESTS_PHP == 1 ]; then
tests/data/travis/apc-setup.sh
tests/data/travis/memcache-setup.sh
tests/data/travis/imagick-setup.sh
fi
# setup JS test
- |
if [ $TASK_TESTS_JS == 1 ]; then
travis_retry npm install
fi
before_script:
# Disable the HHVM JIT for faster Unit Testing
- if [[ $TRAVIS_PHP_VERSION = hhv* ]]; then echo 'hhvm.jit = 0' >> /etc/hhvm/php.ini; fi
# show some versions and env information
- php --version
- composer --version
- |
if [ $TASK_TESTS_PHP == 1 ]; then
php -r "echo INTL_ICU_VERSION . \"\n\";"
php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"
psql --version
mysql --version
fi
- |
if [ $TASK_TESTS_JS == 1 ]; then
node --version
npm --version
fi
# initialize databases
- |
if [ $TASK_TESTS_PHP == 1 ]; then
travis_retry mysql -e 'CREATE DATABASE `yiitest`;';
mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED WITH mysql_native_password;";
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'localhost' WITH GRANT OPTION;";
psql -U postgres -c 'CREATE DATABASE yiitest;';
fi
# enable code coverage
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
PHPUNIT_FLAGS="--coverage-clover=coverage.clover"
fi
script:
# PHP tests
- |
if [ $TASK_TESTS_PHP == 1 ]; then
vendor/bin/phpunit --verbose $PHPUNIT_FLAGS --exclude-group mssql,oci,wincache,xcache,zenddata,cubrid
fi
# JS tests
- |
if [ $TASK_TESTS_JS == 1 ]; then
npm test
fi
after_script:
- |
if [ $TASK_TESTS_COVERAGE == 1 ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
fi