feat: add Windows build support#215
Conversation
- Make signal handling Windows-safe in cmd/server.go (SIGTERM only on Unix) - Add windows-build and windows-archives to .goreleaser.yaml (amd64, arm64) - Add build.windows Makefile target and detect Windows/MINGW in build Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Adds Windows as a supported platform for the Mass CLI by adjusting runtime signal handling, local build tooling, and release packaging so Windows binaries can be built and shipped alongside existing Linux/macOS artifacts.
Changes:
- Update server signal registration to avoid
SIGTERMhandling on Windows while keeping Ctrl+C graceful shutdown behavior. - Extend
make buildto detect Windows-like shells (MINGW/MSYS) and add abuild.windowstarget. - Add Windows
amd64/arm64builds and archives to GoReleaser.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cmd/server.go |
Adjust signal handling to be Windows-compatible by only subscribing to SIGTERM on non-Windows. |
Makefile |
Add Windows OS detection for the default build and a build.windows target. |
.goreleaser.yaml |
Add Windows build + archive definitions for release artifacts (amd64/arm64). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .PHONY: build.windows | ||
| build.windows: bin | ||
| GOOS=windows GOARCH=amd64 go build -o bin/mass-windows-amd64.exe -ldflags=${LD_FLAGS} | ||
|
|
There was a problem hiding this comment.
build.windows only builds GOARCH=amd64, but release artifacts are configured to build Windows for both amd64 and arm64 in .goreleaser.yaml. Consider either adding a build.windows.arm64 target (or making GOARCH configurable) so local builds match the supported/released architectures.
| .PHONY: build.windows | |
| build.windows: bin | |
| GOOS=windows GOARCH=amd64 go build -o bin/mass-windows-amd64.exe -ldflags=${LD_FLAGS} | |
| .PHONY: build.windows build.windows.amd64 build.windows.arm64 | |
| build.windows: build.windows.amd64 build.windows.arm64 | |
| build.windows.amd64: bin | |
| GOOS=windows GOARCH=amd64 go build -o bin/mass-windows-amd64.exe -ldflags=${LD_FLAGS} | |
| build.windows.arm64: bin | |
| GOOS=windows GOARCH=arm64 go build -o bin/mass-windows-arm64.exe -ldflags=${LD_FLAGS} |
| - id: windows-build | ||
| binary: mass | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - windows | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| ldflags: *build-ldflags |
There was a problem hiding this comment.
Windows artifacts are now part of the release configuration, but the CI workflows only build/test on ubuntu-latest. To avoid shipping broken Windows binaries, add a CI check that at least compiles (and ideally tests) with GOOS=windows / a Windows runner as part of PR validation.
|
@dnpbfs Thank you for submitting this. We want to do some testing on it before we merge - we've had issues reported with Windows builds in the past. I was hoping to get to it this week, but next week is looking more likely. |
Use filepath.ToSlash so OCI layer paths use / on all platforms. Fixes deployment error 'cd: bundle/src: No such file or directory' when bundles are published from Windows and extracted on Linux. Made-with: Cursor
|
No problem, I'm testing with it as well. Just pushed a change for how Windows pathing is handled, that seems to be only major issue I've encountered. |
Summary
Adds Windows as a supported platform for the Mass CLI with full feature parity.
Changes
cmd/server.go): RegisterSIGTERMonly on non-Windows so the server runs correctly on Windows (Ctrl+C still triggers graceful shutdown)..goreleaser.yaml): Addwindows-buildandwindows-archivesfor Windows amd64 and arm64 binaries in releases.build.windowstarget and detect Windows/MINGW in the defaultbuildtarget somake buildworks in Git Bash and similar environments.Testing
mass.exe --helpsuccessfully on Windows.filepathand jsonschema loader already handle Windows.