Skip to content

Commit ca52b7b

Browse files
committed
build: capture stderr as output variable
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 267ba17 commit ca52b7b

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/lint_random_files.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -369,30 +369,41 @@ jobs:
369369
# Define the path to cppcheck configuration file for linting benchmarks:
370370
cppcheck_benchmarks_suppressions_list="${root}/etc/cppcheck/suppressions.benchmarks.txt"
371371
372-
# Lint C source files...
372+
# Initialize a variable to capture errors:
373+
err_output=""
374+
375+
# Lint C source files:
373376
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep -E '\.c$' | grep -v -e '/examples' -e '/test' -e '/benchmark' | tr '\n' ' ')
374377
if [[ -n "${files}" ]]; then
375-
make lint-c-files FILES="${files}"
378+
err_output+=$(make lint-c-files FILES="${files}" 2>&1)
376379
fi
377380
378381
# Lint C example files...
379382
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/examples/.*\.c$' | tr '\n' ' ')
380383
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)
382385
fi
383386
384387
# Lint C test fixtures files...
385388
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/test/fixtures/.*\.c$' | tr '\n' ' ')
386389
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)
388391
fi
389392
390393
# Lint C benchmark files...
391394
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/benchmark/.*\.c$' | tr '\n' ' ')
392395
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)
394397
fi
395398
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+
396407
# Create sub-issue for C linting failures:
397408
- name: 'Create sub-issue for C lint failures'
398409
if: ( github.event.inputs.c != 'false' ) && failure() && contains(steps.*.outcome, 'failure') && contains(steps.lint-c.outcome, 'failure')

0 commit comments

Comments
 (0)