Skip to content

Add Windows to CI matrix - #2

Merged
revarbat merged 6 commits into
mainfrom
add-windows-ci
Jul 26, 2026
Merged

Add Windows to CI matrix#2
revarbat merged 6 commits into
mainfrom
add-windows-ci

Conversation

@revarbat

Copy link
Copy Markdown
Member

Summary

  • Adds windows-latest to the CI matrix, alongside the existing ubuntu-latest/macos-latest.
  • CMakeLists.txt: points BISON_EXECUTABLE/FLEX_EXECUTABLE at win_bison.exe/win_flex.exe (what the winflexbison3 Chocolatey package actually installs) on WIN32, mirroring the existing macOS Homebrew-bison override.
  • --config/-C Release on the build/test steps: required for Windows's default multi-config Visual Studio generator (which ignores CMAKE_BUILD_TYPE); harmless no-op on the single-config generators Linux/macOS use.
  • Also bumped actions/checkout v4 → v7 (v4 still targets the now-deprecated Node 20 runtime).

This is the first time this codebase has ever been built with MSVC — no local Windows environment to pre-verify against, so I expect this may need follow-up fixes once CI actually runs.

Test plan

  • YAML validated for syntax
  • Will check the actual Windows run and fix whatever it finds

🤖 Generated with Claude Code

revarbat and others added 6 commits July 25, 2026 18:52
CMakeLists.txt: winflexbison3 (the Chocolatey package CI installs)
provides win_bison.exe/win_flex.exe, not binaries literally named
bison/flex -- a new WIN32 block points BISON_EXECUTABLE/FLEX_EXECUTABLE
at those explicitly, mirroring the existing macOS Homebrew override
right above it rather than relying on FindBISON/FindFLEX's own search
to already know the Windows-specific name.

ci.yml: adds windows-latest to the matrix, a winflexbison3 install
step, and --config/-C Release on the build/test steps (a no-op on the
single-config generators Linux/macOS use, but required on Windows's
default multi-config Visual Studio generator, which ignores
CMAKE_BUILD_TYPE entirely). Also bumps actions/checkout v4 -> v7 while
here (v4 still targets node20, which GitHub Actions runners now flag
for deprecation).

This is the first time this codebase has ever been built with MSVC --
expect follow-up fixes once CI actually runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
winflexbison3's Chocolatey package is stuck on its 2021 release (bison
3.7.4), which fails parser.y's own `%require "3.8"` check
("require bison 3.8, but have 3.7.4", confirmed by the actual CI run).
windows-latest ships MSYS2 pre-installed at C:\msys64 with a current
bison (3.8.2); point CMake at those binaries directly, falling back to
win_bison/win_flex for a dev machine that has winflexbison instead.
Also bumps find_package(BISON ...)'s own minimum from 3.5 to 3.8 to
match the grammar's real requirement, so a too-old bison anywhere
fails at configure time with a clear message rather than a confusing
one from bison itself mid-build.
MSVC's cl.exe doesn't understand GCC/Clang-style -Wall/-Wextra flags
("invalid numeric argument '/Wextra'") -- gate them with a
CXX_COMPILER_ID generator expression so Linux/macOS keep the same
warnings unchanged and Windows just skips them (MSVC has its own
default warning level already).
Two genuine first-ever-MSVC compile errors, both from this being the
parser's first Windows build:

- parser.y: NodePtr (unique_ptr<ASTNode>) is move-only. Every action
  already moves it explicitly, which GCC/Clang tolerate, but MSVC's
  more eager instantiation of value_type::copy<T> (referenced by
  emplace<T> whether or not it's ever actually called) fails to
  compile for a non-copyable T. `%define api.value.automove` is
  Bison's own documented fix for move-only semantic value types.

- lexer.l: flex's generated scanner includes <unistd.h> by default,
  which doesn't exist on Windows/MSVC. `%option nounistd` disables it;
  we never use the isatty()/POSIX-I/O codepath it guards anyway
  (never-interactive already opts out of interactive-terminal
  handling).

Verified locally on macOS/Clang first: clean rebuild from scratch,
full 626-test suite passes unchanged -- confirms automove didn't
alter parse behavior on the platforms this was already working on.
Root-caused the "attempting to reference a deleted function" copy-ctor
error that survived the api.value.automove fix: Bison's own
lalr1.cc-skeleton stack-symbol move/copy constructor picks move vs.
copy via a YY_MOVE_OR_COPY macro gated purely on
`__cplusplus >= 201103L` (parser.tab.hpp) -- nothing to do with
automove, which only affects user action code, not this internal
stack-management path. MSVC famously always reports __cplusplus as
199711L for legacy-compatibility reasons regardless of the real /std:
level unless /Zc:__cplusplus is explicitly passed, so Bison's
generated code silently took the pre-C++11 copy-based branch and
failed to compile for our move-only NodePtr semantic type. Confirmed
by inspecting the actual generated parser.tab.cpp/.hpp locally
(YY_MOVE_OR_COPY expands to `copy` under the pre-C++11 branch,
`move` otherwise) rather than guessing from the error message alone.
SourceMap.ProcessIncludesSplicesFileContentInPlace failed only on
windows-latest: the local writeFile() test helper (duplicated in
test_source_map.cpp and test_comments_and_files.cpp) opened its
ofstream in text mode, so on Windows every '\n' in a fixture's content
silently became '\r\n' on disk. The production reader
(source_map.cpp's processIncludes) opens included files in binary
mode, so it never strips that '\r' back out -- a real, if latent,
mismatch that Linux/macOS masked completely (text and binary mode are
identical there) until this was the first-ever Windows test run.
Fixed by writing the fixture in binary mode too, so what's on disk
matches the literal string passed in on every platform.
@revarbat
revarbat merged commit 35d9957 into main Jul 26, 2026
3 checks passed
@revarbat
revarbat deleted the add-windows-ci branch July 26, 2026 02:23
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