forked from GeotrekCE/Geotrek-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
87 lines (75 loc) · 3.71 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
language: python
python:
- "2.7"
env:
- ACTION=test
- ACTION=deploy
- ACTION=integration
- ACTION=codestyle
matrix:
allow_failures:
- env: ACTION=integration
cache:
- apt
before_install:
# Download bundle of python eggs, and use it as download cache
- mkdir -p $HOME/.buildout/downloads
- echo -e "[buildout]\ndownload-cache=$HOME/.buildout/downloads" > $HOME/.buildout/default.cfg
- "wget http://prod-geotrek-fr.makina-corpus.net/media/upload/geotrek-bundle.tar.gz -O /tmp/geotrek-bundle.tar.gz || true"
- "tar -zxf /tmp/geotrek-bundle.tar.gz --directory=$HOME || true"
# GDAL-fix -- packaging is miserable, no way to obtain libgdal-dev for libgdal1 when libgdal1h available
- sudo apt-get update -qq
- sudo apt-get download -y libgdal-dev
- sudo dpkg-deb -x libgdal-dev*.deb /
- sudo ln -sf /usr/lib/libgdal.so.1 /usr/lib/libgdal.so
- sudo ldconfig
# GDAL-fix -- Do not install GDAL from install script
- sed -i "s/gdal-bin//" install.sh
- sed -i "s/libgdal-dev//" install.sh
- sed -i "s/GDAL=.*/GDAL=1.9.0/" conf/buildout.cfg
# GDAL-fix -- Do not install postgis locally, trick test on host
- make etc/settings.ini
- sed -i "s/localhost/127.0.0.1/" etc/settings.ini
# GDAL-fix -- Use Travis PostGIS, initialize DB
- sudo sed -i "s/^client_min_messages.*$/client_min_messages = log/" /etc/postgresql/*/main/postgresql.conf
- sudo /etc/init.d/postgresql restart
- psql -c "CREATE DATABASE geotrekdb ENCODING 'UTF8' TEMPLATE template0;" -U postgres
- psql -c 'CREATE EXTENSION postgis;' -U postgres -d geotrekdb
- psql -c "CREATE USER geotrek WITH PASSWORD 'geotrek';" -U postgres
# django tests require to be superuser to create test db with postgis extension
- if [[ $ACTION == test ]]; then psql -c "ALTER USER geotrek SUPERUSER;" -U postgres; fi
- psql -c 'GRANT ALL PRIVILEGES ON DATABASE geotrekdb TO geotrek;' -U postgres
- psql -c 'GRANT ALL ON spatial_ref_sys,geometry_columns,raster_columns TO geotrek;' -U postgres -d geotrekdb
# GDAL-fix -- End (remove with Ubuntu 14.04)
# Enable experimental features during navigation tests
- sed -i "s/experimental = False/experimental = True/" etc/settings.ini
install:
- if [[ $ACTION != codestyle ]]; then deactivate; fi
- if [[ $ACTION == codestyle ]]; then pip install flake8; fi
- if [[ $ACTION == test ]]; then ./install.sh --tests || cat ./install.log; fi
- if [[ $ACTION == deploy || $ACTION == integration ]]; then ./install.sh --noinput || cat ./install.log; fi
script:
- if [[ $ACTION == codestyle ]]; then flake8 --exclude "" --ignore=E501,F403,F405 geotrek/settings; fi
- if [[ $ACTION == codestyle ]]; then flake8 geotrek; fi
- if [[ $ACTION == codestyle ]]; then find geotrek/*/migrations/*.py | xargs grep -l srid | xargs grep -L SRID; fi
- if [[ $ACTION == deploy || $ACTION == integration ]]; then make load_demo; fi
- if [[ $ACTION == deploy ]]; then make test_nav host=localhost port=80; fi
- if [[ $ACTION == integration ]]; then make test_export host=localhost port=80; fi
- if [[ $ACTION == test ]]; then make env_test test; fi
- if [[ $ACTION == test ]]; then make test_js; fi
# Re-run for coverage
- if [[ $ACTION == test ]]; then rm -rf ./var/cache/* ./var/media/maps/*; fi
- if [[ $ACTION == test ]]; then ./bin/coverage run ./bin/django test geotrek; fi
after_success:
# Report coverage results to coveralls.io
- if [[ $ACTION == test ]]; then ./bin/coverage report -m; fi
- if [[ $ACTION == test ]]; then sudo pip install coveralls; fi
- if [[ $ACTION == test ]]; then coveralls; fi
after_failure:
- cat install.log
- cat var/log/geotrek.log
- cat var/log/nginx-access.log
- cat var/log/nginx-error.log
- cat var/log/supervisord.log
notifications:
irc: "irc.freenode.org#geotrek"