forked from martinthomson/i-d-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat-trace.sh
More file actions
executable file
·37 lines (35 loc) · 877 Bytes
/
format-trace.sh
File metadata and controls
executable file
·37 lines (35 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
trace="$1"
status="$2"
if [[ "$status" -eq 0 ]]; then
echo "## Build Succeeded"
else
echo "## Build Failed"
fi
echo
tmp=$(mktemp)
trap 'rm -f $tmp' EXIT
cut -f1 -d' ' "$trace" | sort | uniq | while read -r f; do
failed=
grep "^$f " "$trace" | cut -f2- -d' ' | sort | uniq >"$tmp"
while read -r j s; do
if [[ "$failed" != "$j" && "$s" != "0" ]]; then
if [[ -z "$failed" ]]; then
echo "❌ $f"
echo
fi
echo "<details><summary>❌ step '$j' failed</summary>"
echo
echo '```'
grep "^$f $j " "$trace" | cut -f3- -d' ' | tail +2
echo '```'
echo "</details>"
echo
failed=$j
fi
done <"$tmp"
if [[ -z "$failed" ]]; then
echo "✅ $f"
echo
fi
done