-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathall
executable file
·78 lines (69 loc) · 2.31 KB
/
all
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
#!/usr/bin/env bash
################################################################################
# Runs multiple checks.
#
# The default set of checks most closely matches the tests run during
# a continuous integration test, however these do not match perfectly
# since those tests run on different architectures and environments.
#
# Defaults to the following tests:
# pylint
# mypy
# format-incremental
# pytest-and-incremental-coverage
# doctest
#
# Usage:
# check/all revision [BASE_REVISION] [--only-changed-files] [--apply-format-changes]
#
# BASE_REVISION is forwarded to format-incremental and to the pytest checks
# (pytest-and-incremental-coverage or pytest-changed-files). See those
# checks for how to specify this value.
#
# If --only-changed-files is specified, pytest-changed-files will be run
# instead of pytest-and-incremental-coverage.
#
# If --apply-format-changes is specified the --apply flag will be passed
# to format-incremental to apply the format changes suggested by the
# formatter.
################################################################################
# Get the working directory to the repo root.
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$(git rev-parse --show-toplevel)"
# Parse arguments.
apply_arg=""
only_changed=0
rev=""
for arg in $@; do
if [[ "${arg}" == "--only-changed-files" ]]; then
only_change=1
elif [[ "${arg}" == "--apply-format-changes" ]]; then
apply_arg="--apply"
elif [ -z "${rev}" ]; then
if [ "$(git cat-file -t ${arg} 2> /dev/null)" != "commit" ]; then
echo -e "\033[31mNo revision '${arg}'.\033[0m" >&2
exit 1
fi
rev="${arg}"
else
echo -e "\033[31mInvalid arguments. Expected [BASE_REVISION] [--only-changed-files] [--apply-format].\033[0m" >&2
exit 1
fi
done
echo "Running misc"
check/misc
echo "Running pylint"
check/pylint
echo "Running mypy"
check/mypy
echo "Running incremental format"
check/format-incremental "${rev}" "${apply_arg}"
if [ -z "${only_changed}" ]; then
echo "Running pytest and incremental coverage on changed files"
check/pytest-changed-files-and-incremental-coverage "${rev}"
else
echo "Running pytest and incremental coverage"
check/pytest-and-incremental-coverage "${rev}"
fi
echo "Running doctest"
check/doctest