Skip to content

Commit 1c25839

Browse files
committed
ci: simplify config
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
1 parent d59b44b commit 1c25839

File tree

1 file changed

+23
-48
lines changed

1 file changed

+23
-48
lines changed

.goreleaser.yaml

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,75 +7,50 @@ before:
77
# You may remove this if you don't use go modules.
88
- go mod tidy
99
builds:
10-
- id: goreleaser-zig-cross-compilation-linux-macos
11-
goos:
10+
- goos:
1211
- darwin
12+
- linux
13+
- windows
1314
goarch:
1415
- amd64
1516
- arm64
1617
ldflags:
1718
- -s -w
1819
flags:
1920
- -trimpath
21+
- >-
22+
{{- if eq .Os "linux" }}-buildmode=pie{{- end }}
2023
env:
2124
- CGO_ENABLED=1
22-
- SDKROOT={{ .Env.SDK_PATH }}
23-
- MACOSX_DEPLOYMENT_TARGET=11.0
24-
- CGO_CFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0
25-
- CGO_CXXFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0
26-
- CGO_LDFLAGS=-isysroot {{ .Env.SDK_PATH }}
25+
- >-
26+
{{- if eq .Os "darwin" }}SDKROOT={{ .Env.SDK_PATH }}{{- end }}
27+
- >-
28+
{{- if eq .Os "darwin" }}MACOSX_DEPLOYMENT_TARGET=11.0{{- end }}
29+
- >-
30+
{{- if eq .Os "darwin" }}CGO_CFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0{{- end }}
31+
- >-
32+
{{- if eq .Os "darwin" }}CGO_CXXFLAGS=-isysroot {{ .Env.SDK_PATH }} -mmacosx-version-min=11.0{{- end }}
33+
- >-
34+
{{- if eq .Os "darwin" }}CGO_LDFLAGS=-isysroot {{ .Env.SDK_PATH }}{{- end }}
2735
- >-
2836
{{- if eq .Os "darwin" }}
2937
{{- if eq .Arch "amd64"}}CC=clang -arch x86_64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
3038
{{- if eq .Arch "arm64"}}CC=clang -arch arm64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
39+
{{- else if eq .Os "linux" }}
40+
{{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-linux-musl -lc{{- end }}
41+
{{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-linux-musl -lc{{- end }}
42+
{{- else if eq .Os "windows" }}
43+
{{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-windows-gnu -lc{{- end }}
44+
{{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-windows-gnu -lc{{- end }}
3145
{{- end }}
3246
- >-
3347
{{- if eq .Os "darwin" }}
3448
{{- if eq .Arch "amd64"}}CXX=clang++ -arch x86_64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
3549
{{- if eq .Arch "arm64"}}CXX=clang++ -arch arm64 -isysroot {{ .Env.SDK_PATH }}{{- end }}
36-
{{- end }}
37-
- id: goreleaser-zig-cross-compilation-linux
38-
goos:
39-
- linux
40-
goarch:
41-
- amd64
42-
- arm64
43-
ldflags:
44-
- -s -w
45-
flags:
46-
- -trimpath
47-
- -buildmode=pie
48-
env:
49-
- CGO_ENABLED=1
50-
- >-
51-
{{- if eq .Os "linux" }}
52-
{{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-linux-musl -lc{{- end }}
53-
{{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-linux-musl -lc{{- end }}
54-
{{- end }}
55-
- >-
56-
{{- if eq .Os "linux" }}
50+
{{- else if eq .Os "linux" }}
5751
{{- if eq .Arch "amd64" }}CXX=zig c++ -target x86_64-linux-musl -lc{{- end }}
5852
{{- if eq .Arch "arm64"}}CXX=zig c++ -target aarch64-linux-musl -lc{{- end }}
59-
{{- end }}
60-
- id: goreleaser-zig-cross-compilation-windows
61-
goos:
62-
- windows
63-
goarch:
64-
- amd64
65-
- arm64
66-
ldflags:
67-
- -s -w
68-
flags:
69-
- -trimpath
70-
env:
71-
- CGO_ENABLED=1
72-
- >-
73-
{{- if eq .Os "windows" }}
74-
{{- if eq .Arch "amd64" }}CC=zig cc -target x86_64-windows-gnu -lc{{- end }}
75-
{{- if eq .Arch "arm64"}}CC=zig cc -target aarch64-windows-gnu -lc{{- end }}
76-
{{- end }}
77-
- >-
78-
{{- if eq .Os "windows" }}
53+
{{- else if eq .Os "windows" }}
7954
{{- if eq .Arch "amd64" }}CXX=zig c++ -target x86_64-windows-gnu -lc{{- end }}
8055
{{- if eq .Arch "arm64"}}CXX=zig c++ -target aarch64-windows-gnu -lc{{- end }}
8156
{{- end }}

0 commit comments

Comments
 (0)