Skip to content

Add CI workflow and per-configuration compiler flags#4

Open
jackthepunished wants to merge 1 commit into
mainfrom
ci-build-hygiene
Open

Add CI workflow and per-configuration compiler flags#4
jackthepunished wants to merge 1 commit into
mainfrom
ci-build-hygiene

Conversation

@jackthepunished

@jackthepunished jackthepunished commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Per-configuration compiler flags: optimization flags (/O2 /GL /arch:AVX2 /fp:fast on MSVC; -O3 -flto -ffast-math etc. on GCC/Clang) now apply only to Release builds via $<$<CONFIG:Release>:...> generator expressions. MSVC Debug builds previously failed outright on the /O2 vs /RTC1 collision; both configurations now build and pass all 51 tests.
  • -march=native portability guard: gated behind check_cxx_compiler_flag so compilers that reject it (older Apple Clang on arm64) skip it instead of failing configure.
  • CI matrix (.github/workflows/ci.yml): GCC + Clang on Ubuntu, Clang on macOS, MSVC on Windows in both Release and Debug — the Debug job exists specifically to keep the per-config flags honest. Every job runs the full CTest suite.
  • README: removed the now-obsolete MSVC Debug warning, checked off both roadmap items, added the CI badge.
  • .gitignore: cover build-*/ trees.

Test plan

  • Local Release build (MinGW GCC 15.2): warning-free, 51/51 checks pass
  • Local Debug build: configures and compiles (previously impossible by design), 51/51 checks pass (~33s — Monte Carlo at -O0, expectation documented in README)
  • CI matrix green on this PR — the MSVC and macOS jobs run for the first time here

Copilot AI review requested due to automatic review settings July 9, 2026 19:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions CI workflow building and testing across GCC, Clang, and MSVC configurations. Refactors CMakeLists.txt to apply optimization/LTO/architecture flags only in Release builds while keeping warnings always enabled. Updates .gitignore, README badge, build guidance, and roadmap.

Changes

CI and Build Configuration

Layer / File(s) Summary
Per-configuration compiler/linker flags
CMakeLists.txt
Optimization, architecture, and LTO flags are now applied only for Release builds via generator expressions for both MSVC and non-MSVC toolchains, while warnings remain enabled in all configurations; -march=native is now conditionally applied based on compiler support.
CI workflow definition
.github/workflows/ci.yml
New workflow triggers on push to main and pull requests, runs a matrix build across Ubuntu/macOS/Windows with GCC/Clang/MSVC, sets CC/CXX, and configures, builds, and tests with CMake/CTest.
Docs and ignore updates
.gitignore, README.md
Adds a build-*/ ignore pattern, a CI badge, rewritten build/debug guidance, and checked-off roadmap items for per-configuration flags and CI coverage.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHub
  participant Runner
  participant CMake
  participant CTest
  GitHub->>Runner: trigger on push/pull_request
  Runner->>Runner: set CC/CXX from matrix
  Runner->>CMake: configure with build_type
  Runner->>CMake: build --config --parallel
  Runner->>CTest: run tests -C build_type
  CTest-->>Runner: --output-on-failure results
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding CI and making compiler flags configuration-specific.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci-build-hygiene

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

1-54: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Consider adding ccache for faster CI builds.

For a C++ project, ccache can significantly speed up rebuilds by caching compiled object files. This is optional but straightforward to add for the Linux/macOS jobs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 1 - 54, Add ccache support to speed up
repeated CI builds on the non-Windows jobs. Update the build-and-test job in the
CI workflow so the ubuntu-latest and macos-latest matrix entries use ccache when
configuring and building with CMake, while leaving the windows-latest entries
unchanged. Use the existing matrix fields like name/os/build_type and the
Configure/Build steps to wire in the cache-enabled compiler launcher.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 45: The checkout step in the CI workflow should disable GitHub token
persistence. Update the existing actions/checkout@v4 usage to set
persist-credentials to false so the workflow does not leave credentials in the
local git config; this change should be made in the checkout job step and kept
consistent with the rest of the build/test-only workflow.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 1-54: Add ccache support to speed up repeated CI builds on the
non-Windows jobs. Update the build-and-test job in the CI workflow so the
ubuntu-latest and macos-latest matrix entries use ccache when configuring and
building with CMake, while leaving the windows-latest entries unchanged. Use the
existing matrix fields like name/os/build_type and the Configure/Build steps to
wire in the cache-enabled compiler launcher.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 651dfdba-422a-42e8-b317-12e40c1c2bff

📥 Commits

Reviewing files that changed from the base of the PR and between fb41e61 and f137ca3.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .gitignore
  • CMakeLists.txt
  • README.md

Comment thread .github/workflows/ci.yml
CXX: ${{ matrix.cxx }}

steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

Set persist-credentials: false on checkout.

actions/checkout@v4 persists a GitHub token in the local git config by default. Since this workflow only builds and tests, there's no need for token persistence. Disabling it reduces the attack surface if a build step ever executes untrusted input.

🛡️ Proposed fix
       - uses: actions/checkout@v4
+        with:
+          persist-credentials: false
📝 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
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
persist-credentials: false
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 45-45: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 45, The checkout step in the CI workflow
should disable GitHub token persistence. Update the existing actions/checkout@v4
usage to set persist-credentials to false so the workflow does not leave
credentials in the local git config; this change should be made in the checkout
job step and kept consistent with the rest of the build/test-only workflow.

Source: Linters/SAST tools

Optimization flags (including /O2, /GL, -O3, -flto, -ffast-math) now apply
only to Release builds via generator expressions, so MSVC Debug builds no
longer fail on the /O2 vs /RTC1 collision. -march=native is gated behind a
compiler capability check for portability to older Apple Clang on arm64.

The GitHub Actions matrix covers GCC/Clang on Ubuntu, Clang on macOS, and
MSVC on Windows in both Release and Debug, running the full CTest suite.
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