Skip to content

Commit cb71e0f

Browse files
committed
add an option to automatically show failures details in GA
1 parent 45d72b5 commit cb71e0f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/scripts/run-random-tests.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Usage: ./run-random-tests.sh [options]
1111
# Options:
1212
# -q, --quiet Suppress debug output
13+
# -f, --show-failures Print failed test output in summary (auto-enabled in GitHub Actions)
1314
# -c, --component COMPONENT Test single COMPONENT (overrides config file)
1415
# -n, --max-jobs MAX_JOBS Limit concurrent test jobs (auto-detect if omitted)
1516
# -r, --repeat REPEAT Repeat full component run REPEAT times
@@ -52,6 +53,7 @@ component=""
5253
max_jobs=""
5354
repeat_count=1
5455
timeout_seconds=300
56+
show_failures=""
5557
first_result=true
5658
declare -a bg_pids=()
5759

@@ -277,6 +279,10 @@ parse_arguments() {
277279
quiet="--quiet"
278280
shift
279281
;;
282+
-f|--show-failures)
283+
show_failures="--show-failures"
284+
shift
285+
;;
280286
-c|--component)
281287
if [[ $# -lt 2 ]]; then
282288
print_error "Missing value for --component"
@@ -344,6 +350,7 @@ show_help() {
344350
echo ""
345351
echo -e "${YELLOW}Options:${RESET}"
346352
echo -e " ${GREEN}-q, --quiet${RESET} Suppress debug output"
353+
echo -e " ${GREEN}-f, --show-failures${RESET} Print failed test output in summary (auto-enabled in GitHub Actions)"
347354
echo -e " ${GREEN}-c, --component COMPONENT${RESET} Test single ${GREEN}COMPONENT${RESET} (overrides config file)"
348355
echo -e " ${GREEN}-n, --max-jobs MAX_JOBS${RESET} Limit concurrent test jobs (auto-detect if omitted)"
349356
echo -e " ${GREEN}-r, --repeat REPEAT${RESET} Repeat full component run ${GREEN}REPEAT${RESET} times"
@@ -758,6 +765,18 @@ print_summary() {
758765
fi
759766

760767
echo -e " ${RED}${RESET} ${BOLD}$failed_component${RESET} ($result_file)"
768+
769+
if [[ -n "${GITHUB_ACTIONS:-}" || "$show_failures" == "--show-failures" ]]; then
770+
if [[ -f "$result_file" ]]; then
771+
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
772+
echo "::group::Output: $failed_component"
773+
fi
774+
cat "$result_file"
775+
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
776+
echo "::endgroup::"
777+
fi
778+
fi
779+
fi
761780
done < <(printf '%s\n' "${failed_components[@]}" | sort)
762781
fi
763782

0 commit comments

Comments
 (0)