Skip to content

Generate build matrix and extend builds for better CI coverage#187

Merged
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/improved-build-matrix
Mar 4, 2026
Merged

Generate build matrix and extend builds for better CI coverage#187
mvandeberg merged 1 commit intocppalliance:developfrom
mvandeberg:pr/improved-build-matrix

Conversation

@mvandeberg
Copy link
Contributor

@mvandeberg mvandeberg commented Mar 4, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows scheduler error handling to prevent fatal failures during shutdown, allowing graceful termination via timeout detection instead of throwing exceptions
    • Enhanced thread shutdown robustness by gracefully handling exceptions during cleanup operations
  • Chores

    • Updated CI/build infrastructure with dynamic matrix-based configuration generation
    • Refactored internal lifecycle management for better maintainability

@coderabbitai
Copy link

coderabbitai bot commented Mar 4, 2026

Warning

Rate limit exceeded

@mvandeberg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 10 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dec44328-7792-447e-8a95-850cd273ca52

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb9c60 and 831e549.

📒 Files selected for processing (8)
  • .fd.fxlcf.dpdns.orgpilers.json
  • .github/generate-matrix.py
  • .github/workflows/ci.yml
  • CMakeLists.txt
  • include/boost/corosio/native/detail/iocp/win_scheduler.hpp
  • include/boost/corosio/native/detail/iocp/win_timers_thread.hpp
  • include/boost/corosio/tcp_server.hpp
  • src/corosio/src/tcp_server.cpp
📝 Walkthrough

Walkthrough

The PR introduces a dynamic GitHub Actions CI matrix generation system using a JSON compiler configuration file and Python generator script, refactors the workflow to use generated matrices, adds exception-safe Windows scheduler shutdown handling, and separates worker base class lifecycle methods to the implementation file.

Changes

Cohort / File(s) Summary
CI Matrix Infrastructure
.fd.fxlcf.dpdns.orgpilers.json, .github/generate-matrix.py
New JSON compiler matrix defining toolchains (gcc, clang, msvc, clang-cl, apple-clang, mingw) with per-version metadata; Python script generates CI matrix entries with conditional variants (ARM, sanitizers, coverage, x86).
CI Workflow Refactoring
.github/workflows/ci.yml
Replaced static inline matrix with dynamic generation job; added platform-agnostic conditionals (startsWith, contains on matrix properties); introduced FreeBSD job scaffold; refactored ARM and Visual Studio-specific handling; removed hard-coded platform branches.
Build Configuration
CMakeLists.txt
Added conditional runtime output directory for shared library builds at repository root.
Windows Scheduler Shutdown
include/boost/corosio/native/detail/iocp/win_scheduler.hpp, include/boost/corosio/native/detail/iocp/win_timers_thread.hpp
Changed PostQueuedCompletionStatus failure handling from exception throw to non-fatal flag; wrapped thread join in try/catch to suppress exceptions during shutdown.
TCP Server Lifecycle
include/boost/corosio/tcp_server.hpp, src/corosio/src/tcp_server.cpp
Extracted worker_base constructor and destructor from header (default = default removal) to implementation file with explicit defaulted definitions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A matrix blooms from JSON seed,
With Python magic, all we need,
Windows threads now quietly rest,
Exceptions caught, exceptions blessed—
From config springs the CI fest! 🎯

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: introducing a build matrix generation system and expanding CI coverage across multiple compilers and platforms.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link

cppalliance-bot commented Mar 4, 2026

An automated preview of the documentation is available at https://187.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-03-04 16:31:54 UTC

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
include/boost/corosio/native/detail/iocp/win_scheduler.hpp (1)

381-397: ⚠️ Potential issue | 🟠 Major

Potential infinite loop when PostQueuedCompletionStatus fails in stop().

The comment claims the run loop will notice via the GQCS timeout and exit, but tracing through do_one(): when timeout_ms == INFINITE (as in run()), a timeout does not return 0—it continues the loop (lines 635-636). The only stopped() check is in the key_shutdown handler (line 615), which is unreachable if PQCS failed.

If PQCS fails, do_one(INFINITE) will loop forever, waking every 500ms but never exiting because stopped() is not checked after timeout.

Proposed fix: check stopped() after timeout when using INFINITE
         // Timeout or error
         if (dwError != WAIT_TIMEOUT)
             detail::throw_system_error(make_err(dwError));
         if (timeout_ms != INFINITE)
             return 0;
+        // Check stopped_ for graceful exit when PQCS failed in stop()
+        if (stopped())
+            return 0;
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@include/boost/corosio/native/detail/iocp/win_scheduler.hpp` around lines 381
- 397, The stop() path can leave the loop stuck if PostQueuedCompletionStatus
fails because do_one(INFINITE) never checks stopped() after a GQCS timeout;
update the wait/timeout handling in win_scheduler::do_one (and/or run) so that
when a GetQueuedCompletionStatus timeout occurs (the INFINITE wait path), you
call stopped() and exit/return early if stopped_ is set; ensure the key_shutdown
handling (key_shutdown) remains for the normal PQCS path and that
stop_event_posted_/stopped_ are still set by win_scheduler::stop before checking
stopped() in do_one.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 728-748: The FreeBSD path in the "Patch Boost" step (id: patch) is
missing the sparse-checkout normalization done elsewhere, which causes missing
CMakeLists.txt during the FreeBSD CMake build; modify the "Patch Boost" step so
that before copying boost-source into boost-root (around the cp -rL boost-source
boost-root and subsequent cd boost-root / boost_root handling) you run the same
sparse-checkout normalization sequence used in the main patch flow
(disable/clear sparse-checkout and restore full tree so CMakeLists.txt are
present), ensuring the git workspace is normalized prior to copying in
corosio-root and capy-root.

---

Outside diff comments:
In `@include/boost/corosio/native/detail/iocp/win_scheduler.hpp`:
- Around line 381-397: The stop() path can leave the loop stuck if
PostQueuedCompletionStatus fails because do_one(INFINITE) never checks stopped()
after a GQCS timeout; update the wait/timeout handling in win_scheduler::do_one
(and/or run) so that when a GetQueuedCompletionStatus timeout occurs (the
INFINITE wait path), you call stopped() and exit/return early if stopped_ is
set; ensure the key_shutdown handling (key_shutdown) remains for the normal PQCS
path and that stop_event_posted_/stopped_ are still set by win_scheduler::stop
before checking stopped() in do_one.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a26a66 and 7bb9c60.

📒 Files selected for processing (8)
  • .fd.fxlcf.dpdns.orgpilers.json
  • .github/generate-matrix.py
  • .github/workflows/ci.yml
  • CMakeLists.txt
  • include/boost/corosio/native/detail/iocp/win_scheduler.hpp
  • include/boost/corosio/native/detail/iocp/win_timers_thread.hpp
  • include/boost/corosio/tcp_server.hpp
  • src/corosio/src/tcp_server.cpp

Comment on lines +728 to +748
- name: Patch Boost
id: patch
run: |
set -xe
module=${GITHUB_REPOSITORY#*/}
echo "module=$module" >> $GITHUB_OUTPUT

workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')

rm -r "boost-source/libs/$module" || true
rm -r "boost-source/libs/capy" || true

cp -rL boost-source boost-root

cd boost-root
boost_root="$(pwd)"
echo -E "boost_root=$boost_root" >> $GITHUB_OUTPUT

cp -r "$workspace_root"/corosio-root "libs/$module"
cp -r "$workspace_root"/capy-root "libs/capy"

Copy link

@coderabbitai coderabbitai bot Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

FreeBSD patch flow is missing sparse-checkout normalization required for CMake builds.

The main patch flow explicitly disables sparse-checkout to restore missing CMakeLists.txt files (Line 145 onward), but this FreeBSD path doesn’t. With the new FreeBSD CMake step (Line 767), this can cause configure/build failures.

🔧 Proposed fix
       - name: Patch Boost
         id: patch
         run: |
           set -xe
           module=${GITHUB_REPOSITORY#*/}
           echo "module=$module" >> $GITHUB_OUTPUT

           workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')

           rm -r "boost-source/libs/$module" || true
           rm -r "boost-source/libs/capy" || true
+
+          # boost-clone uses sparse checkout which can omit CMakeLists.txt files
+          # needed by CMake integration tests.
+          cd boost-source
+          if git sparse-checkout list > /dev/null 2>&1; then
+            echo "Disabling sparse checkout..."
+            git sparse-checkout disable
+            echo "Fetching any missing objects..."
+            git fetch origin --no-tags
+            git checkout
+          fi
+          cd ..

           cp -rL boost-source boost-root
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Patch Boost
id: patch
run: |
set -xe
module=${GITHUB_REPOSITORY#*/}
echo "module=$module" >> $GITHUB_OUTPUT
workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')
rm -r "boost-source/libs/$module" || true
rm -r "boost-source/libs/capy" || true
cp -rL boost-source boost-root
cd boost-root
boost_root="$(pwd)"
echo -E "boost_root=$boost_root" >> $GITHUB_OUTPUT
cp -r "$workspace_root"/corosio-root "libs/$module"
cp -r "$workspace_root"/capy-root "libs/capy"
- name: Patch Boost
id: patch
run: |
set -xe
module=${GITHUB_REPOSITORY#*/}
echo "module=$module" >> $GITHUB_OUTPUT
workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')
rm -r "boost-source/libs/$module" || true
rm -r "boost-source/libs/capy" || true
# boost-clone uses sparse checkout which can omit CMakeLists.txt files
# needed by CMake integration tests.
cd boost-source
if git sparse-checkout list > /dev/null 2>&1; then
echo "Disabling sparse checkout..."
git sparse-checkout disable
echo "Fetching any missing objects..."
git fetch origin --no-tags
git checkout
fi
cd ..
cp -rL boost-source boost-root
cd boost-root
boost_root="$(pwd)"
echo -E "boost_root=$boost_root" >> $GITHUB_OUTPUT
cp -r "$workspace_root"/corosio-root "libs/$module"
cp -r "$workspace_root"/capy-root "libs/capy"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 728 - 748, The FreeBSD path in the
"Patch Boost" step (id: patch) is missing the sparse-checkout normalization done
elsewhere, which causes missing CMakeLists.txt during the FreeBSD CMake build;
modify the "Patch Boost" step so that before copying boost-source into
boost-root (around the cp -rL boost-source boost-root and subsequent cd
boost-root / boost_root handling) you run the same sparse-checkout normalization
sequence used in the main patch flow (disable/clear sparse-checkout and restore
full tree so CMakeLists.txt are present), ensuring the git workspace is
normalized prior to copying in corosio-root and capy-root.

Copy link
Contributor Author

@mvandeberg mvandeberg Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sparse-checkout normalization is only needed for the integration test CMake steps (Find Package, Subdirectory, Root Project) which use add_subdirectory and need full source trees of Boost dependencies. The FreeBSD CMake build uses BOOST_INCLUDE_LIBRARIES with a top-level CMake configure — it fetches/builds only the specified module and its dependencies, and CMake's FetchContent/add_subdirectory within Boost's own build system handles this differently.

More importantly: the FreeBSD builds are passing. If the sparse checkout were actually causing missing CMakeLists.txt, the CMake configure would fail. So this is not a real issue.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvandeberg, thank you for the detailed clarification. You're right — the BOOST_INCLUDE_LIBRARIES top-level CMake configure path doesn't require the full sparse-checkout normalization that the integration test steps (Find Package, Subdirectory, Root Project) need, since those rely on add_subdirectory traversal across the full Boost source tree. The fact that FreeBSD builds were already passing confirms this. I'll withdraw the concern.


✏️ Learnings added
Learnt from: mvandeberg
Repo: cppalliance/corosio PR: 187
File: .github/workflows/ci.yml:728-748
Timestamp: 2026-03-04T16:26:10.447Z
Learning: In .github/workflows/ci.yml for the corosio project, sparse-checkout normalization (disabling git sparse-checkout and fetching missing objects) is only required before the integration test CMake steps (Find Package Integration, Subdirectory Integration, Root Project CMake Workflow) because they use add_subdirectory and need full source trees of Boost dependencies. The FreeBSD CMake job uses BOOST_INCLUDE_LIBRARIES with a top-level CMake configure, which does not require sparse-checkout normalization — Boost's own build system handles dependency resolution differently in that path.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.24%. Comparing base (49f76ca) to head (831e549).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...boost/corosio/native/detail/iocp/win_scheduler.hpp 0.00% 2 Missing and 1 partial ⚠️
...t/corosio/native/detail/iocp/win_timers_thread.hpp 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #187      +/-   ##
===========================================
+ Coverage    76.17%   76.24%   +0.06%     
===========================================
  Files           98       98              
  Lines        10532    10533       +1     
  Branches      2388     2390       +2     
===========================================
+ Hits          8023     8031       +8     
+ Misses        1797     1778      -19     
- Partials       712      724      +12     
Flag Coverage Δ
linux 83.45% <100.00%> (-0.11%) ⬇️
macos 66.64% <100.00%> (+0.21%) ⬆️
windows 69.74% <25.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/boost/corosio/tcp_server.hpp 80.00% <ø> (-0.48%) ⬇️
src/corosio/src/tcp_server.cpp 58.62% <100.00%> (-0.21%) ⬇️
...boost/corosio/native/detail/iocp/win_scheduler.hpp 62.03% <0.00%> (-0.24%) ⬇️
...t/corosio/native/detail/iocp/win_timers_thread.hpp 62.00% <0.00%> (-4.67%) ⬇️

... and 7 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49f76ca...831e549. Read the comment docs.

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

@cppalliance-bot
Copy link

cppalliance-bot commented Mar 4, 2026

GCOVR code coverage report https://187.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://187.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://187.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-03-04 16:40:59 UTC

@mvandeberg mvandeberg force-pushed the pr/improved-build-matrix branch from 7bb9c60 to 831e549 Compare March 4, 2026 16:27
@mvandeberg mvandeberg merged commit 4fc38ac into cppalliance:develop Mar 4, 2026
37 checks passed
@mvandeberg mvandeberg deleted the pr/improved-build-matrix branch March 4, 2026 16:51
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.

2 participants