Skip to content

check/all - exit with error status if any of checks failed #6561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions check/all
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $?
topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $?
cd "${topdir}" || exit $?

errors=()

# Parse arguments.
apply_arg=""
only_changed=0
Expand All @@ -57,29 +59,43 @@ for arg in "$@"; do
done

echo "Running misc"
check/misc
check/misc || errors+=( "check/misc failed" )

if [ ${only_changed} -ne 0 ]; then
echo "Running incremental pylint"
check/pylint-changed-files
check/pylint-changed-files || errors+=( "check/pylint-changed-files failed" )
else
echo "Running pylint"
check/pylint
check/pylint || errors+=( "check/pylint failed" )
fi

echo "Running mypy"
check/mypy
check/mypy || errors+=( "check/mypy failed" )

echo "Running incremental format"
check/format-incremental "${rev}" "${apply_arg}"
check/format-incremental "${rev}" "${apply_arg}" || errors+=( "check/format-incremental failed" )

if [ ${only_changed} -ne 0 ]; then
echo "Running pytest and incremental coverage on changed files"
check/pytest-changed-files-and-incremental-coverage "${rev}"
check/pytest-changed-files-and-incremental-coverage "${rev}" ||
errors+=( "check/pytest-changed-files-and-incremental-coverage failed" )
else
echo "Running pytest and incremental coverage"
check/pytest-and-incremental-coverage "${rev}"
check/pytest-and-incremental-coverage "${rev}" ||
errors+=( "check/pytest-and-incremental-coverage failed" )
fi

echo "Running doctest"
check/doctest
check/doctest || errors+=( "check/doctest failed" )

echo
if [[ "${#errors[@]}" == 0 ]]; then
echo "All checks passed."
result=0
else
printf "Some checks failed.\n\n"
printf " %s\n" "${errors[@]}"
result=1
fi

exit "${result}"