Welcome to mirror list, hosted at ThFree Co, Russian Federation.

travis.yml.twig « templates « CoreConsole « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bb65b9e49a47f45d7873d8a5de8a84b65ef878a2 (plain)
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
228
229
230
# do not edit this file manually, instead run the generate:travis-yml console command
{% if pluginName is empty %}
# if you are a Piwik core developer, edit this template file to auto generate the .travis.yml: https://github.com/piwik/piwik/blob/master/plugins/CoreConsole/templates/travis.yml.twig

# 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 phpVersions|default is empty %}
# We want to test against PHP 5.3.3/5.4/5.5
php:
  - 5.4
  - 5.3.3
  - 5.6
  - 5.5
#  - hhvm
{% else %}
php:
{% for version in phpVersions %}  - {{ version|raw }}
{% endfor %}
{% endif %}

# 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 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 %}

script: $PIWIK_ROOT_DIR/tests/travis/travis.sh

before_install:
{% if customTravisBuildSteps.before_install.before|default is not empty %}{{ customTravisBuildSteps.before_install.before|raw }}

{% endif %}
  # 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'
{% if customTravisBuildSteps.before_install.after|default is not empty %}

{{ customTravisBuildSteps.before_install.after|raw }}
{% endif %}

install:
{% if customTravisBuildSteps.install.before|default is not empty %}{{ customTravisBuildSteps.install.before|raw }}

{% endif %}
{% 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

  # copy .coveralls.yml if none exists
  - if [ ! -f ../coveralls.yml ];
    then cp .coveralls.yml ../coveralls.yml;
    fi

  # 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 %}
{% if customTravisBuildSteps.install.after|default is not empty %}

{{ customTravisBuildSteps.install.after|raw }}
{% endif %}

before_script:
{% if customTravisBuildSteps.before_script.before|default is not empty %}{{ customTravisBuildSteps.before_script.before|raw }}

{% endif %}
  - if ([ -n "$TEST_SUITE" ]);
    then phpenv config-rm xdebug.ini;
    fi
  - if ([ -z "$TEST_SUITE" ] || [ -n "$PLUGIN_NAME" ]);
    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,STRICT_TRANS_TABLES'" # 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'"
  - 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 -y --force-yes

  # 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
{% if customTravisBuildSteps.before_script.after|default is not empty %}

{{ customTravisBuildSteps.before_script.after|raw }}
{% endif %}

after_script:
{% if customTravisBuildSteps.after_script.before|default is not empty %}{{ customTravisBuildSteps.after_script.before|raw }}

{% endif %}
  # change directory back to root travis dir
  - cd $PIWIK_ROOT_DIR

  - if ([ -z "$TEST_SUITE" ] || [ -n "$PLUGIN_NAME" ]);
    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
{% if customTravisBuildSteps.after_script.after|default is not empty %}

{{ customTravisBuildSteps.after_script.after|raw }}
{% endif %}

after_success:
{% if customTravisBuildSteps.after_success.before|default is not empty %}{{ customTravisBuildSteps.after_success.before|raw }}

{% endif %}
  - cd $PIWIK_ROOT_DIR
{% if pluginName is empty %}  - ./tests/travis/generate_docs.sh
{% endif %}
{% if customTravisBuildSteps.after_success.after|default is not empty %}

{{ customTravisBuildSteps.after_success.after|raw }}
{% endif %}
{% if extraSections|default is not empty %}

{{ extraSections|trim|raw }}
{%- endif -%}