forked from Freeseer/freeseer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·45 lines (35 loc) · 908 Bytes
/
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
#!/bin/bash
function run_or_fail {
WORKING_DIR="$1";
COMMAND=$2;
pushd $WORKING_DIR > /dev/null;
echo "@RUNNING: $COMMAND";
$COMMAND; STATUS=$?;
echo "@EXIT WITH STATUS: $STATUS";
popd > /dev/null;
if [ $STATUS -ne 0 ]; then
echo '@FAILING...';
exit $STATUS;
fi
echo;
}
function run_and_continue {
WORKING_DIR="$1";
COMMAND=$2;
pushd $WORKING_DIR > /dev/null;
echo "@RUNNING: $COMMAND";
$COMMAND; STATUS=$?;
echo "@EXIT WITH STATUS: $STATUS";
popd > /dev/null;
echo;
}
# Make sure we're in the root of the git repo
cd "$(git rev-parse --show-toplevel)"
# First lint and check "PEP8" compliance
run_or_fail "." "flake8 src";
# Run unit tests
run_or_fail "src" "python setup.py test"
# Upload unit test results to coveralls
run_and_continue "src" "coveralls"
# Build documentation
run_or_fail "docs" "make html"