-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
executable file
·55 lines (43 loc) · 1.05 KB
/
entrypoint.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
#!/bin/bash
set -ax
mypy_args=""
# mypy output file
output_file=/tmp/mypy.out
lint_path=${1:-.}
mypy_version=$2
mypy_config_file=$3
flags=$4
requirements=$5
requirements_files=$6
# install specified mypy version, if defined else install latest
if [ ! -z "$mypy_version" ]; then
pip install mypy==${mypy_version}
else
pip install mypy
fi
# install requirements, if defined
if [ ! -z "$requirements" ]; then
pip install $requirements
fi
if [ -n "$requirements_files" ]; then
for file in $requirements_files; do
pip install -r "$file"
done
fi
# get mypy version
mypy --version
# concat mypy config file if provided
if [ ! -z "$mypy_config_file" ]; then
mypy_args+=" --config-file=${mypy_config_file}"
fi
# concat mypy flags if provided
if [ ! -z "$flags" ]; then
mypy_args += " $flags"
fi
# run mypy, tee output to file
# shellcheck disable=2086
mypy --show-column-numbers --hide-error-context ${mypy_args} ${lint_path} | tee "${output_file}"
exit_code="${PIPESTATUS[0]}"
# analyze output
python /github.py "${output_file}"
exit "$exit_code"