name: 'Run GTest Validation' description: 'Execute GTest suite and validate results' inputs: platform: description: 'Platform (windows, macos, linux)' required: true compiler: description: 'Compiler (msvc, clang, gcc)' required: true install-artifact-name: description: 'Name of the artifact containing the installed files' required: true artifact-suffix: description: 'Suffix for the GTest results artifact name' required: true default: 'x64' outputs: has-failures: description: 'Whether any tests failed' value: ${{ steps.check-failures.outputs.has_failures }} runs: using: "composite" steps: - name: Download and extract install directory uses: actions/download-artifact@v4.1.7 with: name: ${{ inputs.install-artifact-name }} path: install - name: Download and extract 3rdparty dependencies for Windows if: inputs.platform == 'windows' shell: pwsh run: | Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_9_0_beta1/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath . Remove-Item 3rdparty-vc14-64.zip - name: Install macOS dependencies if: inputs.platform == 'macos' shell: bash run: | brew update brew install tcl-tk tbb gl2ps xerces-c \ libxmu libxi libxft libxpm \ glew freeimage draco glfw - name: Install Linux dependencies if: inputs.platform == 'linux' shell: bash run: | sudo apt-get update && sudo apt-get install -y tcl-dev tk-dev cmake clang make libbtbb-dev libx11-dev libglu1-mesa-dev tcllib tcl-thread tcl libvtk9-dev libopenvr-dev libdraco-dev libfreeimage-dev libegl1-mesa-dev libgles2-mesa-dev libfreetype-dev - name: Setup Xvfb and Mesa for Linux if: inputs.platform == 'linux' uses: ./.github/actions/setup-xvfb-mesa - name: Set execute permissions on Unix platforms if: inputs.platform != 'windows' shell: bash run: | chmod +x install/bin/OpenCascadeGTest - name: Run OpenCascadeGTest on Windows if: inputs.platform == 'windows' id: run-gtest-windows shell: cmd run: | cd install call env.bat ${{ inputs.compiler == 'msvc' && 'vc14' || 'clang' }} win64 release cd bin set GTEST_OUTPUT="" OpenCascadeGTest.exe --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1 type gtest_output.log exit /b 0 - name: Run OpenCascadeGTest on Unix platforms if: inputs.platform != 'windows' id: run-gtest-unix shell: bash env: DISPLAY: ${{ inputs.platform == 'linux' && ':99' || '' }} LIBGL_ALWAYS_SOFTWARE: 1 run: | cd install/bin source env.sh ./OpenCascadeGTest --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1 cat gtest_output.log - name: Upload GTest results uses: actions/upload-artifact@v4.4.3 with: name: gtest-results-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.artifact-suffix }} path: | install/bin/gtest_results.xml install/bin/gtest_output.log retention-days: 15 - name: Check for test failures on Windows if: inputs.platform == 'windows' id: check-failures-windows shell: pwsh run: | cd install/bin $log = Get-Content "gtest_output.log" -Raw if ($log -match "\[\s+FAILED\s+\]") { Write-Error "GTest failures detected in the output." echo "has_failures=true" >> $env:GITHUB_OUTPUT } else { Write-Output "No GTest failures detected." echo "has_failures=false" >> $env:GITHUB_OUTPUT } - name: Check for test failures on Unix if: inputs.platform != 'windows' id: check-failures-unix shell: bash run: | cd install/bin if grep -q "\[ FAILED \]" gtest_output.log; then echo "::error::GTest failures detected in the output." echo "has_failures=true" >> $GITHUB_OUTPUT else echo "No GTest failures detected." echo "has_failures=false" >> $GITHUB_OUTPUT fi - name: Set combined output id: check-failures shell: bash run: | if [ "${{ inputs.platform }}" == "windows" ]; then echo "has_failures=${{ steps.check-failures-windows.outputs.has_failures }}" >> $GITHUB_OUTPUT else echo "has_failures=${{ steps.check-failures-unix.outputs.has_failures }}" >> $GITHUB_OUTPUT fi - name: Fail job if tests failed if: steps.check-failures.outputs.has_failures == 'true' shell: bash run: | echo "::error::GTest failures detected" exit 1