File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change 2
2
# Usage: script/cibuild [--no-package]
3
3
set -e
4
4
5
+ ROOTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
6
+ TMPDIR=" $ROOTDIR /test/tmp"
7
+
8
+ # Remove possible remnants of previous test runs
9
+ rm -rf " ${TMPDIR:? } /*"
10
+
11
+ print_test_results () {
12
+ if [ -n " $GITHUB_STEP_SUMMARY " ]; then
13
+ echo -e " ### Test results\n" >> " $GITHUB_STEP_SUMMARY "
14
+ echo " | Test suite | Result | Successful | Failed | Skipped | Duration |" >> " $GITHUB_STEP_SUMMARY "
15
+ echo " |---|---|--:|--:|--:|--:|" >> " $GITHUB_STEP_SUMMARY "
16
+ sort -V " $TMPDIR /results" >> " $GITHUB_STEP_SUMMARY "
17
+ fi
18
+ }
19
+
5
20
# Enable verbose logging of ssh commands
6
21
export GHE_VERBOSE_SSH=true
7
22
8
23
if ! find test -name " test-*.sh" -print0 | xargs -0 -n 1 /bin/bash; then
24
+ print_test_results
9
25
exit 1
10
26
fi
11
27
28
+ print_test_results
29
+
12
30
# Bail out when --no-package given
13
31
[ " $1 " = " --no-package" ] && exit 0
14
32
15
33
# files we'll md5sum at the end
16
34
pkg_files=
17
35
18
36
# Build the tarball
19
- ROOTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
20
- TMPDIR=" $ROOTDIR /test/tmp"
21
-
22
37
echo " Building tar.gz package ..."
23
38
if script/package-tarball 1> $TMPDIR /package-tarball.txt 2>&1 ; then
24
39
pkg_files=$( grep ' ^Package ' < $TMPDIR /package-tarball.txt | cut -f 2 -d ' ' )
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ TRASHDIR="$TMPDIR/$(basename "$0")-$$"
32
32
33
33
test_suite_file_name=" $( basename " ${BASH_SOURCE[1]} " ) "
34
34
test_suite_name=" ${GHE_TEST_SUITE_NAME:- ${test_suite_file_name% .* } } "
35
+ results_file=" $TMPDIR /results"
36
+ test_suite_before_time=$( date ' +%s.%3N' )
35
37
36
38
# Set GIT_{AUTHOR,COMMITTER}_{NAME,EMAIL}
37
39
# This removes the assumption that a git config that specifies these is present.
@@ -85,6 +87,27 @@ failures=0
85
87
atexit () {
86
88
res=$?
87
89
90
+ test_suite_after_time=$( date ' +%s.%3N' )
91
+ test_suite_elapsed_time=$( echo " scale=3; $test_suite_after_time - $test_suite_before_time " | bc)
92
+
93
+ # Temporarily redirect stdout output to results file
94
+ exec 3< & 1
95
+ exec 1>> " $results_file "
96
+
97
+ # Print test summary for this test suite
98
+ echo -n " | $test_suite_name | "
99
+
100
+ if [ " $failures " -eq " 0" ]; then
101
+ echo -n " :green_circle: passed"
102
+ else
103
+ echo -n " :red_circle: failed"
104
+ fi
105
+
106
+ printf " | $successes | $failures | $skipped | %.3f s |\\ n" " $test_suite_elapsed_time "
107
+
108
+ # Restore stdout
109
+ exec 1< & 3
110
+
88
111
[ -z " $KEEPTRASH " ] && rm -rf " $TRASHDIR "
89
112
if [ $failures -gt 0 ]; then
90
113
exit 1
You can’t perform that action at this time.
0 commit comments