Skip to content

Commit

Permalink
more CI logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Mar 27, 2023
1 parent 540dbae commit 013e63f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ fi
fail_count=0
pass_count=0

inCIEnvironment () [[ ! -z "${CI:-}" ]]

echo "Compiling serve-d in release mode with ${DC}..."

inCIEnvironment && echo "::group::Building serve-d"
pushd ..
if [ "$DC" = "dmd" ]; then
echo "(Debug build because using DMD)"
Expand All @@ -23,6 +26,7 @@ else
dub build --build=release --compiler="${DC}"
fi
popd
inCIEnvironment && echo "::endgroup::"

tests="${@:1}"
if [ -z "$tests" ]; then
Expand All @@ -33,8 +37,9 @@ echo "Running tests with ${DC}..."

for testCase in $tests; do
# GitHub Actions grouping
echo "::group::$testCase"
echo -e "${YELLOW}$testCase${NORMAL}"

inCIEnvironment && echo "::group::$testCase"
pushd $testCase

if [ -f .needs_dcd ]; then
Expand All @@ -46,22 +51,24 @@ for testCase in $tests; do
fi

dub upgrade 2>&1

dub --compiler="${DC}" 2>&1
if [[ $? -eq 0 ]]; then
inCIEnvironment && echo "::endgroup::"
echo -e "${YELLOW}$testCase:${NORMAL} ... ${GREEN}Test Pass${NORMAL}";
let pass_count=pass_count+1
else
inCIEnvironment && echo "::endgroup::"
echo -e "${YELLOW}$testCase:${NORMAL} ... ${RED}Test Fail${NORMAL}";
let fail_count=fail_count+1
fi

popd
echo "::endgroup::"
done

if [[ $fail_count -eq 0 ]]; then
echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
else
echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
exit 1
fi
fi

0 comments on commit 013e63f

Please sign in to comment.