xref: /freebsd/sys/contrib/openzfs/.github/workflows/scripts/qemu-9-summary-page.sh (revision c5f3a7f62217f20f0c7b2c4fc3fb2646336b0802)
1#!/usr/bin/env bash
2
3######################################################################
4# 9) generate github summary page of all the testings
5######################################################################
6
7set -eu
8
9function output() {
10  echo -e $* >> "out-$logfile.md"
11}
12
13function outfile() {
14  test -s "$1" || return
15  cat "$1" >> "out-$logfile.md"
16}
17
18function outfile_plain() {
19  test -s "$1" || return
20  output "<pre>"
21  cat "$1" >> "out-$logfile.md"
22  output "</pre>"
23}
24
25function send2github() {
26  test -f "$1" || exit 0
27  dd if="$1" bs=1023k count=1 >> $GITHUB_STEP_SUMMARY
28}
29
30# https://docs.github.com/en/enterprise-server@3.6/actions/using-workflows/workflow-commands-for-github-actions#step-isolation-and-limits
31# Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB.
32# [ ] can not show all error findings here
33# [x] split files into smaller ones and create additional steps
34
35# first call, generate all summaries
36if [ ! -f out-1.md ]; then
37  logfile="1"
38  for tarfile in Logs-functional-*/qemu-*.tar; do
39    rm -rf vm* *.txt
40    if [ ! -s "$tarfile" ]; then
41      output "\n## Functional Tests: unknown\n"
42      output ":exclamation: Tarfile $tarfile is empty :exclamation:"
43      continue
44    fi
45    tar xf "$tarfile"
46    test -s env.txt || continue
47    source env.txt
48    output "\n## Functional Tests: $OSNAME\n"
49    outfile_plain uname.txt
50    outfile_plain summary.txt
51    outfile failed.txt
52    logfile=$((logfile+1))
53  done
54  send2github out-1.md
55else
56  send2github out-$1.md
57fi
58