Skip to content

Commit d607fb8

Browse files
committed
store error messages as array
1 parent 7e28552 commit d607fb8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,19 @@ jobs:
165165
continue-on-error: true
166166
run: |
167167
LOGFILE=output.log
168-
EXTRA_MSG=""
168+
ERR_MSGS=()
169169
ERR_COUNT=0
170170
pytest -vv tests/*_test.py tests/test_*.py -m "strict_endpoints_test" > $LOGFILE 2>&1 || \
171171
while read FAIL; do
172172
ANALYSIS=`echo ${FAIL##*strict\[} | cut -d "]" -f1` # get analysis name from pattern "strict[<ANALYSIS>]"
173-
ERR_COUNT=$((ERR_COUNT+1))
173+
ERR_COUNT=$(( ${#ERR_MSGS[@]} + 1 ))
174174
REASON=`grep "^E " $LOGFILE | head -n $ERR_COUNT | tail -n 1` # get fail reason
175175
REASON=${REASON:8} # remove prefix
176-
EXTRA_MSG="$EXTRA_MSG::warning ::Analyses endpoint '$ANALYSIS' was not available: $REASON\n"
176+
ERR_MSGS+=("::warning ::Analyses endpoint '$ANALYSIS' was not available: $REASON") # use GitHub's warning syntax
177177
done <<< `grep "FAILED.*\[" $LOGFILE | grep -v "%"` # get summary lines with failing tests, ignore progress lines
178178
cat $LOGFILE
179-
echo -n $EXTRA_MSG # flag warning to GitHub, remove trailing new lines
179+
for ERR_MSG in "${ERR_MSGS[@]}"; do; echo $ERR_MSG; done # flag errors
180+
if [ $ERR_COUNT>0 ]; then; exit 1; fi # fail if there were any errors
180181
- name: Setup Sauce Connect
181182
uses: saucelabs/sauce-connect-action@v3.0.0
182183
if: startsWith(matrix.python-version, '3.9')

0 commit comments

Comments
 (0)