Skip to content

feat: cross-platform support (Linux, macOS, Windows)#29

Merged
priyanshujain merged 23 commits intomasterfrom
cross-platform-support
Mar 8, 2026
Merged

feat: cross-platform support (Linux, macOS, Windows)#29
priyanshujain merged 23 commits intomasterfrom
cross-platform-support

Conversation

@priyanshujain
Copy link
Copy Markdown
Collaborator

@priyanshujain priyanshujain commented Mar 8, 2026

Summary

  • Drop CGO: Switch from mattn/go-sqlite3 (CGO) to modernc.org/sqlite (pure Go), fixing the broken Docker build and enabling cross-compilation. Net -1 dependency.
  • Cross-platform signals: Build-tagged internal/platform package replaces direct syscall.SIGTERM usage (unavailable on Windows).
  • Cross-platform file locking: Split daemon/lock.go into Unix (syscall.Flock) and Windows (kernel32.dll LockFileEx) implementations. Stores the Windows file handle once to avoid os.File.Fd() duplication.
  • Windows service manager stub: Returns Task Scheduler instructions for install/uninstall; obk service run works in foreground.
  • Cross-platform credentials: macOS keeps Keychain; Linux/Windows use file-based ~/.obk/secrets/ with 0600 permissions.
  • Docker multi-arch: Added TARGETOS/TARGETARCH build args, updated CMD to service run.
  • CI/CD: GitHub Actions workflow (test on 3 OSes + cross-compile 7 targets), GoReleaser config for automated releases.
  • Test fixes: Close WhatsApp clients in tests to release SQLite handles on Windows, check for gcloud accounts before running live tests, handle context cancellation in daemon shutdown test, use USERPROFILE on Windows for home dir in tests.

Verification

All 7 GOOS/GOARCH targets cross-compile:

linux/amd64, linux/arm64, linux/riscv64
darwin/amd64, darwin/arm64
windows/amd64, windows/arm64

CI passes on all 3 OSes (ubuntu, macos, windows). go vet passes on all platforms.

Test plan

  • CI passes on ubuntu, macos, windows runners
  • Cross-compile job builds all 7 platform targets
  • go test ./... passes on all 3 OSes
  • Docker build works: docker buildx build --platform linux/amd64,linux/arm64 -t openbotkit:test infrastructure/docker/
  • Tag a v* release to verify GoReleaser produces binaries

@priyanshujain priyanshujain merged commit 7c32762 into master Mar 8, 2026
10 checks passed
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