Skip to content

Commit d3272d1

Browse files
authored
build(release): build darwin with cgo on macOS so releases ship the tray (#95)
The release cross-compiled darwin with CGO_ENABLED=0, so the prebuilt (and Homebrew) binaries had the menu bar and the sqlite backend stubbed out — `tock tray` reported "needs a CGO-enabled build". Run goreleaser on a macOS runner and override the darwin targets to CGO_ENABLED=1 so fyne.io/systray (Objective-C) and go-sqlite3 are compiled in. Linux stays CGO-free (pure-Go cross-build from the same runner). Verified locally: goreleaser builds darwin/arm64 and darwin/amd64 with cgo (cross-arch amd64 links fine from an arm64 host), and the resulting binary carries the systray symbols instead of the no-cgo stub.
1 parent 150f2f2 commit d3272d1

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ jobs:
3535

3636
release:
3737
name: Release
38-
runs-on: ubuntu-latest
38+
# macOS runner so goreleaser can build the darwin binaries with cgo (the
39+
# menu bar needs the Objective-C systray backend; sqlite needs go-sqlite3).
40+
runs-on: macos-latest
3941
permissions:
4042
contents: write
4143
steps:

.goreleaser.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ builds:
2020
- -X github.com/kriuchkov/tock/internal/app/commands.version={{.Version}}
2121
- -X github.com/kriuchkov/tock/internal/app/commands.commit={{.Commit}}
2222
- -X github.com/kriuchkov/tock/internal/app/commands.date={{.Date}}
23+
# Build darwin natively with cgo so the menu bar (fyne.io/systray is
24+
# Objective-C) and the sqlite backend (go-sqlite3) are compiled in.
25+
# Requires a macOS runner. Linux stays CGO-free (pure-Go cross-build).
26+
overrides:
27+
- goos: darwin
28+
goarch: amd64
29+
env:
30+
- CGO_ENABLED=1
31+
- goos: darwin
32+
goarch: arm64
33+
env:
34+
- CGO_ENABLED=1
2335

2436
archives:
2537
- format: tar.gz

0 commit comments

Comments
 (0)