forked from AequilibraE/aequilibrae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.sh
66 lines (54 loc) · 1021 Bytes
/
ci.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
#!/usr/bin/env bash
set -euo pipefail
main() {
local command=$1; shift
case $command in
setup_dev )
setup_pipenv
setup_precommit
;;
setup_docker )
setup_venv
setup_pipenv
;;
run_unit_tests | test )
setup_venv
run_unit_tests "$@"
;;
doc )
setup_venv
generate_docs
;;
lint )
setup_venv
run_linting
;;
** )
echo "unknown command: $command"
exit 1
;;
esac
}
run_unit_tests() {
python3 -m unittest discover -s test -p *_test.py
}
generate_docs() {
python3 -m pipenv run sphinx
}
run_linting() {
python3 -m flake8 --format=checkstyle > flake8.xml
}
setup_venv() {
virtualenv .venv
source .venv/bin/activate
}
setup_precommit() {
python3 -m pipenv run pre-commit-install
}
setup_pipenv() {
python3 --version
python3 -m pip install pipenv
python3 -m pipenv install --dev
}
echo "Running $0"
main "$@"