Skip to content

ci: add windows and macos test matrix#128

Merged
coder3101 merged 4 commits into
coder3101:mainfrom
AlexCannonball:ci/cross-platform-build-test
May 16, 2026
Merged

ci: add windows and macos test matrix#128
coder3101 merged 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 4 times, most recently 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
@AlexCannonball AlexCannonball force-pushed the ci/cross-platform-build-test branch 2 times, most recently 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.

- 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.
- 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 4233c94 to 880f300 Compare May 16, 2026 09:27
@coder3101 coder3101 merged commit d167f72 into coder3101:main May 16, 2026
6 checks passed
coder3101 added a commit that referenced this pull request May 16, 2026
closes #126 

### Summary
This PR implements a flexible transport layer for `protols`,
significantly improving debugging capabilities and performance.

### Key Changes
- **Multi-transport Support**: Fully implemented TCP (port/socket) and
Pipe (Unix Domain Sockets / Named Pipes) transports in accordance with
the [LSP
specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#implementationConsiderations).
- **CLI Refactoring**: moved from `main.rs` to a separate file.
- **Improved Performance**: Native async I/O support for socket/pipe
transports.
- Safety check for Unix sockets to prevent accidental overwriting of
regular files.
- **Debugging & DX**: 
    - Added a dedicated TCP mode for easier debugging in Dev Containers.
- Included VS Code `launch.json` and task configurations for a seamless
debug workflow.
    - Added a `docs/debugging.md` guide.
- **Testing**: Added unit tests for CLI parsing and cross-platform path
normalization.
- **Project Metadata**: Updated `Cargo.toml` description for better
clarity. As i see from <https://github.com/coder3101/tree-sitter-proto>,
the LSP supports `proto2`, `proto3`, and `editions`, rather than just
`proto3`.

The updated CLI `--help` output:

<img width="1441" height="329" alt="image"
src="https://github.com/user-attachments/assets/2dfe0a94-3d0f-48d0-8d71-00e21b41a658"
/>

### Notes

⚠️ I was unable to check the build on Windows. I'd suggest merging it
after #128 to be confident about Windows-specific code.

Support for
[`--clientProcessId`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#implementationConsiderations)
is intentionally omitted from this PR:

> To support the case that the editor starting a server crashes an
editor should also pass its process id to the server. This allows the
server to monitor the editor process and to shutdown itself if the
editor process dies. The process id passed on the command line should be
the same as the one passed in the initialize parameters. The command
line argument to use is `--clientProcessId`.

I'd proposed making it in a separate follow-up to keep the focus on the
transport layer infrastructure.

---------

Signed-off-by: Ashar <ashar786khan@gmail.com>
Co-authored-by: Ashar <coder3101@users.noreply.github.com>
Co-authored-by: Ashar <ashar786khan@gmail.com>
@AlexCannonball AlexCannonball deleted the ci/cross-platform-build-test branch May 16, 2026 17:14
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