Make the errors of run_tests.sh more intense

I did run ./scripts/run_tests.sh and thought they passed lol
pylint is not using colored output so in the green wall
of tests its easy to over see.

This should not happen again after this change.
This commit is contained in:
ChillerDragon 2023-04-07 13:08:56 +02:00
parent 5fc964e4ed
commit 3df2a7fb12

View file

@ -1,14 +1,29 @@
#!/bin/bash
RESET="\e[0m"
GREEN="\e[1;32m"
RED="\033[1;91m"
BG_RED="\033[0;101m"
# TODO: use yq to parse .gitlab-ci.yaml and auto run whatever the CI does
SCRIPT_ROOT="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 && pwd -P )"
cd "$SCRIPT_ROOT/.." || exit 1
bash "$SCRIPT_ROOT/lint_json.sh" || exit 1
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x || exit 1
pytest . || exit 1
pylint twnet_parser/ || exit 1
mypy twnet_parser/ || exit 1
err() {
local msg="$1"
printf '❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌\n'
printf '%b%s%b%b%s%b\n' "$BG_RED" "[FATAL FAILURE]" "$RESET" "$RED" " Error: $msg" "$RESET"
printf '❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌\n'
exit 1
}
bash "$SCRIPT_ROOT/lint_json.sh" || err "json lint failed!"
find . -type f -name '*.sh' -print0 | xargs -0 shellcheck -x || err "shellcheck failed!"
pytest . || err "pytest failed!"
pylint twnet_parser/ || err "pylint failed!"
mypy twnet_parser/ || err "mypy failed!"
printf "\n%b%s%b\n" "$GREEN" "✅ all tests passed." "$RESET"