-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
199 lines (181 loc) · 7.11 KB
/
.travis.yml
File metadata and controls
199 lines (181 loc) · 7.11 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
language: python
cache: pip
os: linux
dist: bionic
services:
- postgresql
env:
- DEVELOPMENT=no DATABASE_ENGINE=postgres
jobs:
allow_failures:
- env: TRAVIS_PYTHON_VERSION=nightly
- env: ALLOW_FAILURE=yes
- os: osx
- os: windows
include:
#############################################################
### Ensure that all pre-commit hooks are satisfied (code
### formatting, checking for private keys, etc).
#############################################################
- stage: "Run tests"
name: "Pre-commit hooks are all satisfied"
python: 3.7
install:
- pip3 install pre-commit
- pre-commit install
script:
- pre-commit run --all-files
########################################################
### Unit testing using a MySQL database.
########################################################
- stage:
name: "Unit tests (Python 3.7)"
python: 3.7
before_script:
- export TEST_FLAGS="--tag unit-tests ${TEST_FLAGS}"
- stage:
name: "Unit tests (Python 3.8)"
python: 3.8
before_script:
- export TEST_FLAGS="--tag unit-tests ${TEST_FLAGS}"
#############################################################
### Functional tests
#############################################################
- stage:
name: "Functional tests (Firefox stable)"
python: 3.7
addons:
firefox: latest
services:
- xvfb
- postgresql
before_script:
# Selenium needs Geckodriver in order to test Firefox
- URL='https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz'
- wget "$URL" -O geckodriver.tar.gz
- tar xf geckodriver.tar.gz && rm geckodriver.tar.gz
- mv geckodriver ~/.local/bin/geckodriver
- export TEST_FLAGS="--tag functional-tests ${TEST_FLAGS}"
- firefox --version
- stage:
name: "Functional tests (Firefox beta)"
python: 3.7
env:
- ALLOW_FAILURE=yes
addons:
firefox: latest-beta
services:
- xvfb
- postgresql
before_install:
- export DEVELOPMENT=yes
- export DATABASE_ENGINE=postgres
before_script:
# Selenium needs Geckodriver in order to test Firefox
- URL='https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz'
- wget "$URL" -O geckodriver.tar.gz
- tar xf geckodriver.tar.gz && rm geckodriver.tar.gz
- mv geckodriver ~/.local/bin/geckodriver
- export TEST_FLAGS="--tag functional-tests ${TEST_FLAGS}"
- firefox --version
- stage:
name: "Functional tests (Chrome stable)"
python: 3.7
env:
- ALLOW_FAILURE=yes
addons:
chrome: stable
services:
- xvfb
- postgresql
before_script:
# Selenium needs Chromedriver in order to test Chrome
- URL='https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_linux64.zip'
- curl "$URL" -o chromedriver.zip
- unzip chromedriver.zip && rm chromedriver.zip
- mv chromedriver ~/.local/bin/chromedriver
- export TEST_FLAGS="--tag functional-tests ${TEST_FLAGS}"
- export BROWSER="Chrome"
- google-chrome --version
- stage:
name: "Functional tests (Chrome beta)"
python: 3.7
env:
- ALLOW_FAILURE=yes
addons:
chrome: beta
services:
- xvfb
- postgresql
before_install:
- export DEVELOPMENT=yes
- export DATABASE_ENGINE=postgres
before_script:
# Selenium needs Chromedriver in order to test Chrome
- URL='https://chromedriver.storage.googleapis.com/80.0.3987.16/chromedriver_linux64.zip'
- curl "$URL" -o chromedriver.zip
- unzip chromedriver.zip && rm chromedriver.zip
- mv chromedriver ~/.local/bin/chromedriver
- export TEST_FLAGS="--tag functional-tests ${TEST_FLAGS}"
- export BROWSER="Chrome"
- google-chrome --version
#############################################################
### Upload coverage results by running all of the tests (both
### unit tests and functional tests).
#############################################################
- stage: "Run full tests and upload coverage results"
python: 3.7
addons:
firefox: latest
services:
- xvfb
- postgresql
before_script:
- pip3 install codecov
# Selenium needs Geckodriver in order to test Firefox
- URL='https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz'
- wget "$URL" -O geckodriver.tar.gz
- tar xf geckodriver.tar.gz && rm geckodriver.tar.gz
- mv geckodriver ~/.local/bin/geckodriver
- export TEST_FLAGS=""
after_success:
- $PY -m codecov
install:
- pip3 install --upgrade pip
- pip3 install -r requirements.txt
- pip3 install coverage selenium tblib
# Create ~/.local/bin to store any additional binaries we may need for testing. Especially
# useful for the functional tests.
- mkdir -p ~/.local/bin/
# Export various useful environmental variables that didn't need to be specified in the
# env section.
- export DJANGO_SECRET_KEY="$(head -c 40 /dev/random | base64)"
- export TEST_FLAGS="--parallel 4"
- export PATH="~/.local/bin:$PATH"
- if [ $(which python3) ]; then export PY=python3; else export PY=python; fi
# MySQL environmental variables for tests that use a MySQL database
- export MYSQL_DATABASE="tecdb"
- export MYSQL_USER="root"
- export MYSQL_PASSWORD=""
- export DATABASE_HOST="localhost"
# Postgres environmental variables for tests using a PostgreSQL database
- export POSTGRES_DB="tecdb"
- export POSTGRES_USER="postgres"
- export POSTGRES_PASSWORD=""
# Set up database
- if [ $DATABASE_ENGINE = "mysql" ]; then mysql -e "CREATE DATABASE ${MYSQL_DATABASE};"; fi
- if [ $DATABASE_ENGINE = "postgres" ]; then psql -c "CREATE DATABASE ${POSTGRES_DB};" -U "${POSTGRES_USER}"; fi
script:
# This script is run for all tests
- echo $PATH
- echo $PY && which $PY
- echo $TEST_FLAGS
- cd src
- $PY manage.py makemigrations
- $PY manage.py migrate --run-syncdb
- coverage run --source="." manage.py test ${TEST_FLAGS}
notifications:
slack:
if: branch = master
on_pull_requests: false
secure: D7y2NJ3wrM+l8B45zquBUmFiXffS2xROkxAU+xX+Yr+iRxvUdX/42rrcWc0VWA/V5cnP7Hh5+u8was4oVJJmkDr+opcViVAlrFOs75paofhMdM+OCBaHZ0uL3aGGQXuIE+j0Ch+PJkqBATZa9qAdBwOFWeghph1Z9J6NS0CKB48MY2CBGQBFxH9IqL8dIkiClYaBVIfXLKg+y5aHNwzx4Zv8xuhHIaXh4ldHagX8sSruYqKK2X59nMGeBxv64YDcoM6/e0L7gmBJgEz/GhGVJJBLBy3Bq7qHEik1O0tE1kXst4aMhRyZTRHs+e13pQMggviWyOfsqJPXHkSnrwvfO1FDy9IcttOjmYWHegJafV5mgPdxwWlX+5v6YXKk8bJ+JnQ40CsbdIXUxdFTV5c1nEAdqsFQ/YnmqM5sCDRW8Qlbl8T+ZsPsTjVsj+ZoUbKkl5yXcH/N8kUhleWAP+O0Qd42rhEmHiICCeZm51qaXfBLDATHmqDiFuMRwLKs81p4FL6b2LNzhr8vILYCNew46xmvYeJyC6sLfeuI4C2/Hogaz9LErLMx9OlQZhKrj2UFhXFAEKu+Eyh1/xiEf/EJdmusRZV5OCUzRKZLdaADD37G9G0yLEtmDrhyYrnWbIoscp55gz0P348WarCodUYkagOyqLfpoeZttJsDFofkT6c=