-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.sh
executable file
·100 lines (81 loc) · 1.54 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Jean-Pierre LESUEUR (@DarkCoderSc)
# Description: Build Arcane Viewer Package
# Date: 2024-08-12
preflight_question() {
local question="$1"
echo "$question ? [y/N]"
read -r response
response=$(echo "$response" | tr '[:upper:]' '[:lower:]')
if [ "$response" != "y" ]; then
echo "(!) Do it!"
exit 1
fi
}
# arg: --skip-tox
skip_tox=false
# arg: --skip-flake
skip_flake=false
# arg: --skip-mypy
skip_mypy=false
# Parse arguments
for arg in "$@"; do
case $arg in
--skip-tox)
skip_tox=true
shift
;;
--skip-flake)
skip_flake=true
shift
;;
--skip-mypy)
skip_mypy=true
shift
;;
*)
;;
esac
done
# Preflight checks
preflight_question "Have you updated the arcane_viewer.arcane.constants.APP_VERSION"
preflight_question "Is this version reflected on the setup.py"
# Clean up things
echo "[+] Cleaning up things..."
rm -f dist/*.tar.gz
rm -f dist/*.whl
# Tox testing
if [ "$skip_tox" = false ]; then
echo "[+] Tox..."
tox
if [ $? -ne 0 ]; then
echo "(!) Failed!"
exit 1
fi
fi
# Run isort
echo "[+] isort..."
isort .
# Flake8 Testing
if [ "$skip_flake" = false ]; then
echo "[+] Flake8..."
flake8 .
if [ $? -ne 0 ]; then
echo "(!) Failed!"
exit 2
fi
fi
# mypy Testing
if [ "$skip_mypy" = false ]; then
echo "[+] Mypy..."
mypy .
if [ $? -ne 0 ]; then
echo "(!) Failed!"
exit 3
fi
fi
# Build Package
echo "[+] Building Package..."
python setup.py sdist bdist_wheel
python setup.py clean --all
echo "[*] Done."