-
Notifications
You must be signed in to change notification settings - Fork 10
/
run-bisque.sh
executable file
·150 lines (130 loc) · 3.68 KB
/
run-bisque.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
#!/bin/bash
set -x
CMD=$1; shift
INDEX=${PY_INDEX:=https://biodev.ece.ucsb.edu/py/bisque/d8/+simple}
CONFIG=./config/site.cfg
export PIP_INDEX_URL=$INDEX
reports=$(pwd)/reports/
BUILD=/builder/
BQHOME=${BQHOME:=/source/}
VENV=${VENV:=/usr/lib/bisque}
if [ ! -d ${reports} ]; then
mkdir -p ${reports}
fi
echo "In " $(pwd) "BISQUE in" $BQHOME "Reports in" $reports
cd $BQHOME
# To be used during container builds
if [ "$CMD" = "build" ] ; then
let returncode=0
echo "BUILDING"
if [ ! -d ${VENV} ] ; then
virtualenv ${VENV}
fi
source ${VENV}/bin/activate
ls -l ${BUILD}/build-scripts.d
for f in ${BUILD}/build-scripts.d/*.sh; do
echo "Executing $f"
if [ -f $f ] && $f ; then
mv $f $f.finished
else
echo "FAILED $f"
let returncode=2
fi
done
if [ $returncode -ne 0 ] ; then
echo "BUILD Failed"
fi
exit $returncode
fi
source ${VENV}/bin/activate
if [ "$CMD" = "bootstrap" ] ; then
echo "BOOTSTRAPPING"
#/usr/share/python/bisque/bin/pip install -U pip==8.0.3 setuptools
#/usr/share/python/bisque/bin/pip install -r extras.txt
umask 0002
ls -l
if [ -d ${BUILD}boot-scripts.d ]; then
ls -l ${BUILD}boot-scripts.d
for f in ${BUILD}boot-scripts.d/B*.sh; do
echo "Executing **BOOT $f **"
[ -f "$f" ] && bash "$f"
done
fi
CMD=$1; shift
fi
if [ "$CMD" = "pylint" ] ; then
echo "Pylint testing"
# if [ ! -f ${BQHOME}config/site.cfg ] ; then
if [ ! -f config/site.cfg ] ; then
echo "Please run bootstrap first i.e. bootstrap pylint"
exit 1
fi
export PYLINTHOME=.
${BIN}pip install -i $INDEX pylint bisque_pylint_plugin
#paver -f /usr/share/bisque/pavement.py pylint $@
ARGS=""
while [[ "$1" == --* ]] ; do
ARGS="$ARGS $1" ; shift
done
${BIN}paver -f pavement.py pylint --output-format=parseable --disable=R,C,W,I $ARGS >${reports}pylint.log
CODE=$?
CMD=$1; shift
fi
if [ "$CMD" = "unit-tests" ] ; then
echo "Unit testing $@"
# if [ ! -f ${BQHOME}config/site.cfg ] ; then
if [ ! -f config/site.cfg ] ; then
echo "Please run bootstrap first i.e. bootstrap unit-tests"
exit 1
fi
ARGS=""
while [[ $1 == --* ]] ; do
ARGS="$ARGS $1" ; shift
done
${BIN}pip install pytest
${BIN}pip install -e ./pytest-bisque
python -m pytest -m unit --junitxml=${reports}pytest-unit.xml $ARGS
CODE=$?
CMD=$1; shift
fi
if [ "$CMD" = "function-tests" ] ; then
echo "Functional testing $@"
if [ ! -f ./config/site.cfg ] ; then
echo "Please run bootstrap first i.e. bootstrap functional-tests"
exit 1
fi
ARGS=""
while [[ $1 == --* ]] ; do
ARGS="$ARGS $1" ; shift
done
${BIN}pip install pytest
${BIN}pip install ./pytest-bisque
pytest -m functional --junitxml=${reports}pytest-functional.xml $ARGS
CODE=$?
CMD=$1; shift
fi
if [ "$CMD" = "start" ] ; then
#sleep 10 # wait for db to be ready
# if [ ! -f ${BQHOME}config/site.cfg ] ; then
if [ ! -f config/site.cfg ] ; then
echo "Please run bootstrap first i.e. bootstrap start"
exit 1
fi
if [ -d ${BUILD}start-scripts.d ]; then
ls -l ${BUILD}start-scripts.d
for f in ${BUILD}start-scripts.d/R*.sh; do
echo "Executing ** START $f **"
[ -f "$f" ] && bash "$f"
done
fi
#exec /builder/start-bisque.sh
fi
if [ "$CMD" = "bash" ] ; then
exec /bin/bash
fi
if [ "$CMD" = "" ] ; then
# exit $CODE # Exit with this code on error from pytest or pylint
exit 0
fi
echo "executing $CMD $@"
exec "$CMD" $@