Skip to content

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

Open
mvandeberg wants to merge 1 commit intocppalliance:developfrom
mvandeberg:pr/improved-build-matrix
Open

Generate build matrix and extend builds for better CI coverage#187
mvandeberg wants to merge 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

📝 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
.github/compilers.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

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 01:07:05 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)
  • .github/compilers.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

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.

@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.38%. Comparing base (49f76ca) to head (7bb9c60).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #187      +/-   ##
===========================================
+ Coverage    76.17%   76.38%   +0.20%     
===========================================
  Files           98       98              
  Lines        10532    10527       -5     
  Branches      2388     2388              
===========================================
+ Hits          8023     8041      +18     
+ Misses        1797     1775      -22     
+ Partials       712      711       -1     
Flag Coverage Δ
macos 66.69% <100.00%> (+0.26%) ⬆️

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

Files with missing lines Coverage Δ
...boost/corosio/native/detail/iocp/win_scheduler.hpp 62.73% <ø> (+0.47%) ⬆️
...t/corosio/native/detail/iocp/win_timers_thread.hpp 65.95% <ø> (-0.71%) ⬇️
include/boost/corosio/tcp_server.hpp 80.00% <ø> (-0.48%) ⬇️
src/corosio/src/tcp_server.cpp 59.77% <100.00%> (+0.94%) ⬆️

... and 1 file 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...7bb9c60. 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

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 01:14:00 UTC

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