-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
check.sh
executable file
·53 lines (42 loc) · 1.36 KB
/
check.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
#!/bin/sh
set -eu
if [ -d venv ]; then
# shellcheck disable=SC1091
if ! . venv/bin/activate; then
echo "Activating venv failed"
echo "You have a venv directory, but it isn't a valid Python virtual environment"
echo 'Either run "rm -r venv" or run "python -m venv venv"'
exit 1
fi
fi
pip_install="python3 -m pip install -U --disable-pip-version-check --require-virtualenv --quiet"
${pip_install} "pip>=24.0" wheel; exit_code="$?"
if [ "${exit_code}" -ne 0 ] && [ "${exit_code}" -ne 3 ]; then
echo "Installing pip>=23.0 and wheel failed"
exit 1
fi
${pip_install} -r requirements-dev.txt; exit_code="$?"
if [ "${exit_code}" -ne 0 ] && [ "${exit_code}" -ne 3 ]; then
echo "Installing requirements in requirements-dev.txt failed"
exit 1
fi
FAILED=0
echo isort:
python3 -m isort . || FAILED=$(( 2 | FAILED ))
echo Black:
if ! python3 -m black --check --diff --color .; then
echo 'Run "python3 -m black ." to reformat'
FAILED=$(( 4 | FAILED ))
fi
echo type checks:
./check_types.sh || FAILED=$(( 8 | FAILED ))
echo Flake8:
python3 -m flake8 --show-source || FAILED=$(( 16 | FAILED ))
echo Pylint:
python3 -m pylint . || FAILED=$(( 32 | FAILED ))
echo Bandit:
python3 -m bandit -q -c pyproject.toml -r typed_stream examples || FAILED=$(( 64 | FAILED ))
echo Tests:
python3 -m examples.test
coverage run -m tests || FAILED=$(( 128 | FAILED ))
exit "${FAILED}"