From 17287c7fcf8f90b03839c86abff7a3b917ba2e44 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Thu, 5 Feb 2026 05:19:22 +0900 Subject: [PATCH] Add ctest to CMake-based builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .github/workflows/ci.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eb42cb..40d391b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: