-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
travis.yml.twig
174 lines (142 loc) · 5.14 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
# do not edit this file manually, instead run the generate:travis-yml console command
language: php
# We want to test against PHP 5.3.3/5.4/5.5
php:
- 5.5
- 5.4
- 5.3.3
# - 5.6
# - hhvm
# Separate different test suites
{% if existingEnv|default is empty -%}
env:
global:
- PLUGIN_NAME={{ pluginName|raw }}
{% if pluginName is empty %}
- PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR
{% else %}
- PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR/piwik
{% endif %}
{% if artifactsPass|default is not empty %} - secure: "{{ artifactsPass|raw }}"
{% endif %}
{% if githubToken|default is not empty %} - secure: "{{ githubToken|raw }}"
{% 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 %}
script: $PIWIK_ROOT_DIR/tests/travis/travis.sh
before_install:
# do not use the Zend allocator on PHP 5.3 since it will randomly segfault after program execution
- '[[ "$TRAVIS_PHP_VERSION" == 5.3* ]] && export USE_ZEND_ALLOC=0 || true'
install:
{% if pluginName is not empty %}
# 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
# checkout piwik in the current directory
- git clone https://github.com/piwik/piwik.git piwik
- cd piwik
- git fetch --all
- |
if [ "$TEST_AGAINST_PIWIK_BRANCH" == "" ]; then
if [ "$TEST_AGAINST_CORE" == "latest_stable" ]; then
export TEST_AGAINST_PIWIK_BRANCH=$(git describe --tags `git rev-list --tags --max-count=1`)
export TEST_AGAINST_PIWIK_BRANCH=`echo $TEST_AGAINST_PIWIK_BRANCH | tr -d ' ' | tr -d '\n'`
else
export TEST_AGAINST_PIWIK_BRANCH=master
fi
fi
- echo "Testing against '$TEST_AGAINST_PIWIK_BRANCH'"
- git checkout "$TEST_AGAINST_PIWIK_BRANCH"
- git submodule init
- git submodule update || true
# move plugin contents to folder in the plugins subdirectory
- rm -rf plugins/$PLUGIN_NAME
- mv ../$PLUGIN_NAME plugins
# make sure travis test scripts are always latest (so in older releases/branches, the latest scripts will still be used)
- git checkout master -- ./tests/travis ./plugins/CoreConsole
# clone dependent repos
- ./tests/travis/checkout_dependent_plugins.sh
{% else %}
# make sure travis test scripts are always latest (so in older releases/branches, the latest scripts will still be used)
- git fetch
- git checkout master -- ./tests/travis ./plugins/CoreConsole || true
{% endif %}
before_script:
- if [ -z "$TEST_SUITE" ];
then composer require satooshi/php-coveralls dev-master;
fi
- ./tests/travis/configure_git.sh
# print out mysql information
- mysql --version
- mysql -e "SELECT VERSION();"
# configure mysql
- mysql -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION'" # Travis default
# Uncomment to enable sql_mode STRICT_TRANS_TABLES (new default in Mysql 5.6)
#- mysql -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'"
- mysql -e "SELECT @@sql_mode;"
- mysql -e "SHOW GLOBAL VARIABLES;"
{% if pluginName is empty %}
# Start UI tests
- ./tests/travis/initiate_ui_tests.sh
{%- endif %}
# travis now complains about this failing 9 times out of 10, so removing it. hopefully the random failures it prevented won't come back
# - travis_retry composer self-update
- travis_retry composer install
# print out more debugging info
- uname -a
- date
- php -r "var_dump(gd_info());"
- mysql -e 'create database piwik_tests;'
# Make sure we use Python 2.6
- travis_retry sudo add-apt-repository ppa:fkrull/deadsnakes -y
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install python2.6 python2.6-dev
# Log Analytics works with Python 2.6 or 2.7 but we want to test on 2.6
- python2.6 --version
- python --version
- ./tests/travis/prepare.sh
- ./tests/travis/setup_webserver.sh
- export GENERATE_TRAVIS_YML_COMMAND='{{ consoleCommand|raw }}'
- ./tests/travis/autoupdate_travis_yml.sh
- cd tests/PHPUnit
after_script:
# change directory back to root travis dir
- cd $PIWIK_ROOT_DIR
- if [ -z "$TEST_SUITE" ];
then php vendor/bin/coveralls -v;
fi
# output contents of files w/ debugging info to screen
- cat /var/log/nginx/error.log
- cat $PIWIK_ROOT_DIR/tmp/php-fpm.log
- cat $PIWIK_ROOT_DIR/tmp/logs/piwik.log
- cat $PIWIK_ROOT_DIR/config/config.ini.php
# upload test artifacts (for debugging travis failures)
- ./tests/travis/upload_artifacts.sh
after_success:
- cd $PIWIK_ROOT_DIR
{% if pluginName is empty %} - ./tests/travis/generate_docs.sh{%- endif %}
{% if extraSections|default is not empty %}
{{ extraSections|trim|raw }}
{%- endif -%}