mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-10 09:30:48 +08:00
- Establishes explicit job dependencies to prevent redundant workflow runs - Adds GTest execution for macOS with Clang (No PCH) in Debug mode - Creates a dependency chain where macOS Clang (No PCH) builds depend on standard macOS builds
186 lines
6.4 KiB
YAML
186 lines
6.4 KiB
YAML
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: ./.github/actions/download-artifacts
|
|
with:
|
|
name: ${{ inputs.install-artifact-name }}
|
|
path: install
|
|
|
|
- name: Download vcpkg cache
|
|
uses: ./.github/actions/download-vcpkg-cache
|
|
with:
|
|
artifact-name: ${{ inputs.install-artifact-name }}-cache
|
|
|
|
- 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 vc14 win64 release
|
|
set GTEST_OUTPUT=""
|
|
OpenCascadeGTest.exe --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1
|
|
type gtest_output.log
|
|
exit /b 0
|
|
|
|
- name: Set library paths on macOS
|
|
if: inputs.platform == 'macos'
|
|
shell: bash
|
|
run: |
|
|
convert_to_absolute() {
|
|
local result=""
|
|
IFS=':' read -ra PATHS <<< "$1"
|
|
for p in "${PATHS[@]}"; do
|
|
[ -n "$p" ] && [ "${p:0:1}" != "/" ] && p="${GITHUB_WORKSPACE}/$p"
|
|
result="${result}${result:+:}$p"
|
|
done
|
|
echo "$result"
|
|
}
|
|
# OCCT libraries are in install/lib
|
|
OCCT_LIB="${GITHUB_WORKSPACE}/install/lib"
|
|
DYLD_PATHS="$OCCT_LIB"
|
|
[ -n "$DYLD_LIBRARY_PATH" ] && DYLD_PATHS="$DYLD_PATHS:$(convert_to_absolute "$DYLD_LIBRARY_PATH")"
|
|
echo "DYLD_LIBRARY_PATH=$DYLD_PATHS" >> $GITHUB_ENV
|
|
echo "DYLD_FALLBACK_LIBRARY_PATH=$DYLD_PATHS" >> $GITHUB_ENV
|
|
|
|
- name: Set library paths on Linux
|
|
if: inputs.platform == 'linux'
|
|
shell: bash
|
|
run: |
|
|
convert_to_absolute() {
|
|
local result=""
|
|
IFS=':' read -ra PATHS <<< "$1"
|
|
for p in "${PATHS[@]}"; do
|
|
[ -n "$p" ] && [ "${p:0:1}" != "/" ] && p="${GITHUB_WORKSPACE}/$p"
|
|
result="${result}${result:+:}$p"
|
|
done
|
|
echo "$result"
|
|
}
|
|
# OCCT libraries are in install/lib
|
|
OCCT_LIB="${GITHUB_WORKSPACE}/install/lib"
|
|
LD_PATHS="$OCCT_LIB"
|
|
[ -n "$LD_LIBRARY_PATH" ] && LD_PATHS="$LD_PATHS:$(convert_to_absolute "$LD_LIBRARY_PATH")"
|
|
echo "LD_LIBRARY_PATH=$LD_PATHS" >> $GITHUB_ENV
|
|
|
|
- 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
|
|
EXIT_CODE=0
|
|
./OpenCascadeGTest --gtest_output=xml:gtest_results.xml > gtest_output.log 2>&1 || EXIT_CODE=$?
|
|
cat gtest_output.log
|
|
# Check for crashes (signals like SIGABRT=134, SIGSEGV=139, etc.)
|
|
if [ $EXIT_CODE -gt 128 ]; then
|
|
echo "::error::GTest crashed with signal $((EXIT_CODE - 128))"
|
|
echo "gtest_crashed=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "gtest_crashed=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Upload GTest results
|
|
uses: actions/upload-artifact@v4.6.2
|
|
with:
|
|
name: gtest-results-${{ inputs.platform }}-${{ inputs.compiler }}-${{ inputs.artifact-suffix }}
|
|
path: |
|
|
install/**/gtest_results.xml
|
|
install/**/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
|
|
$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
|
|
echo "crashed=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "has_failures=${{ steps.check-failures-unix.outputs.has_failures }}" >> $GITHUB_OUTPUT
|
|
echo "crashed=${{ steps.run-gtest-unix.outputs.gtest_crashed }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Fail job if tests failed or crashed
|
|
if: steps.check-failures.outputs.has_failures == 'true' || steps.check-failures.outputs.crashed == 'true'
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ steps.check-failures.outputs.crashed }}" == "true" ]; then
|
|
echo "::error::GTest crashed during execution"
|
|
else
|
|
echo "::error::GTest failures detected"
|
|
fi
|
|
exit 1
|