Skip to content

ci: run the test suite on windows-latest (fork verification) - #2

Open
JamBalaya56562 wants to merge 1 commit into
mainfrom
windows-ci
Open

ci: run the test suite on windows-latest (fork verification)#2
JamBalaya56562 wants to merge 1 commit into
mainfrom
windows-ci

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Fork-internal verification before opening upstream. Confirms the job still passes without the C:\Program Files\Git\bin PATH addition that earlier rounds carried — round 3 measured that directory as already first on PATH, so it should be unnecessary.

Summary by Sourcery

Add a Windows CI job to build and run tests while adjusting shell and line-ending behavior for that platform.

CI:

  • Introduce a windows-latest test job that builds the project and runs the test suite using mise.
  • Configure Git on Windows runners to disable automatic CRLF conversion to keep fixtures and expected outputs consistent.
  • Set USAGE_SHELL_BASH to Git Bash on Windows to avoid invoking the WSL launcher when running bash-based usage tests.

Tests:

  • Relax shell-missing panics in completion tests to only apply on Unix CI runners, allowing expected absence of POSIX shells on Windows.

@sourcery-ai

sourcery-ai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a Windows CI job that builds and runs tests with appropriate shell and line-ending configuration, while relaxing a shell-completion test guard so missing POSIX shells on non-Unix runners (like Windows) don’t cause CI panics.

File-Level Changes

Change Details Files
Introduce a Windows CI job that builds and runs the Rust test suite with Windows-specific configuration.
  • Add a test-windows job that runs on windows-latest with read-only contents permissions.
  • Configure git core.autocrlf=false before checkout to keep fixtures and expected outputs using LF line endings.
  • Use actions/checkout with submodules, rust-cache with a dedicated shared key, and jdx/mise-action for toolchain setup.
  • Run mise r build and mise r test on Windows to validate build and tests on that platform.
  • Set USAGE_SHELL_BASH to Git Bash’s bash.exe so tests use Git Bash instead of the WSL launcher bash.exe.
.github/workflows/test.yml
Relax the CI shell-missing panic to apply only on Unix so Windows CI can legitimately skip zsh/fish completion tests.
  • Update skip_if_shell_missing to only panic when CI is set and the target platform is Unix (cfg!(unix)).
  • Clarify the documentation comment to distinguish between Unix runners that install shells (where missing shells are a configuration bug) and Windows runners that do not (where absence is expected).
cli/tests/shell_completions_integration.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • The hardcoded USAGE_SHELL_BASH path to C:\Program Files\Git\bin\bash.exe may be brittle if the Windows image changes; consider resolving the Git Bash path dynamically (e.g., via where bash or a small helper) and exporting that instead.
  • The cfg!(unix) guard in skip_if_shell_missing assumes that only Unix CI runners will have zsh/fish installed; if you ever add macOS or other non-Linux Unix runners, verify that this behavior is still correct or make the check explicitly tied to the shells/runners where installation is expected.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hardcoded `USAGE_SHELL_BASH` path to `C:\Program Files\Git\bin\bash.exe` may be brittle if the Windows image changes; consider resolving the Git Bash path dynamically (e.g., via `where bash` or a small helper) and exporting that instead.
- The `cfg!(unix)` guard in `skip_if_shell_missing` assumes that only Unix CI runners will have zsh/fish installed; if you ever add macOS or other non-Linux Unix runners, verify that this behavior is still correct or make the check explicitly tied to the shells/runners where installation is expected.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@JamBalaya56562
JamBalaya56562 force-pushed the windows-ci branch 6 times, most recently from 1915875 to 49dfd23 Compare August 9, 2026 07:37
usage is used on Windows and released for it, but nothing has been testing it
there. jdx#771 made the suite runnable on the platform; this runs it.

Build and test only. `render` asserts a clean git diff, which line endings and
the checked-in symlinks make unreliable, and `lint` is a property of the source
rather than of the platform — the Linux job already covers both. mise's Windows
jobs are shaped the same way.

Two settings the job needs, both measured on a runner rather than assumed:

`core.autocrlf false`, set before checkout. git defaults it to true on Windows
and the repo has no .gitattributes, so fixtures and expected output arrive with
CRLF. Seven help tests in lib/tests/parse.rs and two in cli/tests/markdown.rs
fail on it, and the failure is near-unreadable: pretty_assertions prints both
sides as identical, because the only difference is invisible.

`USAGE_SHELL_BASH`, because the image carries System32's bash.exe — the WSL
launcher, with no distribution installed. `where bash` lists Git Bash first and
CreateProcess still reaches System32, since it searches the system directory
before PATH. Without the variable `usage bash` exits 1 with "Windows Subsystem
for Linux has no installed distributions". This is the case USAGE_SHELL_BASH was
added for in jdx#767, and the runner turns out to be an example of it.

zsh and fish are not installed, and are not worth installing: nothing on Windows
ships them, and the completion tests skip a shell they cannot run. So the `CI`
rule in `skip_if_shell_missing` — which refuses to skip, on the grounds that a
missing shell on a runner that installs one is a configuration bug — now applies
on Unix only. Only the Linux job installs shells, so only there is absence a
bug. mise draws the same line, installing no POSIX shells on Windows at all.

Measured on windows-latest: 538 passed, 0 failed, 0 skipped.
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