Skip to content

Speed up Windows CI: Ninja generator + cmocka caching#405

Merged
PJK merged 10 commits intomasterfrom
speedup-windows-ci
Feb 15, 2026
Merged

Speed up Windows CI: Ninja generator + cmocka caching#405
PJK merged 10 commits intomasterfrom
speedup-windows-ci

Conversation

@PJK
Copy link
Owner

@PJK PJK commented Feb 9, 2026

Summary

  • Switch to Ninja generator: Replace the VS generator with Ninja for faster configure (no .vcxproj generation, faster trial compilations) and build. Uses vswhere to locate vcvarsall.bat, writes batch scripts from bash to keep the MSVC environment within a single cmd session.
  • Cache cmocka build: Use CircleCI save_cache/restore_cache to skip rebuilding cmocka (~215s) on every run.
  • Parallel builds: Add --parallel to cmake --build commands.

Baseline timings (VS generator, no cache)

Step Time
cmocka configure 206s
cmocka build 9s
libcbor configure 74s
libcbor build 76s (failed)

Observed timings (VS generator, cached cmocka, --parallel)

Step Time
cmocka (cached) 2s
libcbor configure 88s
libcbor build 23s
Tests 3s

Ninja should further reduce the configure step.

Test plan

  • build-and-test-win passes with Ninja generator
  • Compare configure + build timings against VS generator baseline

🤖 Generated with Claude Code

PJK and others added 6 commits February 9, 2026 01:17
- Add _CRT_SECURE_NO_WARNINGS to cbor_project_options INTERFACE library
  so examples/tests don't fail with C4996 errors from /sdl (sscanf,
  freopen, fopen)
- Restrict LTO to Release builds only (CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE)
  to avoid unnecessary LTCG overhead in Debug
- Add --parallel to cmake --build on Windows CI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add-MpExclusion for the project directory to prevent real-time
scanning overhead during cmake configure and build steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The cmocka configure step takes ~206s on MSVC due to each
check_function_exists call spawning cl.exe with high startup overhead.
Cache the build so it's only paid once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0a54bbb) to head (f8eb6db).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #405   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         1663      1663           
=========================================
  Hits          1663      1663           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

PJK and others added 4 commits February 15, 2026 22:51
Use Ninja instead of VS generator to speed up configure (no .vcxproj
generation, faster trial compilations) and build steps. Uses vswhere
to locate vcvarsall.bat, writes batch scripts from bash to avoid
quoting issues across shells.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PJK PJK changed the title Speed up Windows CI with Defender exclusion Speed up Windows CI: Ninja generator + cmocka caching Feb 15, 2026
@PJK PJK merged commit 02d5bc5 into master Feb 15, 2026
18 checks passed
@PJK PJK deleted the speedup-windows-ci branch February 15, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant