twnet_parser/scripts/run_tests.sh
ChillerDragon 3df2a7fb12 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.
2023-04-07 13:08:56 +02:00

30 lines
902 B
Bash
Executable file

#!/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
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"