Add ctest to CMake-based builds

Run ctest after build for:
- Windows x64 MSVC
- Windows x86 MSVC
- Windows MinGW MSYS2
- Linux Header-Only Mode

Cross-compile builds (Windows ARM64, Linux→Windows MinGW) are excluded
since tests cannot run on the host.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Syoyo Fujita
2026-02-05 05:19:22 +09:00
parent 6c948d5bc3
commit 17287c7fcf

View File

@@ -126,10 +126,13 @@ jobs:
run: |
.\build\Release\loader_example.exe models\Cube\Cube.gltf
# Windows x86 - MSVC (build only)
- name: Run tests
run: ctest --test-dir build -C Release --output-on-failure
# Windows x86 - MSVC
windows-msvc-x86:
runs-on: windows-latest
name: Windows x86 (MSVC) - Build Only
name: Windows x86 (MSVC)
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -143,6 +146,9 @@ jobs:
- name: Build
run: cmake --build build --config Release
- name: Run tests
run: ctest --test-dir build -C Release --output-on-failure
# Windows ARM64 - MSVC (cross-compile)
windows-msvc-arm64:
runs-on: windows-latest
@@ -186,19 +192,12 @@ jobs:
cmake -G"Ninja" -S . -B build
cmake --build build
- name: Build loader_example directly
run: |
g++ -std=c++11 -o loader_example loader_example.cc
- name: Run loader_example
run: |
./loader_example models/Cube/Cube.gltf
./build/loader_example models/Cube/Cube.gltf
- name: Build and run unit tests
run: |
cd tests
g++ -I../ -std=c++11 -g -O0 -o tester tester.cc
./tester
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Linux -> Windows MinGW Cross-compile
linux-mingw-cross:
@@ -257,11 +256,8 @@ jobs:
run: |
./build/loader_example models/Cube/Cube.gltf
- name: Build and run unit tests (header-only)
run: |
cd tests
g++ -DTINYGLTF_HEADER_ONLY -I../ -std=c++11 -g -O0 -o tester tester.cc
./tester
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Special Configuration: RapidJSON Backend
linux-rapidjson: