ci: Rename travis_fold to ci_fold and add GHA support

This commit is contained in:
James McCoy 2020-11-13 12:45:39 -05:00
parent eb96bec4bb
commit 25a8385cd1
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
2 changed files with 31 additions and 14 deletions

View File

@ -13,16 +13,33 @@ FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
ANSI_CLEAR="\033[0K"
travis_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
if test "$TRAVIS" != "true" ; then
travis_fold() {
if test "$TRAVIS" = "true"; then
ci_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
elif test "$GITHUB_ACTIONS" = "true"; then
ci_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
case "$action" in
start)
echo "::group::${name}"
;;
end)
echo "::endgroup::"
;;
*)
:;;
esac
}
else
ci_fold() {
return 0
}
fi
@ -33,7 +50,7 @@ enter_suite() {
rm -f "${END_MARKER}"
local suite_name="$1"
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
travis_fold start "${NVIM_TEST_CURRENT_SUITE}"
ci_fold start "${NVIM_TEST_CURRENT_SUITE}"
set -x
}
@ -43,7 +60,7 @@ exit_suite() {
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}"
else
travis_fold end "${NVIM_TEST_CURRENT_SUITE}"
ci_fold end "${NVIM_TEST_CURRENT_SUITE}"
fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
if test "$1" != "--continue" ; then

View File

@ -66,7 +66,7 @@ main() {(
fi
fi
if test "$FAILED" = 1 ; then
travis_fold start "$NVIM_TEST_CURRENT_SUITE/$test_name"
ci_fold start "$NVIM_TEST_CURRENT_SUITE/$test_name"
fi
valgrind_check .
if test -n "$LOG_DIR" ; then
@ -78,7 +78,7 @@ main() {(
fi
rm -f "$tlog"
if test "$FAILED" = 1 ; then
travis_fold end "$NVIM_TEST_CURRENT_SUITE/$test_name"
ci_fold end "$NVIM_TEST_CURRENT_SUITE/$test_name"
fi
if test "$FAILED" = 1 ; then
echo "Test $test_name failed, see output above and summary for more details" >> test.log