-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_build.sh
executable file
·53 lines (47 loc) · 1.35 KB
/
run_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
45
46
47
48
49
50
51
52
#!/bin/bash
abort()
{
echo "*** FAILED ***" >&2
exit 1
}
if [ "$#" -eq 0 ]; then
echo "No arguments provided. Usage:
1. '-local' to build local environment
2. '-docker' to build and run docker container
3. '-test' to run linter, formatter and tests"
elif [ $1 = "-local" ]; then
trap 'abort' 0
set -e
echo "Running format, linter and tests"
rm -rf .venv
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r ./requirements.txt
black plato
pylint --fail-under=10.0 plato
pytest --cov-fail-under=80 -v plato
elif [ $1 = "-test" ]; then
trap 'abort' 0
set -e
echo "Running format, linter and tests"
source .venv/bin/activate
black plato
pylint --fail-under=9.9 plato
pytest -v plato
elif [ $1 = "-docker" ]; then
echo "Building and running docker image"
docker stop smarti-container
docker rm smarti-container
docker rmi smarti-image
# build docker and run
docker build --tag smarti-image --build-arg CACHEBUST=$(date +%s) .
docker run --name smarti-container -p 8888:8888 -d smarti-image
else
echo "Wrong argument is provided. Usage:
1. '-local' to build local environment
2. '-docker' to build and run docker container
3. '-test' to run linter, formatter and tests"
fi
trap : 0
echo >&2 '*** DONE ***'