You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
949 B
Plaintext
44 lines
949 B
Plaintext
2 years ago
|
#!/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 <<EOF
|
||
|
I see you've committed to $branch! Time to test.
|
||
|
(Press ^C to abort.)
|
||
|
|
||
|
EOF
|
||
|
|
||
|
rm -rf "$root/.test"
|
||
|
mkdir "$root/.test" || exit;
|
||
|
cd "$root/.test" || exit;
|
||
|
git clone .. repo 2>> "$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 <<EOF
|
||
|
Tests passed.
|
||
|
Run \`make dev\` to test it yourself.
|
||
|
EOF
|
||
|
else
|
||
|
echo -e "\033[31mTests failed.\033[0m";
|
||
|
tail -n10 "$root/.test/results";
|
||
|
echo "See $root/.test/results for the full log."
|
||
|
exit;
|
||
|
fi
|
||
|
cd "$root" || exit;
|
||
|
# rm -rf .test
|