mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
ci: wgpu sanity check on macOS
Lightweight workflow that compiles IfcViewerWgpu (the static lib) on macOS arm64 + runs the wgpu state tests. Skips IfcViewerWgpuMinimal because createSurface has no Metal path yet (task #32); the platform surface blocks in WgpuViewportWindow.cpp are wrapped in #if defined(Q_OS_LINUX) so the lib itself compiles cleanly on macOS. Goal: catch portability regressions in the wgpu source on Apple Silicon without paying for build_osx.yml's full IfcGeom + OCCT + Python wheel pipeline. ~5 min vs hours. Triggers on push/PR that touches src/ifcviewer-wgpu, the shared headers it depends on, the top-level CMake, or this workflow itself. Also workflow_dispatch for manual runs. Hoists the Catch2 fetch in cmake/CMakeLists.txt out of the BUILD_BONSAIVIEWER gate so the standalone wgpu config (BUILD_BONSAIVIEWER=OFF + BUILD_BONSAIVIEWER_WGPU=ON + BUILD_BONSAIVIEWER_TESTS=ON) can build tests without dragging the whole bonsai/IfcGeom tree in. Default remains OFF, so default builds stay offline-capable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,101 @@
|
|||||||
|
name: wgpu sanity (macOS)
|
||||||
|
|
||||||
|
# Lightweight compile-only check for the wgpu backend on macOS. Skips the
|
||||||
|
# IfcViewerWgpuMinimal executable (its surface creation has no Metal path
|
||||||
|
# yet — see task #32) and just confirms IfcViewerWgpu links and the pure-
|
||||||
|
# CPU state tests pass.
|
||||||
|
#
|
||||||
|
# Goal: catch portability regressions in the wgpu source on Apple Silicon
|
||||||
|
# / Intel Mac without needing the full IfcGeom + OCCT + Python toolchain
|
||||||
|
# that build_osx.yml carries. Runs in ~5 minutes.
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- ifcviewer-wgpu
|
||||||
|
- main
|
||||||
|
- v0.8.0
|
||||||
|
paths:
|
||||||
|
- 'src/ifcviewer-wgpu/**'
|
||||||
|
- 'src/ifcviewer/SidecarCache.*'
|
||||||
|
- 'src/ifcviewer/InstancedGeometry.h'
|
||||||
|
- 'src/ifcviewer/VertexQuantization.h'
|
||||||
|
- 'cmake/CMakeLists.txt'
|
||||||
|
- '.github/workflows/ci-wgpu-mac.yml'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'src/ifcviewer-wgpu/**'
|
||||||
|
- 'src/ifcviewer/SidecarCache.*'
|
||||||
|
- 'src/ifcviewer/InstancedGeometry.h'
|
||||||
|
- 'src/ifcviewer/VertexQuantization.h'
|
||||||
|
- 'cmake/CMakeLists.txt'
|
||||||
|
- '.github/workflows/ci-wgpu-mac.yml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_wgpu_mac:
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- arch: arm64
|
||||||
|
runner: macos-14
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: false
|
||||||
|
|
||||||
|
- name: Install dependencies via Homebrew
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
# qt installs Qt6 currently; eigen is header-only.
|
||||||
|
brew install qt eigen
|
||||||
|
# patchelf isn't on mac — wgpu-native's SONAME workaround is
|
||||||
|
# Linux-only and CMake guards on UNIX AND NOT APPLE so this is fine.
|
||||||
|
|
||||||
|
- name: ccache
|
||||||
|
uses: hendrikmuhs/ccache-action@v1.2.22
|
||||||
|
with:
|
||||||
|
key: mac-wgpu-${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Configure (standalone wgpu, tests on)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
QT_PREFIX="$(brew --prefix qt)"
|
||||||
|
cmake -B build \
|
||||||
|
-S cmake \
|
||||||
|
-G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_BONSAIVIEWER=OFF \
|
||||||
|
-DBUILD_BONSAIVIEWER_WGPU=ON \
|
||||||
|
-DBUILD_BONSAIVIEWER_TESTS=ON \
|
||||||
|
-DCMAKE_PREFIX_PATH="${QT_PREFIX}" \
|
||||||
|
-DQT_DIR="${QT_PREFIX}" \
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||||
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||||
|
|
||||||
|
- name: Build IfcViewerWgpu + state tests
|
||||||
|
# Skip IfcViewerWgpuMinimal: its createSurface has no Metal path
|
||||||
|
# yet (task #32). Static lib compiles cleanly because the X11 /
|
||||||
|
# Wayland surface blocks are wrapped in #if defined(Q_OS_LINUX).
|
||||||
|
run: |
|
||||||
|
cmake --build build \
|
||||||
|
--target IfcViewerWgpu test_wgpu_selection test_wgpu_visibility \
|
||||||
|
-- -j
|
||||||
|
|
||||||
|
- name: Run state tests
|
||||||
|
working-directory: build
|
||||||
|
run: ctest --output-on-failure -R "wgpu"
|
||||||
|
|
||||||
|
- name: Upload CMake configure log on failure
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: cmake-log-${{ matrix.arch }}
|
||||||
|
path: |
|
||||||
|
build/CMakeCache.txt
|
||||||
|
build/CMakeFiles/CMakeConfigureLog.yaml
|
||||||
|
retention-days: 14
|
||||||
+18
-17
@@ -681,24 +681,25 @@ if(BUILD_IFCGEOM)
|
|||||||
|
|
||||||
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom)
|
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom)
|
||||||
endif(BUILD_IFCGEOM)
|
endif(BUILD_IFCGEOM)
|
||||||
if(BUILD_BONSAIVIEWER)
|
# Catch2 fetch hoisted out of BUILD_BONSAIVIEWER so the standalone wgpu
|
||||||
if(BUILD_BONSAIVIEWER_TESTS)
|
# build can also enable BUILD_BONSAIVIEWER_TESTS. Test option is OFF by
|
||||||
# Catch2 v3 — fetched on demand. Test option is OFF by default so the
|
# default so the default build remains offline-capable.
|
||||||
# default build remains offline-capable.
|
if(BUILD_BONSAIVIEWER_TESTS)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
Catch2
|
Catch2
|
||||||
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
GIT_TAG v3.5.4
|
GIT_TAG v3.5.4
|
||||||
GIT_SHALLOW TRUE
|
GIT_SHALLOW TRUE
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(Catch2)
|
FetchContent_MakeAvailable(Catch2)
|
||||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_BONSAIVIEWER)
|
||||||
# Wgpu subprojects added first because IfcViewer's SceneLoader now
|
# Wgpu subprojects added first because IfcViewer's SceneLoader now
|
||||||
# links against IfcViewerWgpu; the target must exist when IfcViewer's
|
# links against IfcViewerWgpu; the target must exist when IfcViewer's
|
||||||
# CMakeLists runs.
|
# CMakeLists runs.
|
||||||
|
|||||||
Reference in New Issue
Block a user