-
Notifications
You must be signed in to change notification settings - Fork 9
/
.travis.yml
92 lines (85 loc) · 3.44 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
sudo: false
language: python
dist: xenial
matrix:
allow_failures:
python:
- "3.6"
env:
global:
- PIP_DISABLE_PIP_VERSION_CHECK=true
matrix:
- TOXENV=py27-django18
- TOXENV=py27-django19
- TOXENV=py27-django110
- TOXENV=py27-django111
- TOXENV=py36-django18
- TOXENV=py36-django19
- TOXENV=py36-django110
- TOXENV=py36-django111
- TOXENV=py36-django20
- TOXENV=py36-django21
- TOXENV=checkqa-python2
- TOXENV=checkqa
install:
# Create pip wrapper script, using travis_retry (a function) and
# inject it into tox.ini.
- mkdir -p bin
- PATH=$PWD/bin:$PATH
- PIP_INSTALL=bin/travis_pip_install
- printf '#!/bin/bash -x\n' > $PIP_INSTALL
- declare -f travis_retry >> $PIP_INSTALL
- printf '\necho "=====\nUsing pip-wrapper for \"$@\"\n=====\n" >&2\n' >> $PIP_INSTALL
# Handle "pip install -e" for usedevelop from tox.
- printf '\nif [ "$1" = "-e" ]; then pip install "$@"; exit $?; fi\n' >> $PIP_INSTALL
# First try to install from wheelhouse.
- printf 'for i in "$@"; do pip install --no-index --find-links=${PIP_WHEELHOUSE} "$i"; done\n' >> $PIP_INSTALL
# Then upgrade in case of outdated wheelhouse.
- printf 'for i in "$@"; do travis_retry pip install --upgrade "$i"; done\n' >> $PIP_INSTALL
# ..and add the new/current wheels.
- printf 'pip wheel --wheel-dir=${PIP_WHEELHOUSE} --find-links=${PIP_WHEELHOUSE} "$@"\n' >> $PIP_INSTALL
- chmod +x $PIP_INSTALL
# Adjust tox.ini.
- sed -i.bak 's/^\[testenv\]/\0\ninstall_command = travis_pip_install {opts} {packages}/' tox.ini
- diff tox.ini tox.ini.bak && { echo "tox.ini was not changed."; return 1; } || true
- sed -i.bak 's/whitelist_externals =/\0\n travis_pip_install/' tox.ini
- diff tox.ini tox.ini.bak && { echo "tox.ini was not changed."; return 1; } || true
# Inject wheel dependency into tox.ini, for travis_pip_install.
- sed -i.bak -e 's/deps =.*/\0\n wheel/' tox.ini
- diff tox.ini tox.ini.bak && { echo "tox.ini was not changed."; return 1; } || true
# Conditionally inject postgres dependency and DSM setting into tox.ini.
- if [ "$USE_POSTGRES" = 1 ]; then sed -i.bak -e 's/deps =/\0\n psycopg2/' -e 's/DJANGO_SETTINGS_MODULE=test_project.settings/\0_postgres/' tox.ini && diff tox.ini tox.ini.bak && { echo "tox.ini was not changed."; return 1; } || true; fi
- cat $PIP_INSTALL
- cat tox.ini
# Create wheels (skips existing ones from the cached wheelhouse).
- export PIP_WHEELHOUSE=$PWD/wheelhouse
- travis_pip_install tox
- if [ -n "$EXTRAREQ" ]; then travis_pip_install $EXTRAREQ; fi
- pip freeze
before_script:
- RUN_TESTS="tox -- rules_light"
# Run tests either with or without coverage (being installed).
- command -v coveralls && RUN_TESTS="$RUN_TESTS --cov" || true
before_install:
- npm install phantomjs
- phantomjs --version
script:
- ls -l $PWD/wheelhouse > /tmp/wheelhouse.before
- $RUN_TESTS
- ls -l $PWD/wheelhouse > /tmp/wheelhouse.after
- diff /tmp/wheelhouse.before /tmp/wheelhouse.after || true
- test -d .tox/$TOXENV/log && cat .tox/$TOXENV/log/*.log || true
after_success:
- command -v coveralls && { coveralls; return $?; } || true
notifications:
irc:
channels:
- "irc.freenode.org#yourlabs"
template:
- "%{repository} (%{commit} %{author}) : %{message} %{build_url} %{compare_url}"
# Persistent cache across builds (http://docs.travis-ci.com/user/caching/).
cache:
directories:
- $PWD/wheelhouse
before_cache:
- rm -f .tox/$TOXENV/log/*.log