-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·44 lines (37 loc) · 1.33 KB
/
build.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
#! /bin/bash
# ANSI COLOR CODES
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[34m'
BOLD='\033[1m'
NC='\033[0m' # No Color
echo -e "${BOLD}================== CHECK VIRTUAL ENV ====================${NC}"
python -c 'import sys; print sys.real_prefix' 2>/dev/null && INVENV=1 || INVENV=0
if [ $INVENV -eq 0 ]; then
echo -e "${RED}ERROR: Not in virtual env! Source env by doing . venv/bin/activate${NC}";
exit 1;
fi
echo -e "${BOLD}================== RUNNING LINTER ====================${NC}"
linter_output=$(flake8 . --statistics)
if [ ! -z "$linter_output" ]; then
echo -e "${BOLD}${RED}FLAKE8 LINTER ERRORS:${NC}";
echo -e "${BOLD}${YELLOW}$linter_output${NC}"
exit 1;
fi
echo -e "${BOLD}================== END LINTER ====================${NC}"
echo
echo -e "${BOLD}================== COMPILING FILES ====================${NC}"
find client -name \*.pyc -delete
python -m py_compile client/api.py
echo -e "${BOLD}================== END COMPILE ====================${NC}"
echo
echo -e "${BOLD}================== RUNNING TESTS ====================${NC}"
PYTHONPATH=. nosetests test --with-coverage
code=$?
if [ "$code" != "0" ]; then
echo -e "${BOLD}${RED}NOT ALL UNIT TESTS PASSED!${NC}";
exit 1;
fi
echo -e "${BOLD}================== END TESTS ====================${NC}"
echo
echo -e "${BOLD}================== BUILD COMPLETE ====================${NC}"