diff --git a/dev/hooks/post-commit b/dev/hooks/post-commit new file mode 100755 index 0000000..8d31e89 --- /dev/null +++ b/dev/hooks/post-commit @@ -0,0 +1,43 @@ +#!/bin/bash + +root="$(pwd)" +branch=$(git symbolic-ref HEAD 2>/dev/null || echo "?") +branch="${branch##refs/heads/}" + +if ! [ "$branch" = "main" ]; then + exit 0; +fi + +cleanup() { + echo -e "\033[31mTests aborted.\033[0m" + rm -rf "$root/.test"; + exit; +} + +trap cleanup SIGHUP SIGINT SIGABRT SIGTERM; + +cat <> "$root/.test/results" +cd "$root/.test/repo" 2>> "$root/.test/results" || exit; +if make test-ci &>> "$root/.test/results"; then + grep 'Done fetching communities' -A1 --color=no "$root/.test/results"; + cat <