/
travis.yml.twig
executable file
·227 lines (182 loc) · 7.93 KB
/
travis.yml.twig
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# do not edit this file manually, instead run the generate:travis-yml console command
{% if generationMode == 'core' %}
# if you are a Piwik core developer, to auto generate the .travis.yml:
# 1) edit this template file: https://github.com/matomo-org/travis-scripts/blob/master/generator/templates/travis.yml.twig
# 2) commit the updated submodule in `matomo/tests/travis/`
# when modifying this file, please consider whether your changes should apply to plugin .travis.yml files. if not, check whether the pluginName twig var is empty,
# otherwise your changes will be synced with every plugin that uses an auto generated .travis.yml
# also please test generation before committing by running ./console generate:travis-yml --core and ./console generate:travis-yml --plugin=CustomAlerts
# and making sure the .travis.yml files are changed correctly
{% endif %}
language: php
{% if generationMode == 'plugin' %}{% if phpVersions|default is empty %}
php:
- 5.6
- 5.5
{% else %}
php:
{% for version in phpVersions %} - {{ version|raw }}
{% endfor %}
{% endif %}
# - hhvm
{% endif %}
services:
- redis-server
{% if useTravisDistribution|default('trusty') != 'trusty' %}
- mysql
{% endif %}
addons:
apt:
{% if partials['addons.apt.sources']|default is not empty %} sources:
{{ partials['addons.apt.sources']|indent(6)|raw }}
{% endif %}
packages:
- nginx
- {% if useTravisDistribution|default('trusty') == 'trusty' %}realpath{% else %}coreutils{% endif %}
- lftp
{% if partials['addons.apt.packages']|default is not empty %} {{ partials['addons.apt.packages']|indent(6)|raw }}
{% endif %}
{% if partials['addons']|default is not empty %} {{ partials['addons']|indent(4)|raw }}
{% endif %}
git:
lfs_skip_smudge: true
# Separate different test suites
{% if existingEnv|default is empty -%}
env:
global:
{% if pluginName|default is not empty %} - PLUGIN_NAME={{ pluginName|raw }}
{% endif %}{% if generationMode == 'core' %}
- PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR
{% else %}
- PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR/matomo
# this variable controls the version of Matomo your tests will run against.
# by default it will run against the maximum support version read from plugin.json
# (PIWIK_TEST_TARGET=maximum_supported_piwik).
# You can also specify a specific Matomo version
# (PIWIK_TEST_TARGET=2.16.0-b1).
- PIWIK_TEST_TARGET=maximum_supported_piwik
{% endif %}
{% if extraGlobalEnvVars|default is not empty %}{% for var in extraGlobalEnvVars %} - {{ var|raw }}
{% endfor %}{% endif %}
matrix:
{% for test in testsToRun %} - TEST_SUITE={{ test.name|raw }} {{ test.vars|raw }}
{% endfor %}
{%- else -%}
env:
{{ existingEnv|trim|raw }}
{% endif %}
{% if existingMatrix|default is empty -%}
{%- if testsToExclude is not empty -%}
matrix:
exclude:
{% for testExclude in testsToExclude %}
{% if testExclude.description|default is not empty %} # {{ testExclude.description|raw }}
{% endif %}
- php: {{ testExclude.php|raw }}
env: {{ testExclude.env|raw }}
{% endfor %}
{%- endif -%}
{%- else -%}
matrix:
{{ existingMatrix|trim|raw }}
{% endif %}
dist: {{ useTravisDistribution|default('trusty') }}
{% if generationMode == 'plugin' %}
sudo: {% if useTravisContainerEnvironment|default %}false{% else %}required{% endif %}
{% endif %}
script: {{ travisShScriptLocation }}
before_install:
{% if customTravisBuildSteps.before_install.before|default is not empty %} {{ customTravisBuildSteps.before_install.before|indent(2)|raw }}
{% endif %}
{% if customTravisBuildSteps.before_install.after|default is not empty %}
{{ customTravisBuildSteps.before_install.after|indent(2)|raw }}
{% endif %}
{% if generationMode == 'core' %}
- . ./tests/travis/install_git_lfs.sh
{% endif %}
install:
{% if customTravisBuildSteps.install.before|default is not empty %} {{ customTravisBuildSteps.install.before|indent(2)|raw }}
{% endif %}
{% if generationMode == 'plugin' %}
# move all contents of current repo (which contains the plugin) to a new directory
- mkdir $PLUGIN_NAME
- cp -R !($PLUGIN_NAME) $PLUGIN_NAME
- cp -R .git/ $PLUGIN_NAME/
- cp .travis.yml $PLUGIN_NAME
{% endif %}
{% if generationMode != 'core' %}
# checkout matomo in the current directory
- git clone -q https://github.com/matomo-org/matomo.git matomo
- cd matomo
- git fetch -q --all
- git submodule update
# make sure travis-scripts repo is latest for initial travis setup
- '[ -d ./tests/travis/.git ] || sh -c "rm -rf ./tests/travis && git clone https://github.com/matomo-org/travis-scripts.git ./tests/travis"'
- cd ./tests/travis ; git checkout master ; cd ../..
{% else %}
- git fetch -q
{% endif %}
- export GENERATE_TRAVIS_YML_COMMAND="{{ consoleCommand|raw }}"
- '[[ "$TRAVIS_JOB_NUMBER" != *.1 || "$TRAVIS_PULL_REQUEST" != "false" ]] || ./tests/travis/autoupdate_travis_yml.sh'
{% if generationMode == 'plugin' or generationMode == 'piwik-tests-plugins' %}
- ./tests/travis/checkout_test_against_branch.sh
- '[ "$PLUGIN_NAME" == "" ] || [ ! -f ./tests/travis/check_plugin_compatible_with_piwik.php ] || php ./tests/travis/check_plugin_compatible_with_piwik.php "$PLUGIN_NAME"'
{% endif %}
- ./tests/travis/configure_git.sh
# travis now complains about this failing 9 times out of 10, so removing it
#- travis_retry composer self-update
- '[ "$SKIP_COMPOSER_INSTALL" == "1" ] || travis_retry composer install'
{% if generationMode == 'plugin' %}
# move plugin contents to folder in the plugins subdirectory
- rm -rf plugins/$PLUGIN_NAME
- mv ../$PLUGIN_NAME plugins
{% endif %}
{% if generationMode == 'plugin' or generationMode == 'piwik-tests-plugins' %}
# clone dependent repos
- ./tests/travis/checkout_dependent_plugins.sh
{% endif %}
{% if customTravisBuildSteps.install.after|default is not empty %}
{{ customTravisBuildSteps.install.after|indent(2)|raw }}{% endif %}
before_script:
{% if customTravisBuildSteps.before_script.before|default is not empty %} {{ customTravisBuildSteps.before_script.before|indent(2)|raw }}
{% endif %}
- phpenv config-rm xdebug.ini
# add always_populate_raw_post_data=-1 to php.ini
- echo "always_populate_raw_post_data=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# disable opcache to avoid random failures on travis
- echo "opcache.enable=0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# make tmpfs and run MySQL on it for reasonnable performance
- ./tests/travis/setup_mysql_tmpfs.sh
- ./tests/travis/prepare.sh
- ./tests/travis/setup_webserver.sh
- ./tests/travis/install_phantomjs.sh; export PATH=$PWD/travis_phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH;
- cd {{ travisShCwd }}
{% if customTravisBuildSteps.before_script.after|default is not empty %}
{{ customTravisBuildSteps.before_script.after|indent(2)|raw }}{% endif %}
after_script:
{% if customTravisBuildSteps.after_script.before|default is not empty %} {{ customTravisBuildSteps.after_script.before|indent(2)|raw }}
{% endif %}
# change directory back to root travis dir
- cd $PIWIK_ROOT_DIR
# output contents of files w/ debugging info to screen
- cat $PIWIK_ROOT_DIR/tests/travis/error.log
- cat $PIWIK_ROOT_DIR/tmp/php-fpm.log
- cat $PIWIK_ROOT_DIR/tmp/logs/matomo.log
- cat $PIWIK_ROOT_DIR/config/config.ini.php
# upload test artifacts (for debugging travis failures)
- ./tests/travis/upload_artifacts.sh
{% if customTravisBuildSteps.after_script.after|default is not empty %}
{{ customTravisBuildSteps.after_script.after|indent(2)|raw }}
{% endif %}
after_success:
{% if customTravisBuildSteps.after_success.before|default is not empty %} {{ customTravisBuildSteps.after_success.before|indent(2)|raw }}
{% endif %}
- cd $PIWIK_ROOT_DIR
{% if generationMode == 'core' %} - ./tests/travis/generate_docs.sh
{% endif %}
{% if customTravisBuildSteps.after_success.after|default is not empty %}
{{ customTravisBuildSteps.after_success.after|indent(2)|raw }}
{% endif %}
{% if extraSections|default is not empty %}
{{ extraSections|trim|raw }}
{%- endif -%}