Skip to content

Configuration - Update CMake to work with default packages #26

Configuration - Update CMake to work with default packages

Configuration - Update CMake to work with default packages #26

# This workflow builds and tests OCCT on multiple platforms (Windows, macOS, Linux with Clang, and Linux with GCC).
# It is triggered on pull requests to any branch.
# The workflow includes steps to prepare and build the project on each platform, run tests, and upload the results.
# Concurrency is set to ensure that only one instance of the workflow runs per pull request at a time.
name: Build and Test OCCT on Multiple Platforms
on:
pull_request:
branches:
- '**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
test-windows-x64:
name: Test on Windows (x64)
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up MSVC
uses: ilammy/[email protected]
with:
arch: x64
- name: Download and extract 3rdparty dependencies
run: |
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_8_0/3rdparty-vc14-64.zip -OutFile 3rdparty-vc14-64.zip
Expand-Archive -Path 3rdparty-vc14-64.zip -DestinationPath .
Remove-Item 3rdparty-vc14-64.zip
shell: pwsh
- name: Download and extract test data
run: |
cd data
Invoke-WebRequest -Uri https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_8_0/opencascade-dataset-7.8.0.zip -OutFile opencascade-dataset-7.8.0.zip
Expand-Archive -Path opencascade-dataset-7.8.0.zip -DestinationPath .
Remove-Item opencascade-dataset-7.8.0.zip
shell: pwsh
- name: Get latest workflow run ID from target branch
id: get_run_id
run: |
$workflow_name = "Build and Test OCCT on Multiple Platforms"
$target_branch = "${{ github.event.pull_request.base.ref }}"
Write-Host "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request" -Headers @{Accept = "application/vnd.github.v3+json"}
$latest_run_id = ($response.workflow_runs | Where-Object { $_.name -eq $workflow_name } | Select-Object -First 1).id
Write-Host "Latest run ID: $latest_run_id"
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
shell: pwsh
- name: Download test results from target branch
uses: actions/[email protected]
with:
name: results-windows-x64
path: install
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}
- name: Compare test results
run: |
cd install
call env.bat vc14 win64 release
dir /S
for /d %%i in (results\*) do set RESULTS_SUBFOLDER=%%i
for /d %%j in (results-windows-x64\*) do set RESULTS_WINDOWS_SUBFOLDER=%%j
DRAWEXE.exe -v -c testdiff %RESULTS_SUBFOLDER% %RESULTS_WINDOWS_SUBFOLDER%
shell: cmd
test-linux-clang-x64:
name: Test on Linux with Clang (x64)
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Install dependencies
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: Install Xvfb and Mesa
run: |
sudo apt-get update
sudo apt-get install -y xvfb mesa-utils libgl1-mesa-dri
- name: Start Xvfb
run: Xvfb :99 -screen 0 1920x1080x24 &
- name: Set DISPLAY environment variable
run: echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Download test data
run: |
cd data
wget https://github.com/Open-Cascade-SAS/OCCT/releases/download/V7_8_0/opencascade-dataset-7.8.0.tar.xz
tar -xf opencascade-dataset-7.8.0.tar.xz
- name: Get latest workflow run ID from target branch
id: get_run_id
run: |
workflow_name="Build and Test OCCT on Multiple Platforms"
target_branch="${{ github.event.pull_request.base.ref }}"
echo "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
response=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request")
latest_run_id=$(echo "$response" | jq -r --arg workflow_name "$workflow_name" '.workflow_runs[] | select(.name==$workflow_name) | .id' | head -n 1)
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
- name: Download test results from target branch
uses: actions/[email protected]
with:
name: results-linux-clang-x64
path: install/bin
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}
- name: Compare test results
run: |
cd install
cd bin
source env.sh
ls -R
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-linux-clang-x64/*; do export RESULTS_LINUX_CLANG_SUBFOLDER=$dir; done
./DRAWEXE -v -c testdiff $RESULTS_SUBFOLDER $RESULTS_LINUX_CLANG_SUBFOLDER
shell: bash