-
Notifications
You must be signed in to change notification settings - Fork 10
/
.travis.yml
132 lines (102 loc) · 4.02 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
# do not edit this file manually, instead run the generate:travis-yml console command
language: php
php:
- 7.2.5
services:
- redis-server
# Separate different test suites
env:
global:
- PLUGIN_NAME=CustomOptOut
- PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR/piwik
matrix:
- TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL
- TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_CORE=minimum_required_piwik
matrix:
exclude:
- php: 7.2.5
env: TEST_SUITE=PluginTests MYSQL_ADAPTER=PDO_MYSQL TEST_AGAINST_CORE=minimum_required_piwik
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:
# 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 -q https://github.com/piwik/piwik.git piwik
- cd piwik
- git fetch -q --all
- ./tests/travis/checkout_test_against_branch.sh
- git submodule init -q
- git submodule update -q || 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 || true;
fi
# make sure travis test scripts are always latest (so in older releases/branches, the latest scripts will still be used)
- git checkout master -q -- ./tests/travis ./plugins/TestRunner || true
# clone dependent repos
- ./tests/travis/checkout_dependent_plugins.sh
before_script:
- ./tests/travis/install_mysql_5.6.sh
- if ([ -z "$TEST_SUITE" ] || [ -n "$PLUGIN_NAME" ]);
then composer require satooshi/php-coveralls dev-master;
else
phpenv config-rm xdebug.ini;
fi
# 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
- ./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
# try to avoid mysql has gone away errors
- mysql -e "SET GLOBAL wait_timeout = 36000;"
- mysql -e "SET GLOBAL max_allowed_packet = 134209536;"
- mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';"
- mysql -e "SHOW VARIABLES LIKE 'wait_timeout';"
- mysql -e "SELECT @@sql_mode;"
# - mysql -e "SHOW GLOBAL VARIABLES;"
# 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 -i
- 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 > /dev/null
- travis_retry sudo apt-get install python2.6 python2.6-dev -y --force-yes > /dev/null
# 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
- cd tests/PHPUnit
after_script:
# 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
after_success:
- cd $PIWIK_ROOT_DIR