Skip to content

Commit 936a944

Browse files
committed
github action: use the json file instead of parsing the logs
1 parent 205d5b5 commit 936a944

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

.github/workflows/GnuTests.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
- name: Selinux - Extract testing info from indiv logs into JSON
205205
shell: bash
206206
run : |
207-
lima bash -c "cd ~/work/gnu/ && python3 ../uutils/util/gnu-json-result.py tests > tests-selinux/selinux-gnu-full-result.json && cat tests-selinux/selinux-gnu-full-result.json"
207+
lima bash -c "cd ~/work/gnu/ && python3 ../uutils/util/gnu-json-result.py tests > ~/work/gnu/tests-selinux/selinux-gnu-full-result.json && cat tests-selinux/selinux-gnu-full-result.json"
208208
209209
- name: Selinux - Collect test logs and test results
210210
run: |
@@ -245,25 +245,27 @@ jobs:
245245
run: |
246246
## Extract/summarize testing info
247247
outputs() { step_id="${{ github.action }}"; for var in "$@" ; do echo steps.${step_id}.outputs.${var}="${!var}"; echo "${var}=${!var}" >> $GITHUB_OUTPUT; done; }
248-
#
248+
249249
path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
250-
#
251-
SUITE_LOG_FILE='${{ steps.vars.outputs.SUITE_LOG_FILE }}'
252-
ROOT_SUITE_LOG_FILE='${{ steps.vars.outputs.ROOT_SUITE_LOG_FILE }}'
253-
SELINUX_SUITE_LOG_FILE='${{ steps.vars.outputs.SELINUX_SUITE_LOG_FILE }}'
254-
SELINUX_ROOT_SUITE_LOG_FILE='${{ steps.vars.outputs.SELINUX_ROOT_SUITE_LOG_FILE }}'
255-
ls -al ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE} ${SELINUX_SUITE_LOG_FILE} ${SELINUX_ROOT_SUITE_LOG_FILE}
256250
257-
if test -f "${SUITE_LOG_FILE}"
251+
# Check if the file exists
252+
if test -f "${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}"
258253
then
259-
source ${path_UUTILS}/util/analyze-gnu-results.sh ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE} ${SELINUX_SUITE_LOG_FILE} ${SELINUX_ROOT_SUITE_LOG_FILE}
254+
# Run the Python script to analyze the JSON data
255+
eval $(python3 ${path_UUTILS}/util/analyze-gnu-results.py ${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }})
256+
260257
if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then
261-
echo "::error ::Failed to parse test results from '${SUITE_LOG_FILE}'; failing early"
258+
echo "::error ::Failed to parse test results from '${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}'; failing early"
262259
exit 1
263260
fi
261+
264262
output="GNU tests summary = TOTAL: $TOTAL / PASS: $PASS / FAIL: $FAIL / ERROR: $ERROR / SKIP: $SKIP"
265263
echo "${output}"
266-
if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then echo "::warning ::${output}" ; fi
264+
265+
if [[ "$FAIL" -gt 0 || "$ERROR" -gt 0 ]]; then
266+
echo "::warning ::${output}"
267+
fi
268+
267269
jq -n \
268270
--arg date "$(date --rfc-email)" \
269271
--arg sha "$GITHUB_SHA" \
@@ -277,9 +279,10 @@ jobs:
277279
HASH=$(sha1sum '${{ steps.vars.outputs.TEST_SUMMARY_FILE }}' | cut --delim=" " -f 1)
278280
outputs HASH
279281
else
280-
echo "::error ::Failed to find summary of test results (missing '${SUITE_LOG_FILE}'); failing early"
282+
echo "::error ::Failed to find summary of test results (missing '${{ steps.vars.outputs.TEST_FULL_SUMMARY_FILE }}'); failing early"
281283
exit 1
282284
fi
285+
283286
# Compress logs before upload (fails otherwise)
284287
gzip ${{ steps.vars.outputs.TEST_LOGS_GLOB }}
285288
- name: Reserve SHA1/ID of 'test-summary'

0 commit comments

Comments
 (0)