Skip to content

Commit a372452

Browse files
committed
build: enable cgo for darwin
1 parent c37338a commit a372452

File tree

3 files changed

+79
-20
lines changed

3 files changed

+79
-20
lines changed

.github/workflows/release.yml

+13-11
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Set up Go
18-
uses: actions/setup-go@v3
19-
with:
20-
go-version: 1.16
21-
2217
- name: Run GoReleaser
23-
uses: goreleaser/goreleaser-action@v2
24-
if: startsWith(github.ref, 'refs/tags/')
25-
with:
26-
distribution: goreleaser
27-
version: latest
28-
args: release --rm-dist
2918
env:
3019
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PACKAGE_NAME: github.com/cokemine/nodestatus-client-go
21+
run: |-
22+
docker run \
23+
--rm \
24+
--privileged \
25+
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
26+
-v /var/run/docker.sock:/var/run/docker.sock \
27+
-v $(pwd):/go/src/${PACKAGE_NAME} \
28+
-v $(pwd)/sysroot:/sysroot \
29+
-w /go/src/${PACKAGE_NAME} \
30+
goreleaser/goreleaser-cross \
31+
-f .goreleaser_action.yml \
32+
release --rm-dist

.goreleaser.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,23 @@ builds:
99
goos:
1010
- linux
1111
- windows
12-
- darwin
1312
goarch:
1413
- arm
1514
- arm64
16-
- 386
15+
- '386'
1716
- amd64
1817
- mips
1918
- mipsle
20-
ignore:
21-
- goos: windows
22-
goarch: arm
23-
- goos: windows
24-
goarch: arm64
19+
2520
archives:
26-
- name_template: "status-client_{{ .Os }}_{{ .Arch }}"
21+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
2722
format_overrides:
2823
- goos: windows
2924
format: zip
3025
checksum:
3126
name_template: 'checksums.txt'
3227
snapshot:
33-
name_template: "{{ .Tag }}-next"
28+
name_template: '{{ .Tag }}-next'
3429
changelog:
3530
sort: asc
3631
filters:

.goreleaser_action.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
project_name: status-client
2+
before:
3+
hooks:
4+
- go mod tidy
5+
builds:
6+
- id: default-build
7+
main: ./cmd/client
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
goarch:
14+
- arm
15+
- arm64
16+
- '386'
17+
- amd64
18+
- mips
19+
- mipsle
20+
21+
- id: darwin-amd64-build
22+
main: ./cmd/client
23+
env:
24+
- CGO_ENABLED=1
25+
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/amd64
26+
- PKG_CONFIG_PATH=/sysroot/macos/amd64/usr/local/lib/pkgconfig
27+
- CC=o64-clang
28+
- CXX=o64-clang++
29+
goos:
30+
- darwin
31+
goarch:
32+
- amd64
33+
34+
- id: darwin-arm64-build
35+
main: ./cmd/client
36+
env:
37+
- CGO_ENABLED=1
38+
- PKG_CONFIG_SYSROOT_DIR=/sysroot/macos/arm64
39+
- PKG_CONFIG_PATH=/sysroot/macos/arm64/usr/local/lib/pkgconfig
40+
- CC=o64-clang
41+
- CXX=o64-clang++
42+
goos:
43+
- darwin
44+
goarch:
45+
- arm64
46+
47+
archives:
48+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}'
49+
format_overrides:
50+
- goos: windows
51+
format: zip
52+
checksum:
53+
name_template: 'checksums.txt'
54+
snapshot:
55+
name_template: '{{ .Tag }}-next'
56+
changelog:
57+
sort: asc
58+
filters:
59+
exclude:
60+
- '^docs:'
61+
- '^test:'
62+
- '^ci:'

0 commit comments

Comments
 (0)