forked from volkszaehler/volkszaehler.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
76 lines (56 loc) · 2.33 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
language: php
php:
- "5.6"
- "5.5"
- "5.4"
- "5.3"
services:
- mysql
- postgresql
env:
- DB=mysql
- DB=pgsql
- DB=sqlite
notifications:
mail: "[email protected]"
irc: "chat.freenode.net#volkszaehler.org"
before_install:
- composer self-update
install:
- composer install
- npm install
before_script:
- cp etc/volkszaehler.conf.template.php etc/volkszaehler.conf.php
- DATABASE=travis
- USER=travis
- PASSWORD=
- echo $USER
# fix username before default rules apply
- sh -c "if [ '$DB' = 'pgsql' ]; then sed -i 's/'\''vz'\''/'\''postgres'\''/' etc/volkszaehler.conf.php; fi;"
- 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
- cat etc/volkszaehler.conf.php
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database $DATABASE;' -u $USER; fi;"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'create database $DATABASE;' -U postgres; fi;"
- sh -c "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
- php misc/tools/doctrine orm:schema-tool:create --dump-sql > misc/sql/schema.sql
- sed -i 's/ATTENTION/-- /' misc/sql/schema.sql
- echo ';' >> misc/sql/schema.sql
- cat misc/sql/schema.sql
- sh -c "if [ '$DB' = 'mysql' ]; then cat misc/sql/schema.sql | mysql -u $USER $DATABASE; fi;"
- sh -c "if [ '$DB' = 'pgsql' ]; then cat misc/sql/schema.sql | psql -U postgres $DATABASE; fi;"
- sh -c "if [ '$DB' = 'sqlite' ]; then cat misc/sql/schema.sql | sqlite3 sqlite.db3; sqlite3 sqlite.db3 .dump; fi;"
script:
- cd test
- phpunit --exclude-group aggregation --coverage-text
# re-run with aggregation enabled
- sed -i "s/\?>/\$config['aggregation']\ =\ true;\n?>/" ../etc/volkszaehler.conf.php
- sh -c "if [ '$DB' = 'mysql' ]; then phpunit --coverage-text; fi;"
# test running aggregation tool
- cd ..
- sh -c "if [ '$DB' = 'mysql' ]; then php misc/tools/aggregate.php run -m delta -l hour; fi;"
# jslint javascript sources
- gulp jshint