|
1 | 1 | # Library of functions shared by all CI scripts
|
2 | 2 |
|
| 3 | +if test true != "$GITHUB_ACTIONS" |
| 4 | +then |
| 5 | + begin_group () { :; } |
| 6 | + end_group () { :; } |
| 7 | + |
| 8 | + group () { |
| 9 | + shift |
| 10 | + "$@" |
| 11 | + } |
| 12 | + set -x |
| 13 | +else |
| 14 | + begin_group () { |
| 15 | + need_to_end_group=t |
| 16 | + echo "::group::$1" >&2 |
| 17 | + set -x |
| 18 | + } |
| 19 | + |
| 20 | + end_group () { |
| 21 | + test -n "$need_to_end_group" || return 0 |
| 22 | + set +x |
| 23 | + need_to_end_group= |
| 24 | + echo '::endgroup::' >&2 |
| 25 | + } |
| 26 | + trap end_group EXIT |
| 27 | + |
| 28 | + group () { |
| 29 | + set +x |
| 30 | + begin_group "$1" |
| 31 | + shift |
| 32 | + "$@" |
| 33 | + res=$? |
| 34 | + end_group |
| 35 | + return $res |
| 36 | + } |
| 37 | + |
| 38 | + begin_group "CI setup" |
| 39 | +fi |
| 40 | + |
| 41 | +# Set 'exit on error' for all CI scripts to let the caller know that |
| 42 | +# something went wrong. |
| 43 | +# |
| 44 | +# We already enabled tracing executed commands earlier. This helps by showing |
| 45 | +# how # environment variables are set and and dependencies are installed. |
| 46 | +set -e |
| 47 | + |
3 | 48 | skip_branch_tip_with_tag () {
|
4 | 49 | # Sometimes, a branch is pushed at the same time the tag that points
|
5 | 50 | # at the same commit as the tip of the branch is pushed, and building
|
@@ -88,12 +133,6 @@ export TERM=${TERM:-dumb}
|
88 | 133 | # Clear MAKEFLAGS that may come from the outside world.
|
89 | 134 | export MAKEFLAGS=
|
90 | 135 |
|
91 |
| -# Set 'exit on error' for all CI scripts to let the caller know that |
92 |
| -# something went wrong. |
93 |
| -# Set tracing executed commands, primarily setting environment variables |
94 |
| -# and installing dependencies. |
95 |
| -set -ex |
96 |
| - |
97 | 136 | if test -n "$SYSTEM_COLLECTIONURI" || test -n "$SYSTEM_TASKDEFINITIONSURI"
|
98 | 137 | then
|
99 | 138 | CI_TYPE=azure-pipelines
|
|
138 | 177 | test_name="${test_exit%.exit}"
|
139 | 178 | test_name="${test_name##*/}"
|
140 | 179 | printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
|
141 |
| - cat "t/test-results/$test_name.out" |
| 180 | + group "Failed test: $test_name" cat "t/test-results/$test_name.out" |
142 | 181 |
|
143 | 182 | trash_dir="t/trash directory.$test_name"
|
144 | 183 | cp "t/test-results/$test_name.out" t/failed-test-artifacts/
|
@@ -233,3 +272,6 @@ linux-leaks)
|
233 | 272 | esac
|
234 | 273 |
|
235 | 274 | MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
|
| 275 | + |
| 276 | +end_group |
| 277 | +set -x |
0 commit comments