Skip to content

Configuration - Update CMake to work with default packages #28

Configuration - Update CMake to work with default packages

Configuration - Update CMake to work with default packages #28

# 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: Get latest workflow run ID from target branch
id: get_run_id
run: |
set workflow_name="Build and Test OCCT on Multiple Platforms"
set target_branch=${{ github.event.pull_request.base.ref }}
echo Fetching latest run ID for workflow: "%workflow_name%" on branch: "%target_branch%"
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" > response.json
for /F "tokens=*" %%i in ('jq -r ".workflow_runs[] | select(.name==\"%workflow_name%\") | .id" response.json ^| head -n 1') do set latest_run_id=%%i
echo Latest run ID: %latest_run_id%
echo latest_run_id=%latest_run_id% >> %GITHUB_ENV%
shell: cmd
- 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
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
echo %RESULTS_SUBFOLDER%
echo %RESULTS_WINDOWS_SUBFOLDER%
shell: cmd
test-linux-clang-x64:
name: Test on Linux with Clang (x64)
runs-on: ubuntu-24.04
steps:
- 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/results-target
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}
- name: Compare test results
run: |
cd install
cd bin
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-target/*; do export RESULTS_LINUX_CLANG_SUBFOLDER=$dir; done
echo $RESULTS_SUBFOLDER
echo $RESULTS_LINUX_CLANG_SUBFOLDER
shell: bash