fix(ci): decouple CGAL tests from viewer — add WITH_CGAL_TESTS flag
Some checks failed
C++ Tests / test-fast (push) Successful in 2m12s
Mirror to Codeberg / mirror (push) Failing after 1s
C++ Tests / test-cgal (push) Failing after 1m52s

Root cause: -DWITH_CGAL=ON implied -DWITH_VIEWER=ON, which pulled in
GLFW, which requires wayland-scanner — not present in the headless CI
container (ubuntu:22.04 ARM64).

Fix: new CMake option -DWITH_CGAL_TESTS=ON builds conformallab_cgal_tests
without touching the viewer, GLFW, libigl, or any display dependency.
Only Boost headers are required (already in the Docker image).

Changes
───────
code/CMakeLists.txt
  - Add WITH_CGAL_TESTS option (OFF by default)
  - find_package(Boost REQUIRED) now shared between WITH_CGAL and WITH_CGAL_TESTS
  - WITH_CGAL still implies WITH_VIEWER (for local full builds)
  - Remove duplicate find_package(Boost) inside the WITH_CGAL block

code/tests/CMakeLists.txt
  - cgal/ subdirectory added for WITH_CGAL OR WITH_CGAL_TESTS

.gitea/workflows/cpp-tests.yml
  - test-cgal job: -DWITH_CGAL=ON → -DWITH_CGAL_TESTS=ON

README.md
  - Build modes table: three rows (default / CGAL_TESTS / CGAL full)
  - Quick-start: separate headless and full-local sections
  - Prerequisite table updated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tarik Moussa
2026-05-14 13:50:56 +02:00
parent 78d13bf561
commit 6886803a29
4 changed files with 56 additions and 32 deletions

View File

@@ -52,6 +52,9 @@ jobs:
# Läuft nur auf main, dev und Pull Requests — nicht auf Feature-Branches. # Läuft nur auf main, dev und Pull Requests — nicht auf Feature-Branches.
# Startet erst nach erfolgreichem test-fast. # Startet erst nach erfolgreichem test-fast.
# #
# Verwendet -DWITH_CGAL_TESTS=ON (nicht -DWITH_CGAL=ON), damit kein
# Viewer/GLFW gebaut wird — der CI-Container hat kein wayland-scanner.
#
# Boost-Install-Schritt: solange das Docker-Image noch kein libboost-dev # Boost-Install-Schritt: solange das Docker-Image noch kein libboost-dev
# enthält, wird es hier zur Laufzeit nachinstalliert (~15 s). # enthält, wird es hier zur Laufzeit nachinstalliert (~15 s).
# Nach dem nächsten Image-Rebuild (Dockerfile bereits aktualisiert) wird # Nach dem nächsten Image-Rebuild (Dockerfile bereits aktualisiert) wird
@@ -73,8 +76,8 @@ jobs:
- name: Boost installieren (Übergang bis Image-Rebuild) - name: Boost installieren (Übergang bis Image-Rebuild)
run: apt-get update -qq && apt-get install -y --no-install-recommends libboost-dev run: apt-get update -qq && apt-get install -y --no-install-recommends libboost-dev
- name: Configure (WITH_CGAL) - name: Configure (WITH_CGAL_TESTS — kein Viewer, kein wayland-scanner)
run: cmake -S code -B build -DWITH_CGAL=ON -DCMAKE_BUILD_TYPE=Release run: cmake -S code -B build -DWITH_CGAL_TESTS=ON -DCMAKE_BUILD_TYPE=Release
- name: Build CGAL-Tests - name: Build CGAL-Tests
run: cmake --build build --target conformallab_cgal_tests -j$(nproc) run: cmake --build build --target conformallab_cgal_tests -j$(nproc)

View File

@@ -191,13 +191,16 @@ if (used_fallback)
## Build-Modi ## Build-Modi
| Modus | CMake-Flags | Was wird gebaut | | Modus | CMake-Flags | Was wird gebaut | System-Deps |
|-------|------------|-----------------| |-------|------------|-----------------|-------------|
| **Nur Tests** (Standard) | *(keine)* | `conformallab_tests`Eigen + GTest | | **Nur Tests** (Standard / CI fast) | *(keine)* | `conformallab_tests`36 Tests | keine |
| **CGAL-Tests + Beispiele** | `-DWITH_CGAL=ON` | `conformallab_cgal_tests`, Beispiel-Programme, CLI | | **CGAL-Tests headless** (CI full) | `-DWITH_CGAL_TESTS=ON` | `conformallab_cgal_tests` — 158 Tests | Boost |
| **Interaktiver Viewer** | `-DWITH_CGAL=ON` | + `example_viewer`, Viewer in CLI integriert | | **Vollständig** (lokal mit Viewer) | `-DWITH_CGAL=ON` | + CLI, Beispiel-Programme, interaktiver Viewer | Boost + Wayland/X11 |
Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und werden beim CMake-Configure-Schritt extrahiert (GTest via `FetchContent`). **Boost** wird nur mit `-DWITH_CGAL=ON` benötigt (Header-Only durch CGAL 6.x). **`-DWITH_CGAL_TESTS=ON`** ist der empfohlene CI-Modus: kein GLFW, kein wayland-scanner, kein Display benötigt.
**`-DWITH_CGAL=ON`** aktiviert automatisch den Viewer — nur für lokale Entwicklung mit Display.
Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und werden beim CMake-Configure-Schritt extrahiert (GTest via `FetchContent`). **Boost** wird nur mit `-DWITH_CGAL_TESTS=ON` oder `-DWITH_CGAL=ON` benötigt (Header-Only durch CGAL 6.x).
--- ---
@@ -207,7 +210,7 @@ Externe Abhängigkeiten sind als Tarballs in `code/deps/tarballs/` enthalten und
|------|---------| |------|---------|
| C++ Compiler (GCC oder Clang) | C++17 | | C++ Compiler (GCC oder Clang) | C++17 |
| CMake | 3.20 | | CMake | 3.20 |
| Boost Headers | 1.70 *(nur mit `-DWITH_CGAL=ON`)* | | Boost Headers | 1.70 *(nur mit `-DWITH_CGAL_TESTS=ON` oder `-DWITH_CGAL=ON`)* |
--- ---
@@ -226,24 +229,27 @@ cmake --build build --target conformallab_tests -j$(nproc)
ctest --test-dir build --output-on-failure ctest --test-dir build --output-on-failure
``` ```
### CGAL-Tests + Beispiele (benötigt System-Boost) ### CGAL-Tests headless (CI — kein Display, kein wayland-scanner)
```bash ```bash
cmake -S code -B build -DWITH_CGAL=ON # benötigt: apt install libboost-dev (Ubuntu) / brew install boost (macOS)
cmake --build build -j$(nproc) cmake -S code -B build -DWITH_CGAL_TESTS=ON
cmake --build build --target conformallab_cgal_tests -j$(nproc)
ctest --test-dir build -R "^cgal\." --output-on-failure ctest --test-dir build -R "^cgal\." --output-on-failure
./build/examples/example_layout
./bin/conformallab_core -i input.off -g euclidean -o layout.off
``` ```
Erwartet: **158 Tests bestanden, 2 skipped** (die zwei `@Ignore`-Hessian-Stubs). Erwartet: **158 Tests bestanden, 2 skipped** (die zwei `@Ignore`-Hessian-Stubs).
### Interaktiver Viewer ### Vollständig lokal (CLI + Beispiele + interaktiver Viewer)
```bash ```bash
# benötigt zusätzlich: Wayland/X11 dev-Pakete (wayland-scanner, libx11-dev …)
cmake -S code -B build -DWITH_CGAL=ON cmake -S code -B build -DWITH_CGAL=ON
cmake --build build -t example_viewer -j$(nproc) cmake --build build -j$(nproc)
ctest --test-dir build -R "^cgal\." --output-on-failure
./build/examples/example_layout
./build/examples/example_viewer data/off/example.off ./build/examples/example_viewer data/off/example.off
./bin/conformallab_core -i input.off -g euclidean -o layout.off
``` ```
--- ---
@@ -339,7 +345,7 @@ code/
Reine Mathe-Tests, nur Eigen: Clausen / Lobachevsky / ImLi₂, Hyper-ideal Geometrie, Tetraeder-Volumina. Reine Mathe-Tests, nur Eigen: Clausen / Lobachevsky / ImLi₂, Hyper-ideal Geometrie, Tetraeder-Volumina.
### `conformallab_cgal_tests` (lokal — `-DWITH_CGAL=ON`) ### `conformallab_cgal_tests` (`-DWITH_CGAL_TESTS=ON` headless / `-DWITH_CGAL=ON` voll)
| Suite | Tests | Was geprüft wird | | Suite | Tests | Was geprüft wird |
|-------|------:|-----------------| |-------|------:|-----------------|

View File

@@ -7,24 +7,42 @@ message(STATUS "Configuring ${PROJECT_NAME}...")
# ── Build modes ──────────────────────────────────────────────────────────────── # ── Build modes ────────────────────────────────────────────────────────────────
# #
# Default (CI / tests-only): only Eigen + GTest are required. # Default (CI fast / pure-math tests):
# cmake -S code -B build
# Only Eigen + GTest required. 36 non-CGAL tests.
# #
# -DWITH_CGAL=ON builds the conformallab_core CLI app (needs CGAL). # -DWITH_CGAL_TESTS=ON CGAL test suite only — no viewer, no CLI app.
# Automatically enables WITH_VIEWER because the app uses # cmake -S code -B build -DWITH_CGAL_TESTS=ON
# the viewer library for mesh visualisation. # Requires: system Boost headers (apt install libboost-dev).
# Builds: conformallab_cgal_tests (158 tests).
# Does NOT require wayland-scanner, GLFW, libigl or a display.
# Use this in headless CI.
# #
# -DWITH_VIEWER=ON builds the viewer library standalone (libigl/GLFW/GLAD). # -DWITH_CGAL=ON Full build: CLI app + viewer + examples + CGAL tests.
# cmake -S code -B build -DWITH_CGAL=ON
# Requires: Boost + Wayland/X11 dev headers (wayland-scanner, libx11-dev …).
# Automatically enables WITH_VIEWER.
# Use this for local development with the interactive viewer.
#
# -DWITH_VIEWER=ON Viewer library only (libigl / GLFW / GLAD).
# #
# ────────────────────────────────────────────────────────────────────────────── # ──────────────────────────────────────────────────────────────────────────────
option(WITH_CGAL "Build conformallab_core app (requires CGAL + Viewer)" OFF) option(WITH_CGAL_TESTS "Build CGAL test suite without viewer/CLI (headless CI)" OFF)
option(WITH_CGAL "Build conformallab_core CLI app + viewer + CGAL tests" OFF)
option(WITH_VIEWER "Build viewer library (libigl / GLFW / GLAD)" OFF) option(WITH_VIEWER "Build viewer library (libigl / GLFW / GLAD)" OFF)
# The CLI app always needs the viewer; enable it implicitly. # WITH_CGAL_TESTS is a strict subset of WITH_CGAL — no viewer, no CLI.
# WITH_CGAL (full build) implies WITH_VIEWER.
if(WITH_CGAL AND NOT WITH_VIEWER) if(WITH_CGAL AND NOT WITH_VIEWER)
message(STATUS "WITH_CGAL implies WITH_VIEWER enabling automatically.") message(STATUS "WITH_CGAL implies WITH_VIEWER enabling automatically.")
set(WITH_VIEWER ON CACHE BOOL "" FORCE) set(WITH_VIEWER ON CACHE BOOL "" FORCE)
endif() endif()
# Propagate Boost requirement for both CGAL modes.
if(WITH_CGAL OR WITH_CGAL_TESTS)
find_package(Boost REQUIRED)
endif()
# ── Standard settings ────────────────────────────────────────────────────────── # ── Standard settings ──────────────────────────────────────────────────────────
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -85,11 +103,6 @@ endif()
# ── Core CLI app (optional, requires CGAL + Viewer) ─────────────────────────── # ── Core CLI app (optional, requires CGAL + Viewer) ───────────────────────────
if(WITH_CGAL) if(WITH_CGAL)
# CGAL 6.x still needs Boost.Config headers unconditionally.
# Install via: brew install boost (macOS)
# apt install libboost-dev (Debian/Ubuntu)
find_package(Boost REQUIRED)
add_executable(${PROJECT_NAME} src/apps/v0/conformallab_cli.cpp) add_executable(${PROJECT_NAME} src/apps/v0/conformallab_cli.cpp)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/deps/single_includes ${CMAKE_CURRENT_SOURCE_DIR}/deps/single_includes

View File

@@ -28,7 +28,9 @@ target_link_libraries(conformallab_tests PRIVATE GTest::gtest_main)
include(GoogleTest) include(GoogleTest)
gtest_discover_tests(conformallab_tests DISCOVERY_TIMEOUT 60) gtest_discover_tests(conformallab_tests DISCOVERY_TIMEOUT 60)
# ── CGAL test suite (requires -DWITH_CGAL=ON) ──────────────────────────────── # ── CGAL test suite ──────────────────────────────────────────────────────────
if(WITH_CGAL) # Built with -DWITH_CGAL_TESTS=ON (headless CI, no viewer) or
# -DWITH_CGAL=ON (full build with viewer + CLI).
if(WITH_CGAL OR WITH_CGAL_TESTS)
add_subdirectory(cgal) add_subdirectory(cgal)
endif() endif()