forked from volkszaehler/volkszaehler.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
136 lines (115 loc) · 3.81 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
134
135
136
sudo: false
language: php
php:
- 7.1
- 7.3
services:
- mysql
env:
# run composer by default
global:
- TRAVIS_TEST_EXCLUDES="--exclude-group slow,pushserver"
# docker credentials
- secure: "j3ss+fkR/BCZuqZP0YUliq7+BUW26k7JdzMlPLwkKuvRJMWY24uizluy+2hsS9amM56wFgwTlTFa2gX2GO9VF4P6b6qIJ7ao0lii9LEowHTeZhfuaWvIdpFCvRyMUsDA/k5z4tqwECWhSTVbkEQica3p0JZYDzSDhsCkvPnSTpw="
- secure: "e5qxaqWLnohr4At0ZW/yT/2i6Q9g2OVRwk0trqr13A0J7SeHN6Mxdc9H0U3KdLE4KkPa2pW52sYuLPAOCSfZFYae8q8HzIyAsWVSQQGBoEuSWVCfCu4Q4I2rydrSAYzadBPVm6MOoNsym/+fVb2sHTG8mX6nd/kf7AcWqb8AerM="
matrix:
- DB=mysql
matrix:
include:
# postgres
- php: 7.3
services: postgresql
env: DB=pgsql
# sqlite
- php: 7.3
env: DB=sqlite
# httpd-based
- php: 7.3
env: DB=mysql COMPONENT=HTTPD
# push-server
- php: 7.3
env: DB=mysql COMPONENT=PUSHD
# docker
- php: 7.3
env: DB=mysql COMPONENT=DOCKER
# jslint-only
- php: 7.3
env: DB= JSLINT=true
# 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
composer install
# add apc cache
phpenv config-add ./test/bin/apc.ini && printf "\n" | pecl install apcu
php -r 'echo(function_exists("apcu_store")?"APCu enabled":"APCu disabled");'
else
npm install -g gulp
npm install
fi
before_script:
# enable shell errors
- set -e
- cp etc/config.dist.yaml etc/config.yaml
- DATABASE=volkszaehler
- USER=root
- PASSWORD=
- if [ "$DB" = "pgsql" ]; then USER=postgres; fi
# create config file
- "sed -i \"s/driver: .*/driver: pdo_$DB/\" etc/config.yaml"
- "sed -i \"s/user: .*/user: $USER/\" etc/config.yaml"
- "sed -i \"s/password: .*/password: $PASSWORD/\" etc/config.yaml"
- "sed -i \"s/dbname: .*/dbname: $DATABASE/\" etc/config.yaml"
- cat etc/config.yaml
# 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
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
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
after_success:
- |
if [ "$COMPONENT" == "DOCKER" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$DOCKER_USER" != "" ]; then
docker login -u $DOCKER_USER -p $DOCKER_PASS
export REPO=volkszaehler/volkszaehler
docker pull $REPO:latest
docker build --cache-from $REPO:latest -f Dockerfile -t $REPO:latest .
docker push $REPO
fi