forked from snowplow/snowplow-python-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-tests.sh
executable file
·204 lines (169 loc) · 4.4 KB
/
run-tests.sh
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
200
201
202
203
204
#!/bin/bash
# Run the Snowplow Tracker test suite.
# Quit on failure
set -e
# Need to execute from this dir
cd $(dirname $0)
# pytest because it has a neat output
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
function deploy {
# pyenv install 3.5.10
if [ ! -e ~/.pyenv/versions/tracker35 ]; then
pyenv virtualenv 3.5.10 tracker35
pyenv activate tracker35
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker35redis ]; then
pyenv virtualenv 3.5.10 tracker35redis
pyenv activate tracker35redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
# pyenv install 3.6.14
if [ ! -e ~/.pyenv/versions/tracker36 ]; then
pyenv virtualenv 3.6.14 tracker36
pyenv activate tracker36
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker36redis ]; then
pyenv virtualenv 3.6.14 tracker36redis
pyenv activate tracker36redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
# pyenv install 3.7.11
if [ ! -e ~/.pyenv/versions/tracker37 ]; then
pyenv virtualenv 3.7.11 tracker37
pyenv activate tracker37
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker37redis ]; then
pyenv virtualenv 3.7.11 tracker37redis
pyenv activate tracker37redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
# pyenv install 3.8.11
if [ ! -e ~/.pyenv/versions/tracker38 ]; then
pyenv virtualenv 3.8.11 tracker38
pyenv activate tracker38
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker38redis ]; then
pyenv virtualenv 3.8.11 tracker38redis
pyenv activate tracker38redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
# pyenv install 3.9.6
if [ ! -e ~/.pyenv/versions/tracker39 ]; then
pyenv virtualenv 3.9.6 tracker39
pyenv activate tracker39
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker39redis ]; then
pyenv virtualenv 3.9.6 tracker39redis
pyenv activate tracker39redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
# pyenv install 3.10.1
if [ ! -e ~/.pyenv/versions/tracker310 ]; then
pyenv virtualenv 3.10.1 tracker310
pyenv activate tracker310
pip install .
pip install -r requirements-test.txt
source deactivate
fi
if [ ! -e ~/.pyenv/versions/tracker310redis ]; then
pyenv virtualenv 3.10.1 tracker310redis
pyenv activate tracker310redis
pip install .[redis]
pip install -r requirements-test.txt
source deactivate
fi
}
function run_tests {
pyenv activate tracker35
pytest
source deactivate
pyenv activate tracker35redis
pytest
source deactivate
pyenv activate tracker36
pytest
source deactivate
pyenv activate tracker36redis
pytest
source deactivate
pyenv activate tracker37
pytest
source deactivate
pyenv activate tracker37redis
pytest
source deactivate
pyenv activate tracker38
pytest
source deactivate
pyenv activate tracker38redis
pytest
source deactivate
pyenv activate tracker39
pytest
source deactivate
pyenv activate tracker39redis
pytest
source deactivate
pyenv activate tracker310
pytest
source deactivate
pyenv activate tracker310redis
pytest
source deactivate
}
function refresh_deploy {
pyenv uninstall -f tracker35
pyenv uninstall -f tracker35redis
pyenv uninstall -f tracker36
pyenv uninstall -f tracker36redis
pyenv uninstall -f tracker37
pyenv uninstall -f tracker37redis
pyenv uninstall -f tracker38
pyenv uninstall -f tracker38redis
pyenv uninstall -f tracker39
pyenv uninstall -f tracker39redis
pyenv uninstall -f tracker310
pyenv uninstall -f tracker310redis
}
case "$1" in
"deploy") echo "Deploying python environments. This can take few minutes"
deploy
;;
"test") echo "Running tests"
run_tests
;;
"refresh") echo "Refreshing python environments"
refresh_deploy
deploy
;;
*) echo "Unknown subcommand. Specify deploy or test"
exit 1
;;
esac