Skip to content

ci: add cross-platform test matrix#24

Open
don-petry wants to merge 13 commits intooneirosoft:mainfrom
don-petry:ci/cross-platform-testing
Open

ci: add cross-platform test matrix#24
don-petry wants to merge 13 commits intooneirosoft:mainfrom
don-petry:ci/cross-platform-testing

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented Mar 31, 2026

Why?

Cross-platform CI catches real portability bugs before they reach users. The Windows test failures revealed that the test suite's gh CLI mocking strategy was Unix-only — shell scripts can't execute on Windows. This PR fixes the underlying portability gap so the full test suite passes on all three platforms.

Addresses item 3 in #11.

Summary

  • Expand the CI verify job into a cross-platform matrix running on ubuntu-24.04, macos-latest, and windows-latest with fail-fast: false
  • All existing steps (cargo fmt, cargo check, cargo test) now execute on all three platforms
  • Extensive Windows compatibility fixes for the test suite:
    • Add DAGGER_GH_BIN env var override in src/core/gh.rs so tests can point to a fake gh executable on Windows (where Command::new("gh") only resolves .exe, not .cmd)
    • Add Windows .cmd batch script equivalents for all fake gh mocks across unit tests (src/core/sync.rs), integration tests (tests/pr.rs, tests/sync.rs, tests/branch.rs)
    • Handle platform differences in PATH separators (; vs :), executable discovery (where vs which), and echo quoting behavior
    • Add read_gh_log() test helpers to normalize logged output across platforms (strip Windows-added quotes and trailing whitespace)

Test plan

  • Verify the workflow triggers and spawns three matrix jobs
  • Confirm Ubuntu and macOS complete all build/test steps
  • Confirm Windows completes all build/test steps (176 unit tests + 16 PR tests + 35 sync tests + integration tests)
  • Check that a failure on one platform does not cancel the others

🤖 Generated with Claude Code

Run the verify job on ubuntu-24.04, macos-latest, and windows-latest
using a matrix strategy with fail-fast disabled so all platforms report
results independently.

Refs oneirosoft#11 (item 3)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 31, 2026 02:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds cross-platform coverage to the existing CI verification job by running the same Rust formatting, compilation, and test steps on Ubuntu, macOS, and Windows.

Changes:

  • Convert verify into a matrix job running on ubuntu-24.04, macos-latest, and windows-latest
  • Disable fail-fast so failures on one OS don’t cancel the others

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mark-pro mark-pro force-pushed the ci/cross-platform-testing branch from 9cab53f to c5eff9b Compare April 1, 2026 01:07
DJ and others added 12 commits March 31, 2026 20:14
Replace direct uses of std::os::unix::process::ExitStatusExt in test
code with cfg-gated helper functions that compile on both Unix and
Windows platforms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test `reports_pull_request_base_updates_before_each_retarget` failed
on Windows because it used a Unix shell script as a fake `gh` executable
which Windows cannot execute. The real `gh` CLI was found instead,
failing due to missing GH_TOKEN in CI.

Three fixes:
- Use a .cmd batch script on Windows instead of a shell script
- Use platform-appropriate PATH separator (`;` on Windows, `:` on Unix)
- Create the fake executable with .cmd extension on Windows so
  Command::new("gh") can discover it

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On Windows, Command::new("gh") only resolves gh.exe via CreateProcessW,
not gh.cmd scripts. The previous approach of prepending a fake-bin dir
to PATH with a gh.cmd wrapper was ineffective because the real gh.exe
was always found first.

Introduce a gh_program() helper that checks DAGGER_GH_BIN before
falling back to "gh". The test now sets this env var on Windows to
point directly at the .cmd wrapper, bypassing PATH resolution entirely.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The init_lineage_shows_tracked_pull_request_numbers test failed on Windows
because the fake gh mock was a Unix shell script that Windows cannot execute.

- Add Windows .cmd batch script variant for the fake gh in branch tests
- install_fake_executable now writes .cmd files on Windows
- path_with_prepend uses ; separator on Windows instead of :
- git_binary_path uses where instead of which on Windows
- Set DAGGER_GH_BIN env var so gh_program() finds the .cmd wrapper

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Windows .cmd equivalents for every fake gh shell script in pr.rs
and pass DAGGER_GH_BIN to ensure the correct executable is resolved.
This follows the same cross-platform pattern already applied to
branch.rs and support/mod.rs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…for Windows

Three fixes for Windows CI test failures in tests/pr.rs:

1. Add read_gh_log() helper that strips quotes and trims trailing spaces
   from each log line. On Windows, echo %* in .cmd scripts preserves
   literal quote characters and appends a trailing space.

2. Fix .cmd scripts using for /f to set CURRENT_BRANCH by enabling
   delayed expansion (setlocal enabledelayedexpansion) and using
   !CURRENT_BRANCH! instead of %CURRENT_BRANCH%. Without this, the
   variable is expanded at parse time (empty) rather than at execution
   time.

3. Add diagnostic message to pr_reports_missing_gh_cli assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On Windows, a missing gh executable produces "program not found" instead
of io::ErrorKind::NotFound, so normalize_gh_spawn_error doesn't convert
it to the friendly message. Accept both variants in the assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update install_fake_gh in sync.rs to accept both Unix and Windows
scripts (matching the pattern already applied in pr.rs). Add
DAGGER_GH_BIN env var and read_gh_log normalization for cross-platform
gh log assertions.

Affected tests:
- sync_repairs_closed_child_pull_request_after_remote_parent_branch_deletion
- sync_repairs_multiple_child_pull_requests_with_one_temporary_parent_restore
- sync_skips_pull_request_repair_for_open_merged_or_retargeted_children
- sync_repairs_closed_child_pull_request_when_parent_branch_is_missing_locally
- sync_removes_local_parent_branch_after_repair_when_parent_was_merged_upstream
- sync_aborts_before_local_cleanup_when_pull_request_repair_fails

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…_executable

On Windows, install_fake_executable appends ".cmd" to the filename, but git
hooks must be named without extensions (git uses its bundled MSYS2 bash to
run them). This caused the update hook to never execute, so the
origin-updates.log stayed empty and count_remote_ref_updates returned 0
instead of the expected 2.

Write the hook file directly with forward-slash paths (MSYS2 bash treats
backslashes as escape characters) and set executable permissions on Unix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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