Skip to content

Commit b2b2772

Browse files
authored
Fix Windows CI by splitting tests and refactoring nested JSON
Split large interactions.cpp test file (5,548 lines) into 4 parts to reduce compilation memory pressure on Windows CI. Refactored deeply nested JSON initializers to programmatic construction in interactions_part2a.cpp to avoid MSVC C1060 compiler heap exhaustion on GitHub's 16GB Windows runners. Changes: - Split tests/server/interactions.cpp into part1/part2a/part2b/part3 - Refactor 9-level nested JSON to step-by-step construction - Add -A x64 flag for 64-bit Windows builds - Use single-threaded builds on Windows (/m:1) for memory conservation All 37 tests passing on all platforms (Ubuntu, Windows, macOS, ARM64).
1 parent 4a28129 commit b2b2772

8 files changed

Lines changed: 8123 additions & 5560 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ jobs:
3535
uses: actions/cache@v4
3636
with:
3737
path: build/_deps
38-
key: deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('CMakeLists.txt') }}
38+
key: deps-${{ runner.os }}-${{ runner.arch }}-x64-${{ hashFiles('CMakeLists.txt') }}
3939
restore-keys: |
40-
deps-${{ runner.os }}-${{ runner.arch }}-
40+
deps-${{ runner.os }}-${{ runner.arch }}-x64-
4141
4242
- name: Configure (Unix)
4343
if: runner.os != 'Windows'
@@ -49,20 +49,19 @@ jobs:
4949
5050
- name: Configure (Windows)
5151
if: runner.os == 'Windows'
52-
run: >
53-
cmake -B build -S .
54-
-G "Visual Studio 17 2022"
55-
-DFASTMCPP_BUILD_TESTS=ON
56-
-DFASTMCPP_BUILD_EXAMPLES=ON
52+
run: |
53+
if (Test-Path build) { Remove-Item -Recurse -Force build/CMakeCache.txt, build/CMakeFiles -ErrorAction SilentlyContinue }
54+
cmake -B build -S . -G "Visual Studio 17 2022" -A x64 -DFASTMCPP_BUILD_TESTS=ON -DFASTMCPP_BUILD_EXAMPLES=ON
5755
5856
- name: Build (Unix)
5957
if: runner.os != 'Windows'
6058
run: cmake --build build --config ${{ matrix.build_type }} --parallel
6159

6260
- name: Build (Windows)
6361
if: runner.os == 'Windows'
64-
# Single-threaded build on Windows to avoid compiler heap space issues with large test files
65-
run: cmake --build build --config ${{ matrix.build_type }} --parallel 1
62+
# Single-threaded build to avoid C1060 "compiler out of heap space" on GitHub's 16GB Windows runners
63+
# Even /m:4 exhausts heap with deeply nested JSON initializers in test files
64+
run: cmake --build build --config ${{ matrix.build_type }} -- /m:1 /p:CL_MPCount=1
6665

6766
- name: Test
6867
run: ctest --test-dir build -C ${{ matrix.build_type }} --output-on-failure

CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,22 @@ if(FASTMCPP_BUILD_TESTS)
229229
target_link_libraries(fastmcpp_server_patterns PRIVATE fastmcpp_core)
230230
add_test(NAME fastmcpp_server_patterns COMMAND fastmcpp_server_patterns)
231231

232-
add_executable(fastmcpp_server_interactions tests/server/interactions.cpp)
233-
target_link_libraries(fastmcpp_server_interactions PRIVATE fastmcpp_core)
234-
add_test(NAME fastmcpp_server_interactions COMMAND fastmcpp_server_interactions)
232+
# Split into 4 parts to avoid MSVC heap exhaustion on CI (C1060 + OutOfMemoryException)
233+
add_executable(fastmcpp_server_interactions_part1 tests/server/interactions_part1.cpp)
234+
target_link_libraries(fastmcpp_server_interactions_part1 PRIVATE fastmcpp_core)
235+
add_test(NAME fastmcpp_server_interactions_part1 COMMAND fastmcpp_server_interactions_part1)
236+
237+
add_executable(fastmcpp_server_interactions_part2a tests/server/interactions_part2a.cpp)
238+
target_link_libraries(fastmcpp_server_interactions_part2a PRIVATE fastmcpp_core)
239+
add_test(NAME fastmcpp_server_interactions_part2a COMMAND fastmcpp_server_interactions_part2a)
240+
241+
add_executable(fastmcpp_server_interactions_part2b tests/server/interactions_part2b.cpp)
242+
target_link_libraries(fastmcpp_server_interactions_part2b PRIVATE fastmcpp_core)
243+
add_test(NAME fastmcpp_server_interactions_part2b COMMAND fastmcpp_server_interactions_part2b)
244+
245+
add_executable(fastmcpp_server_interactions_part3 tests/server/interactions_part3.cpp)
246+
target_link_libraries(fastmcpp_server_interactions_part3 PRIVATE fastmcpp_core)
247+
add_test(NAME fastmcpp_server_interactions_part3 COMMAND fastmcpp_server_interactions_part3)
235248

236249
add_executable(fastmcpp_server_context_meta tests/server/context_meta.cpp)
237250
target_link_libraries(fastmcpp_server_context_meta PRIVATE fastmcpp_core)

0 commit comments

Comments
 (0)