Skip to content

Commit a415d91

Browse files
committed
ci: enable CGO and add Zig setup
- Remove CGO_ENABLED=0 and enable CGO_ENABLED=1 in .goreleaser.yml - Install Zig via setup-zig action in release workflow - Set CC=zig cc in CI env for cross-platform builds
1 parent 616eaee commit a415d91

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ permissions:
1010

1111
jobs:
1212
goreleaser:
13-
runs-on: ubuntu-latest
13+
runs-on: macos-latest
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

20+
- name: Set up Zig
21+
uses: goto-bus-stop/setup-zig@v2
22+
with:
23+
version: "0.13.0"
24+
2025
- name: Set up Go
2126
uses: actions/setup-go@v5
2227
with:
2328
go-version: "1.23.x"
29+
cache: true
2430

2531
- name: Run GoReleaser
2632
uses: goreleaser/goreleaser-action@v6

.goreleaser.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,44 @@ before:
33
hooks:
44
- go mod tidy
55
builds:
6-
- binary: grab
6+
- id: grab
7+
binary: grab
78
main: ./cmd/grab
8-
goos:
9-
- darwin
10-
- linux
11-
- windows
12-
goarch:
13-
- amd64
14-
- arm64
9+
goos: [darwin, linux, windows]
10+
goarch: [amd64, arm64]
1511
env:
16-
- CGO_ENABLED=0
12+
- CGO_ENABLED=1
13+
- CC=cc
14+
- CXX=c++
1715
ldflags:
1816
- -s -w
1917
- -X github.com/epilande/codegrab/internal/utils.Version={{.Version}}
2018
- -X github.com/epilande/codegrab/internal/utils.CommitSHA={{.ShortCommit}}
19+
overrides:
20+
- goos: linux
21+
goarch: amd64
22+
env:
23+
- CGO_ENABLED=1
24+
- CC=zig cc -target x86_64-linux-gnu
25+
- CXX=zig c++ -target x86_64-linux-gnu
26+
- goos: linux
27+
goarch: arm64
28+
env:
29+
- CGO_ENABLED=1
30+
- CC=zig cc -target aarch64-linux-gnu
31+
- CXX=zig c++ -target aarch64-linux-gnu
32+
- goos: windows
33+
goarch: amd64
34+
env:
35+
- CGO_ENABLED=1
36+
- CC=zig cc -target x86_64-windows-gnu
37+
- CXX=zig c++ -target x86_64-windows-gnu
38+
- goos: windows
39+
goarch: arm64
40+
env:
41+
- CGO_ENABLED=1
42+
- CC=zig cc -target aarch64-windows-gnu
43+
- CXX=zig c++ -target aarch64-windows-gnu
2144
archives:
2245
- formats: [tar.gz]
2346
name_template: >-

0 commit comments

Comments
 (0)