File tree Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Original file line number Diff line number Diff line change 55
55
run : dotnet build -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
56
56
57
57
- name : 🧪 test
58
- run : dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m
58
+ shell : bash --noprofile --norc {0}
59
+ env :
60
+ LC_ALL : en_US.utf8
61
+ run : |
62
+ counter=0
63
+ exitcode=0
64
+ reset="\e[0m"
65
+ warn="\e[0;33m"
66
+ while [ $counter -lt 6 ]
67
+ do
68
+ if [ $filter ]
69
+ then
70
+ echo -e "${warn}Retry $counter for $filter ${reset}"
71
+ fi
72
+ # run test and forward output also to a file in addition to stdout (tee command)
73
+ dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m --filter=$filter | tee ./output.log
74
+ # capture dotnet test exit status, different from tee
75
+ exitcode=${PIPESTATUS[0]}
76
+ if [ $exitcode == 0 ]
77
+ then
78
+ exit 0
79
+ fi
80
+ # cat output, get failed test names, join as DisplayName=TEST with |, remove trailing |.
81
+ filter=$(cat ./output.log | grep -o -P '(?<=\sFailed\s)\w*' | awk 'BEGIN { ORS="|" } { print("DisplayName=" $0) }' | grep -o -P '.*(?=\|$)')
82
+ ((counter++))
83
+ done
84
+ exit $exitcode
59
85
60
86
- name : 📦 pack
61
87
run : dotnet pack -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
Original file line number Diff line number Diff line change 25
25
run : dotnet build -m:1 -p:version=${GITHUB_REF#refs/*/v}
26
26
27
27
- name : 🧪 test
28
- run : dotnet test --no-build -m:1
28
+ shell : bash --noprofile --norc {0}
29
+ env :
30
+ LC_ALL : en_US.utf8
31
+ run : |
32
+ counter=0
33
+ exitcode=0
34
+ reset="\e[0m"
35
+ warn="\e[0;33m"
36
+ while [ $counter -lt 6 ]
37
+ do
38
+ if [ $filter ]
39
+ then
40
+ echo -e "${warn}Retry $counter for $filter ${reset}"
41
+ fi
42
+ # run test and forward output also to a file in addition to stdout (tee command)
43
+ dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m --filter=$filter | tee ./output.log
44
+ # capture dotnet test exit status, different from tee
45
+ exitcode=${PIPESTATUS[0]}
46
+ if [ $exitcode == 0 ]
47
+ then
48
+ exit 0
49
+ fi
50
+ # cat output, get failed test names, join as DisplayName=TEST with |, remove trailing |.
51
+ filter=$(cat ./output.log | grep -o -P '(?<=\sFailed\s)\w*' | awk 'BEGIN { ORS="|" } { print("DisplayName=" $0) }' | grep -o -P '.*(?=\|$)')
52
+ ((counter++))
53
+ done
54
+ exit $exitcode
29
55
30
56
- name : 📦 pack
31
57
run : dotnet pack -m:1 -p:version=${GITHUB_REF#refs/*/v}
You can’t perform that action at this time.
0 commit comments