Skip to content

Commit 775c79a

Browse files
committed
Refactor CI workflow to simplify build directory creation and streamline CMake configuration for tests only
1 parent b137e6d commit 775c79a

1 file changed

Lines changed: 8 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,44 +33,23 @@ jobs:
3333

3434
- name: Create build directory
3535
run: |
36-
if [ "${{ runner.os }}" = "Windows" ]; then
37-
mkdir build
38-
else
39-
mkdir -p build
40-
fi
36+
mkdir -p build
4137
shell: bash
4238

43-
- name: Configure CMake (headers + tests)
39+
- name: Configure CMake (tests only)
4440
run: |
45-
cmake -S . -B build \
41+
cmake -S test -B build \
4642
-DFZX_COMPILE_TESTS=ON \
4743
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4844
shell: bash
4945

50-
- name: Build all
46+
- name: Build Tests
5147
run: cmake --build build --config ${{ matrix.build_type }}
5248

53-
- name: Run Tests
49+
- name: Run Tests with CTest
50+
working-directory: build
51+
run: ctest --output-on-failure
5452
shell: bash
55-
run: |
56-
echo "Invoking test runner from build folder..."
57-
if [ "${{ runner.os }}" = "Windows" ]; then
58-
exe="build/${{ matrix.build_type }}/run_tests.exe"
59-
alt="build/run_tests.exe"
60-
else
61-
exe="build/run_tests"
62-
alt=""
63-
fi
64-
65-
# prefer the config-specific path, then the flat one
66-
if [ -f "$exe" ]; then
67-
"$exe"
68-
elif [ -n "$alt" ] && [ -f "$alt" ]; then
69-
"$alt"
70-
else
71-
echo "❌ Test executable not found, looked for: $exe $alt"
72-
exit 1
73-
fi
7453

7554
- name: Upload test logs (on failure)
7655
if: failure()
@@ -79,4 +58,4 @@ jobs:
7958
name: test-logs-${{ matrix.os }}
8059
path: |
8160
build/**/*.log
82-
build/**/*.txt
61+
build/**/*.txt

0 commit comments

Comments
 (0)