forked from rapidpro/rapidpro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
121 lines (94 loc) · 4.19 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
# use container-based Ubuntu Trusty
dist: bionic
sudo: true
language: python
python:
- "3.6.8"
services:
- redis-server
env:
global:
- DJANGO_SETTINGS_MODULE=temba.settings_travis
jobs:
- PGDB=11 PGIS=2.5
- PGDB=10 PGIS=2.4
cache:
directories:
- "$HOME/.cache/pip"
before_install:
# install the chosen PG version
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends install postgresql-$PGDB postgresql-client-$PGDB postgresql-$PGDB-postgis-$PGIS postgresql-$PGDB-postgis-$PGIS-scripts
- sudo -E sed -i -e '/local.*peer/s/postgres/all/' -e 's/peer\|md5/trust/g' /etc/postgresql/*/main/pg_hba.conf
- sudo -E sed -i 's/port = 5433/port = 5432/' /etc/postgresql/*/main/postgresql.conf
# give PG some time to finish setup
- sleep 10
# stop any running postgres versions
- sudo -E service postgresql stop 10
- sudo -E ps axuwww | grep -i postg
# possibly a Travis bug but data directory sometimes not initialized
- if [ ! -d /var/ramfs/postgresql/$PGDB/main ]; then sudo -u postgres /usr/lib/postgresql/$PGDB/bin/initdb -D /var/ramfs/postgresql/$PGDB/main; fi
# start the chosen PG version
- sudo -E systemctl -l restart postgresql@$PGDB-main
- sudo -E systemctl -l status postgresql@$PGDB-main
install:
# install Elasticsearch
- ES_VERSION=6.3.1
- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
- tar -xzf elasticsearch-${ES_VERSION}.tar.gz
- ./elasticsearch-${ES_VERSION}/bin/elasticsearch &
# install mailroom
- MAILROOM_VERSION=5.7.3
- wget https://github.com/nyaruka/mailroom/releases/download/v${MAILROOM_VERSION}/mailroom_${MAILROOM_VERSION}_linux_amd64.tar.gz
- tar -xvf mailroom_${MAILROOM_VERSION}_linux_amd64.tar.gz mailroom
# install rp-indexer
- RPINDEXER_VERSION=5.2.0
- wget https://github.com/nyaruka/rp-indexer/releases/download/v${RPINDEXER_VERSION}/rp-indexer_${RPINDEXER_VERSION}_linux_amd64.tar.gz
- tar -xvf rp-indexer_${RPINDEXER_VERSION}_linux_amd64.tar.gz
# install all Python dependencies
- travis_retry pip install --upgrade pip
- pip --version
- travis_retry pip install -r pip-freeze.txt --upgrade
- pip install coveralls
- pip install flake8
# switch to Node 10 and install our node dependencies
- nvm install 10
- nvm use 10
- npm install
before_script:
# setup test database
- psql -U postgres -c "CREATE USER temba WITH PASSWORD 'temba';"
- psql -U postgres -c "ALTER ROLE temba WITH SUPERUSER;"
- psql -d 'template1' -U postgres -c "CREATE EXTENSION postgis;"
- psql -d 'template1' -U postgres -c "CREATE EXTENSION postgis_topology;"
- psql -d 'template1' -U postgres -c "CREATE EXTENSION hstore;"
- psql -U temba postgres -c "CREATE DATABASE temba;"
# use dev settings file
- ln -s $TRAVIS_BUILD_DIR/temba/settings.py.dev $TRAVIS_BUILD_DIR/temba/settings.py
# wait until Elasticsearch is responsive
- wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
script:
# any non-zero error code should be treated as an immediate failure
- set -e
# test that everything is well formatted, no missing migrations etc
- ./code_check.py --debug $([[ "$TRAVIS_BRANCH" =~ "translations_django-po" ]] && echo "--skip-compilemessages")
# run our Javascript tests
- node_modules/karma/bin/karma start karma.conf.coffee --single-run --browsers PhantomJS
# check we can collect and compress all static files
- python manage.py collectstatic --noinput --verbosity=0
- (! python manage.py compress --extension=".haml" --settings=temba.settings_compress | grep 'Error') || exit 1
# install database schema
- python manage.py migrate
# fire up mailroom
- ./mailroom -db=postgres://temba:temba@localhost:5432/temba -redis=redis://localhost:6379/10 -log-level=info &
- jobs
# run our Python unit tests on same database
- coverage run manage.py test --keepdb --noinput --verbosity=2
- set +e
after_success:
- pip install codecov
- codecov
- coverage report -i
- coverage report -i --rcfile .coveragerc_todo
notifications:
slack:
secure: "b2/RUpO6gWEDgOI/sEWsjt2cVnwp3hOWUSMnHpVuY0pZBzzrICZ5MeqEulwCoKy+8ohaCmYUL42RzJwq1v2FITo5YDeiLrqmrkYR0Zieel/Vey+o6sBdR6y2yPvWjBmydHNvfUyMshT5iqEn4bS6bjhm57F0rLJX7mTqp19A+68="