@@ -369,30 +369,41 @@ jobs:
369
369
# Define the path to cppcheck configuration file for linting benchmarks:
370
370
cppcheck_benchmarks_suppressions_list="${root}/etc/cppcheck/suppressions.benchmarks.txt"
371
371
372
- # Lint C source files...
372
+ # Initialize a variable to capture errors:
373
+ err_output=""
374
+
375
+ # Lint C source files:
373
376
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep -E '\.c$' | grep -v -e '/examples' -e '/test' -e '/benchmark' | tr '\n' ' ')
374
377
if [[ -n "${files}" ]]; then
375
- make lint-c-files FILES="${files}"
378
+ err_output+=$( make lint-c-files FILES="${files}" 2>&1)
376
379
fi
377
380
378
381
# Lint C example files...
379
382
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/examples/.*\.c$' | tr '\n' ' ')
380
383
if [[ -n "${files}" ]]; then
381
- make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_examples_suppressions_list}"
384
+ err_output+=$( make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_examples_suppressions_list}" 2>&1)
382
385
fi
383
386
384
387
# Lint C test fixtures files...
385
388
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/test/fixtures/.*\.c$' | tr '\n' ' ')
386
389
if [[ -n "${files}" ]]; then
387
- make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_tests_fixtures_suppressions_list}"
390
+ err_output+=$( make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_tests_fixtures_suppressions_list}" 2>&1)
388
391
fi
389
392
390
393
# Lint C benchmark files...
391
394
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/benchmark/.*\.c$' | tr '\n' ' ')
392
395
if [[ -n "${files}" ]]; then
393
- make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_benchmarks_suppressions_list}"
396
+ err_output+=$( make lint-c-files FILES="${files}" CPPCHECK_SUPPRESSIONS_LIST="${cppcheck_benchmarks_suppressions_list}" 2>&1)
394
397
fi
395
398
399
+ # Print the errors to the log:
400
+ echo "$err_output"
401
+
402
+ # Save the captured errors as an output variable...
403
+ echo "stderr<<EOF" >> $GITHUB_OUTPUT
404
+ echo "$err_output" >> $GITHUB_OUTPUT
405
+ echo "EOF" >> $GITHUB_OUTPUT
406
+
396
407
# Create sub-issue for C linting failures:
397
408
- name : ' Create sub-issue for C lint failures'
398
409
if : ( github.event.inputs.c != 'false' ) && failure() && contains(steps.*.outcome, 'failure') && contains(steps.lint-c.outcome, 'failure')
0 commit comments