Skip to content

Commit 647e83b

Browse files
authored
Merge pull request #368 from simonlegrand/non_blocking_check
[CI] Tests fail properly and logs are printed
2 parents cf49481 + 83b244d commit 647e83b

File tree

6 files changed

+29
-32
lines changed

6 files changed

+29
-32
lines changed

.github/workflows/full-mpich.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
branches:
77
- develop
88
- master
9-
- slegrand-actions-debug
109

1110
pull_request:
1211
branches:
@@ -73,8 +72,7 @@ jobs:
7372

7473
- name: Check
7574
run: |
76-
make check
77-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
75+
make check -i
7876
./etc/actions/failed_tests_logs.sh
7977
8078
- name: Install
@@ -150,8 +148,7 @@ jobs:
150148

151149
- name: Check
152150
run: |
153-
make check
154-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
151+
make check -i
155152
./etc/actions/failed_tests_logs.sh
156153
157154
- name: Install

.github/workflows/full-msmpi.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
branches:
77
- develop
88
- master
9-
- slegrand-actions-debug
109

1110
pull_request:
1211
branches:
@@ -106,6 +105,5 @@ jobs:
106105

107106
- name: Check
108107
run: |
109-
make check
110-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
108+
make check -i
111109
./etc/actions/failed_tests_logs.sh

.github/workflows/full-openmpi.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
branches:
77
- develop
88
- master
9-
- slegrand-actions-debug
109

1110
pull_request:
1211
branches:
@@ -73,8 +72,7 @@ jobs:
7372

7473
- name: Check
7574
run: |
76-
make check
77-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
75+
make check -i
7876
./etc/actions/failed_tests_logs.sh
7977
8078
- name: Install

.github/workflows/minimal.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- develop
77
- master
8-
- slegrand-actions-debug
98

109
pull_request:
1110
branches:
@@ -49,8 +48,7 @@ jobs:
4948

5049
- name: Check
5150
run: |
52-
make check
53-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
51+
make check -i
5452
./etc/actions/failed_tests_logs.sh
5553
5654
- name: Install
@@ -88,8 +86,7 @@ jobs:
8886

8987
- name: Check
9088
run: |
91-
make check
92-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
89+
make check -i
9390
./etc/actions/failed_tests_logs.sh
9491
9592
- name: Install
@@ -139,6 +136,5 @@ jobs:
139136

140137
- name: Check
141138
run: |
142-
make check
143-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
139+
make check -i
144140
./etc/actions/failed_tests_logs.sh

.github/workflows/sequential.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches:
66
- develop
77
- master
8-
- slegrand-actions-debug
98

109
pull_request:
1110
branches:
@@ -51,8 +50,7 @@ jobs:
5150

5251
- name: Check
5352
run: |
54-
make check
55-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
53+
make check -i
5654
./etc/actions/failed_tests_logs.sh
5755
5856
- name: Install
@@ -89,8 +87,7 @@ jobs:
8987

9088
- name: Check
9189
run: |
92-
make check
93-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
90+
make check -i
9491
./etc/actions/failed_tests_logs.sh
9592
9693
- name: Install
@@ -146,6 +143,5 @@ jobs:
146143

147144
- name: Check
148145
run: |
149-
make check
150-
echo "Tests failed: " $(grep :test-result examples/*/*.trs | grep FAIL | wc -l)
146+
make check -i
151147
./etc/actions/failed_tests_logs.sh

etc/actions/failed_tests_logs.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
#!/usr/bin/env bash
22

3-
FAILED_TESTS=( $(grep :test-result examples/*/*.trs | grep FAIL) )
3+
# This script checks if tests have failed. If yes, it prints the content of the
4+
# failed tests log, and returns 1.
5+
#
6+
# It allows keeping the '-i' option for 'make check', print the failed
7+
# tests, and only then, return exit 1 to interrupt the CI pipeline.
48

5-
for val in ${FAILED_TESTS[@]/#*FAIL/}
6-
do
7-
IFS="::"
8-
read -ra path <<< $val
9+
FAILED_TESTS=$(grep ":test-result: FAIL" examples/*/*.trs)
10+
11+
if [ -z "$FAILED_TESTS" ]; then
12+
exit 0;
13+
fi
14+
15+
NB_FAILED_TESTS=$(echo "$FAILED_TESTS" | wc -l)
16+
echo "$NB_FAILED_TESTS tests failed:"
17+
18+
echo "$FAILED_TESTS" | while IFS= read -r line; do
19+
path="${line%::test-result: FAIL}"
920
printf "\n******** ${path%.*}.log ********\n\n"
1021
tail -n 100 ${path%.*}.log
11-
unset IFS
12-
done;
22+
done
23+
24+
exit 1

0 commit comments

Comments
 (0)