/
run.sh
executable file
·73 lines (67 loc) · 1.69 KB
/
run.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
#!/bin/bash
build_front_end() {
cd /app/ui
npm install
npm run build
cd -
}
run_back_end_tests() {
cd /app
tox $@
}
run_front_end_tests() {
build_front_end
cd /app/ui/
npm test
}
if [ $1 == "public" ]; then
exec uwsgi --ini /app/uwsgi/public.ini --python-autoreload 1
elif [ $1 == "admin" ]; then
exec uwsgi --ini /app/uwsgi/admin.ini --python-autoreload 1
elif [ $1 == "admin-dev" ]; then
exec uwsgi --ini /app/uwsgi/admin.dev.ini --ini /app/uwsgi/admin.ini --python-autoreload 1
elif [ $1 == "upgrade-db" ]; then
if [ -z "${DBURI}" ]; then
echo "\${DBURI} must be set!"
exit 1
fi
exec python scripts/manage-db.py -d ${DBURI} upgrade
elif [ $1 == "cleanup-db" ]; then
if [ -z "${DBURI}" ]; then
echo "\${DBURI} must be set!"
exit 1
fi
if [ -z "${MAX_AGE}" ]; then
echo "\${MAX_AGE} must be set!"
exit 1
fi
if [ -z "${DELETE_RUN_TIME}" ]; then
echo "\${DELETE_RUN_TIME} must be set!"
exit 1
fi
exec scripts/run-batch-deletes.sh $DBURI $MAX_AGE $DELETE_RUN_TIME
elif [ $1 == "test" ]; then
shift
if [[ $1 == "backend" ]]; then
shift
run_back_end_tests $@
elif [[ $1 == "frontend" ]]; then
run_front_end_tests
else
run_back_end_tests $@
backend_rc=$?
run_front_end_tests
frontend_rc=$?
echo
if [[ $backend_rc == 0 && $frontend_rc == 0 ]]; then
echo "All tests pass!!!"
exit 0
else
echo "FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL. Some tests failed, see above for details."
exit 1
fi
fi
else
echo "unknown mode: $1"
exit 1
fi