forked from volkszaehler/volkszaehler.org
/
.travis.yml
134 lines (111 loc) · 3.76 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
language: php
php:
- 7.0
- 7.1
- 7.2
services:
- mysql
# http://docs.travis-ci.com/user/migrating-from-legacy/
sudo: false
env:
# run composer by default
global:
- DEPENDENCIES=standard
- TRAVIS_TEST_EXCLUDES="--exclude-group slow,jpgraph,pushserver"
matrix:
- DB=mysql
matrix:
include:
# postgres
- php: 7.0
services: postresql
env: DB=pgsql
# sqlite
- php: 7.0
env: DB=sqlite
# httpd-based
- php: 7.0
env: DB=mysql COMPONENT=HTTPD
# push-server
- php: 7.0
env: DB=mysql COMPONENT=PUSHD
# from..to
- php: 7.0
env: DB=mysql DEPENDENCIES=lowest
# jslint-only
- php: 7.0
env: DB= DEPENDENCIES= JSLINT=true
notifications:
email: "volkszaehler-dev@lists.volkszaehler.org"
irc: "chat.freenode.net#volkszaehler.org"
# speedup build
cache:
directories:
- $COMPOSER_CACHE_DIR
- $HOME/.composer/cache
- node_modules
before_install:
# disable xdebug for composer performance
- if [ -e /home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then rm /home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi
install:
- if [ "$JSLINT" = true ]; then npm install -g gulp; npm install; fi
- if [ "$DEPENDENCIES" = "standard" ]; then composer install; fi
- if [ "$DEPENDENCIES" = "lowest" ]; then composer update --prefer-lowest -n; fi
# add apc cache
- |
if [ "$JSLINT" != true ]; then
phpenv config-add ./test/bin/apc.ini && printf "\n" | pecl install apcu
php -r 'echo(function_exists("apcu_store")?"APCu enabled":"APCu disabled");'
fi
before_script:
# enable shell errors
- set -e
- cp etc/volkszaehler.conf.template.php etc/volkszaehler.conf.php
- DATABASE=volkszaehler
- USER=root
- PASSWORD=
- if [ "$DB" = "pgsql" ]; then USER=postgres; fi
# create config file
- sed -i "s/'pdo_mysql'/'pdo_$DB'/" etc/volkszaehler.conf.php
- sed -i "s/'vz'/'$USER'/" etc/volkszaehler.conf.php
- sed -i "s/'demo'/'$PASSWORD'/" etc/volkszaehler.conf.php
- sed -i "s/'volkszaehler'/'$DATABASE'/" etc/volkszaehler.conf.php
- if [ "$DB" = "sqlite" ]; then sed -i "s/\?>/\$config['db']['path']\ =\ VZ_DIR.'\/sqlite.db3'\;\n?>/" etc/volkszaehler.conf.php; fi
- cat etc/volkszaehler.conf.php
# create database
- if [ "$DB" = "mysql" ]; then mysql -e "CREATE DATABASE $DATABASE;" -u $USER; fi
- if [ "$DB" = "pgsql" ]; then psql -c "CREATE DATABASE $DATABASE;" -U $USER; fi
# create schema
- if [ -n "$DB" ]; then php bin/doctrine orm:schema-tool:create; fi
# start middleware service
- |
if [ "$COMPONENT" = "HTTPD" ]; then
sed -i "s/testAdapter\" value=\".*\"/testAdapter\" value=\"HTTP\"/" phpunit.xml
vendor/bin/ppm start -c etc/middleware.json &
fi
# push server tests
- |
if [ "$COMPONENT" = "PUSHD" ]; then
sed -i "s/\?>/\$config['push']['enabled']\ =\ true\;\n?>/" etc/volkszaehler.conf.php
php bin/push-server &
fi
after_script:
# stop middleware service
- |
if [ "$COMPONENT" = "HTTPD" ]; then
vendor/bin/ppm stop -c etc/middleware.json
fi
script:
# run core tests
- if [ -n "$DB" ]; then vendor/bin/phpunit $TRAVIS_TEST_EXCLUDES,aggregation; fi
# run aggregation tests (mysql only)
- |
if [ "$DB" = "mysql" ]; then
sed -i "s/\?>/\$config['aggregation']\ =\ true;\n?>/" etc/volkszaehler.conf.php
php bin/aggregate run -m delta -l hour
vendor/bin/phpunit $TRAVIS_TEST_EXCLUDES
fi
# push server tests
- if [ "$COMPONENT" = "PUSHD" ]; then vendor/bin/phpunit --group pushserver; fi
# jslint javascript sources
- if [ "$JSLINT" = true ]; then gulp jshint; fi