# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-FileNotice: Part of the FreeCAD project. name: runQtTests description: "Run all QtTest-based C++ tests (those labelled 'Qt' in CTest), generate log and report" inputs: builddir: description: "Build directory containing CTestTestfile.cmake" required: true testLogFile: description: "Path for the command-line output of the tests" required: true outputs: reportText: description: "Report text" value: ${{ steps.report.outputs.reportText }} runs: using: "composite" steps: - name: Run Qt tests via CTest shell: bash -l {0} env: BUILD_DIR: ${{ inputs.builddir }} TEST_LOG_FILE: ${{ inputs.testLogFile }} run: | set -o pipefail ctest --test-dir "$BUILD_DIR" -L Qt --output-on-failure | tee -a "$TEST_LOG_FILE" - name: Parse test results if: always() id: report shell: bash -l {0} env: TEST_LOG_FILE: ${{ inputs.testLogFile }} run: | result=$(grep -E "(Test #|tests passed|tests failed|Total Test time)" "$TEST_LOG_FILE" || true) if grep -qE "[1-9][0-9]* tests failed" "$TEST_LOG_FILE" then reportText="
:fire: QtTest C++ tests failed\n" else reportText="
:heavy_check_mark: QtTest C++ tests succeeded\n" fi reportText+="\n" reportText+="Results\n" reportText+="\n" reportText+='```\n' reportText+="$result\n" reportText+='```\n' reportText+="
\n" reportText+="\n" echo "reportText<> $GITHUB_OUTPUT echo -e "$reportText" >> $GITHUB_OUTPUT echo "EOD" >> $GITHUB_OUTPUT echo -e "$reportText"