test: Add GitHub Actions test support

Authored-By: Jean-Philippe Evrard <open-source@a.spamming.party>
Co-Authored-By: James Shubin <james@shubin.ca>
Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
Jean-Philippe Evrard
2020-12-09 12:07:04 +01:00
committed by James Shubin
parent f31cce8ec2
commit e1bfe4a3ce
2 changed files with 70 additions and 2 deletions

View File

@@ -22,12 +22,14 @@ TIMEOUT="$timeout --kill-after=360s --signal=QUIT 300s"
in_ci() {
if [ $# -eq 0 ]; then
test -n "$CI" -o -n "$TRAVIS" -o -n "$JENKINS_URL"
test -n "$CI" -o -n "$GITHUB_ACTION" -o -n "$TRAVIS" -o -n "$JENKINS_URL"
return $?
fi
for var in "$@"; do
case "$var" in
github)
test -n "$GITHUB_ACTION" && return 0;;
travis)
test "$TRAVIS" = "true" && return 0;;
jenkins)
@@ -40,7 +42,11 @@ in_ci() {
}
fail_test() {
echo -e "FAIL: $@"
if in_ci github; then
echo "::error::$@"
else
echo -e "FAIL: $@"
fi
exit 1
}
@@ -53,10 +59,14 @@ function run-test() {
fold_start() {
if in_ci travis; then
echo -e "travis_fold:start:$1\033[33;1m${@:2}\033[0m"
elif in_ci github; then
echo "::group::$@"
fi
}
fold_end() {
if in_ci travis; then
echo -e "\ntravis_fold:end:$1\r"
elif in_ci github; then
echo "::endgroup::"
fi
}