Skip to content

ci: add windows and macos test matrix#128

Open
AlexCannonball wants to merge 4 commits into
coder3101:mainfrom
AlexCannonball:ci/cross-platform-build-test
Open

ci: add windows and macos test matrix#128
AlexCannonball wants to merge 4 commits into
coder3101:mainfrom
AlexCannonball:ci/cross-platform-build-test

Conversation

@AlexCannonball
Copy link
Copy Markdown
Contributor

Overview

Resolves #115. This PR introduces a cross-platform testing matrix to ensure protols builds and runs correctly on Windows and macOS (both Intel and Apple Silicon), alongside the existing Linux Dev Container tests.

Changes

  • Expanded CI Matrix: Added a test-cross-platform job to .github/workflows/ci.yml.
  • Platform Coverage:
    • Windows: x86_64-pc-windows-msvc (Ensures binary links correctly on Windows).
    • macOS: Covers both x86_64-apple-darwin and aarch64-apple-darwin.
    • Linux ARM: Added aarch64-unknown-linux-gnu compilation check.
  • Smart Execution:
    • Uses cargo build on all targets to verify compilation and linking (critical for C-bindings like tree-sitter).
    • Conditional cargo test execution: Tests run on native architectures and macOS (via Rosetta 2), but are skipped for Linux ARM on x86 runners to prevent execution errors.
  • Caching: Implemented Swatinem/rust-cache keyed by target architecture to optimize build times across the matrix.

Technical Notes

  • Toolchain: Uses dtolnay/rust-toolchain@stable. While the project has a rust-toolchain.toml, this action ensures the correct native targets are added for cross-compilation during the setup phase.
  • Binary Verification: Confirms that the Windows .exe and macOS binaries are properly generated, satisfying the requirement for build verification beyond just test harnesses.

@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch from cd39b5f to 09a5a05 Compare May 10, 2026 20:51
@AlexCannonball AlexCannonball marked this pull request as draft May 10, 2026 21:08
@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch 3 times, most recently from 911b4e8 to 0124fda Compare May 10, 2026 21:20
@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch from 0124fda to 1eb9710 Compare May 10, 2026 21:26
@AlexCannonball AlexCannonball marked this pull request as ready for review May 10, 2026 21:38
- Use `floor_char_boundary` in `offset_to_position` to safely handle offsets
  inside multi-byte UTF-8 sequences.
- Replace hardcoded byte offset with dynamic search in tests to account for
  potential line ending shifts.
- Add `.gitattributes` to enforce LF line endings across all platforms.
- Fixes CI panics on windows-latest runners.
@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch from c004f08 to 2ccafe8 Compare May 11, 2026 10:39
- Use `Url::from_file_path` and `Url::from_directory_path` to ensure
  consistent URI formatting (slashes and drive letters) on Windows.
- Replace manual path string concatenation with OS-native URI generation.
@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch from f9f5dc0 to 4233c94 Compare May 11, 2026 17:11
@AlexCannonball
Copy link
Copy Markdown
Contributor Author

Cross-Platform Fixes

The extended CI uncovered a Windows-specific panic and several test regressions:

  • Character Boundary Panic: Fixed a bug where clang-format offsets could land inside multi-byte UTF-8 sequences, causing a crash on Windows due to CRLF shifts. Resolved using floor_char_boundary.
  • Path & URI Normalization: Fixed tests that were failing on Windows due to drive letters (C:) and backslash/forward-slash mismatches in URIs.

@coder3101
Copy link
Copy Markdown
Owner

I’ll be taking a look at all these PRs over the weekend! Thanks for your contribution.

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.

ci: implement cross-platform testing for Windows and macOS

2 participants