Skip to content

Commit 3bcb01c

Browse files
committed
Bump files with dotnet-file sync #6
# devlooped/oss - Automatically retry failed tests up to 5 times devlooped/oss@8bc16a7 - Ensure GNU grep is used on macOS devlooped/oss@964caa3
1 parent 474a672 commit 3bcb01c

2 files changed

Lines changed: 68 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,41 @@ jobs:
6666
- name: 🙏 build
6767
run: dotnet build -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"
6868

69+
- name: ⚙ GNU grep
70+
if: matrix.os == 'macOS-latest'
71+
run: |
72+
brew install grep
73+
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> .bash_profile
74+
6975
- name: 🧪 test
70-
run: dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m
76+
shell: bash --noprofile --norc {0}
77+
env:
78+
LC_ALL: en_US.utf8
79+
run: |
80+
[ -f .bash_profile ] && source .bash_profile
81+
counter=0
82+
exitcode=0
83+
reset="\e[0m"
84+
warn="\e[0;33m"
85+
while [ $counter -lt 6 ]
86+
do
87+
if [ $filter ]
88+
then
89+
echo -e "${warn}Retry $counter for $filter ${reset}"
90+
fi
91+
# run test and forward output also to a file in addition to stdout (tee command)
92+
dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m --filter=$filter | tee ./output.log
93+
# capture dotnet test exit status, different from tee
94+
exitcode=${PIPESTATUS[0]}
95+
if [ $exitcode == 0 ]
96+
then
97+
exit 0
98+
fi
99+
# cat output, get failed test names, join as DisplayName=TEST with |, remove trailing |.
100+
filter=$(cat ./output.log | grep -o -P '(?<=\sFailed\s)\w*' | awk 'BEGIN { ORS="|" } { print("DisplayName=" $0) }' | grep -o -P '.*(?=\|$)')
101+
((counter++))
102+
done
103+
exit $exitcode
71104
72105
- name: 📦 pack
73106
run: dotnet pack -m:1 -p:VersionLabel="$GITHUB_REF.$GITHUB_RUN_NUMBER"

.github/workflows/publish.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,41 @@ jobs:
3030
- name: 🙏 build
3131
run: dotnet build -m:1 -p:version=${GITHUB_REF#refs/*/v}
3232

33+
- name: ⚙ GNU grep
34+
if: matrix.os == 'macOS-latest'
35+
run: |
36+
brew install grep
37+
echo 'export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"' >> .bash_profile
38+
3339
- name: 🧪 test
34-
run: dotnet test --no-build -m:1
40+
shell: bash --noprofile --norc {0}
41+
env:
42+
LC_ALL: en_US.utf8
43+
run: |
44+
[ -f .bash_profile ] && source .bash_profile
45+
counter=0
46+
exitcode=0
47+
reset="\e[0m"
48+
warn="\e[0;33m"
49+
while [ $counter -lt 6 ]
50+
do
51+
if [ $filter ]
52+
then
53+
echo -e "${warn}Retry $counter for $filter ${reset}"
54+
fi
55+
# run test and forward output also to a file in addition to stdout (tee command)
56+
dotnet test --no-build -m:1 --blame-hang --blame-hang-timeout 5m --filter=$filter | tee ./output.log
57+
# capture dotnet test exit status, different from tee
58+
exitcode=${PIPESTATUS[0]}
59+
if [ $exitcode == 0 ]
60+
then
61+
exit 0
62+
fi
63+
# cat output, get failed test names, join as DisplayName=TEST with |, remove trailing |.
64+
filter=$(cat ./output.log | grep -o -P '(?<=\sFailed\s)\w*' | awk 'BEGIN { ORS="|" } { print("DisplayName=" $0) }' | grep -o -P '.*(?=\|$)')
65+
((counter++))
66+
done
67+
exit $exitcode
3568
3669
- name: 📦 pack
3770
run: dotnet pack -m:1 -p:version=${GITHUB_REF#refs/*/v}

0 commit comments

Comments
 (0)