forked from praekeltfoundation/rapidpro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
105 lines (82 loc) · 3.42 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
# use container-based Ubuntu Trusty
dist:
- trusty
sudo:
- false
language: python
python:
- "3.6.6"
addons:
apt:
packages:
- postgresql-9.6-postgis-2.3
postgresql: "9.6"
services:
- redis-server
env:
- ES_VERSION=6.3.1 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
cache:
directories:
- "$HOME/.cache/pip"
install:
- wget ${ES_DOWNLOAD_URL}
- tar -xzf elasticsearch-${ES_VERSION}.tar.gz
- ./elasticsearch-${ES_VERSION}/bin/elasticsearch &
# 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 6 and install our node dependencies
- nvm install 6
- nvm use 6
- npm install
- npm run build
before_script:
- wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
# 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
# setup a goflow server instance
- GOFLOW_VERSION=0.12.2
- wget https://github.com/nyaruka/goflow/releases/download/v${GOFLOW_VERSION}/goflow_${GOFLOW_VERSION}_linux_amd64.tar.gz
- tar -xvf goflow_${GOFLOW_VERSION}_linux_amd64.tar.gz
# prepare rp-indexer binary
- RPINDEXER_VERSION=1.0.22
- 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
script:
# any non-zero error code should be treated as an immediate failure
- set -e
# test that everything is well formatted
- black --line-length=119 temba --check --quiet || (echo 'The source code could use a bit more black.' && exit 1)
# test PEP8 compliance on both Python 2 and 3
- flake8
# check for model changes not reflected in a migration
- python manage.py makemigrations --settings=temba.settings_travis --dry-run | grep 'No changes detected' || (echo 'There are changes which require migrations.' && exit 1)
# 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
# fire up goflow
- ./flowserver --log-level=warn &
- jobs
# run our Python tests
- coverage run manage.py test --settings=temba.settings_travis --noinput --verbosity=2
- set +e
after_success:
- pip install pyopenssl==17.4.0
- coveralls --rcfile .coveragerc_failcheck
- coverage report -i --rcfile .coveragerc
- coverage report -i --rcfile .coveragerc_failcheck --fail-under=100
notifications:
slack:
secure: "b2/RUpO6gWEDgOI/sEWsjt2cVnwp3hOWUSMnHpVuY0pZBzzrICZ5MeqEulwCoKy+8ohaCmYUL42RzJwq1v2FITo5YDeiLrqmrkYR0Zieel/Vey+o6sBdR6y2yPvWjBmydHNvfUyMshT5iqEn4bS6bjhm57F0rLJX7mTqp19A+68="