Skip to content

Commit

Permalink
check/all - exit with error status if any of checks failed (#6561)
Browse files Browse the repository at this point in the history
Also show status summary of executed checks.
  • Loading branch information
pavoljuhas authored Apr 12, 2024
1 parent be43d2b commit 7b7c93d
Showing 1 changed file with 24 additions and 8 deletions.
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}"

0 comments on commit 7b7c93d

Please sign in to comment.