-
Notifications
You must be signed in to change notification settings - Fork 2
/
ci-test.sh
43 lines (33 loc) · 1.2 KB
/
ci-test.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
#!/usr/bin/env bash
if [ ! -f "$1" ]; then
echo "Usage: . test.sh [/path/to/manage.py]";
return 1;
fi
# Cleanup Previous Runs
rm -f .coverage
echo "Running Unit Tests..."
micromamba run -n tethys coverage run -a --rcfile=ci-coverage.ini -m unittest -v tethysext.atcore.tests.unit_tests
unittest_ret_val=$?
echo "Running Intermediate Tests..."
micromamba run -n tethys coverage run -a --rcfile=ci-coverage.ini "$1" test -v 2 tethysext.atcore.tests.integrated_tests
intermediate_ret_val=$?
# Minimum Required Coverage
minimum_required_coverage=90
micromamba run -n tethys coverage report -m --rcfile=ci-coverage.ini --skip-covered --fail-under $minimum_required_coverage
coverage_ret_val=$?
#echo "Linting..."
micromamba run -n tethys flake8
echo "Testing Complete"
if [ "$unittest_ret_val" -ne "0" ] || [ "$intermediate_ret_val" -ne "0" ] || [ "$coverage_ret_val" -ne "0" ]; then
if [ "$unittest_ret_val" -ne "0" ]; then
echo "Unit Tests Failed!!!"
fi
if [ "$intermediate_ret_val" -ne "0" ]; then
echo "Intermediate Tests Failed!!!"
fi
if [ "$coverage_ret_val" -ne "0" ]; then
echo "Below Minimum Coverage of $minimum_required_coverage!!!"
fi
return 1
fi
return 0