Skip to content

Commit 7cce58e

Browse files
Copilotyxxhero
andauthored
Add multi-architecture support for Linux platforms and FreeBSD/Windows ARM64 (#836)
* Initial plan * Add multi-arch support for Linux architectures in GoReleaser and install script Co-authored-by: yxxhero <[email protected]> * Clean up gitignore to exclude dist directory and finalize multi-arch support Co-authored-by: yxxhero <[email protected]> * Remove ignore section from GoReleaser and add freebsd-arm64/windows-arm64 support Co-authored-by: yxxhero <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: yxxhero <[email protected]>
1 parent 1a3c163 commit 7cce58e

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ vendor/
22
bin/
33
build/
44
release/
5+
dist/
56
.envrc
67
.idea
78
docker-run-release-cache/

.goreleaser.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,32 @@ builds:
2121
goarch:
2222
- amd64
2323
- arm64
24+
- id: linux-additional
25+
main: .
26+
binary: bin/diff
27+
env:
28+
- CGO_ENABLED=0
29+
flags:
30+
- -trimpath
31+
ldflags:
32+
- -X github.com/databus23/helm-diff/v3/cmd.Version={{ .Version }}
33+
goos:
34+
- linux
35+
goarch:
36+
- arm
37+
- ppc64le
38+
- s390x
39+
goarm:
40+
- "6"
41+
- "7"
2442

2543
archives:
2644
- id: default
2745
builds:
2846
- default
47+
- linux-additional
2948
format: tgz
30-
name_template: '{{ .ProjectName }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}'
49+
name_template: '{{ .ProjectName }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
3150
wrap_in_directory: diff
3251
files:
3352
- README.md

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ dist:
7676
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-amd64.tgz diff/
7777
GOOS=linux GOARCH=arm64 $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
7878
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-arm64.tgz diff/
79+
GOOS=linux GOARCH=arm GOARM=6 $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
80+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-armv6.tgz diff/
81+
GOOS=linux GOARCH=arm GOARM=7 $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
82+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-armv7.tgz diff/
83+
GOOS=linux GOARCH=ppc64le $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
84+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-ppc64le.tgz diff/
85+
GOOS=linux GOARCH=s390x $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
86+
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-linux-s390x.tgz diff/
7987
GOOS=freebsd GOARCH=amd64 $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"
8088
tar -C build/ -zcvf $(CURDIR)/release/helm-diff-freebsd-amd64.tgz diff/
8189
GOOS=darwin GOARCH=amd64 $(GO) build -o build/diff/bin/diff -trimpath -ldflags="$(LDFLAGS)"

install-binary.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ initArch() {
4747
x86_64) ARCH="amd64" ;;
4848
i686) ARCH="386" ;;
4949
i386) ARCH="386" ;;
50+
ppc64le) ARCH="ppc64le" ;;
51+
s390x) ARCH="s390x" ;;
5052
esac
5153
}
5254

@@ -69,7 +71,7 @@ initOS() {
6971
# verifySupported checks that the os/arch combination is supported for
7072
# binary builds.
7173
verifySupported() {
72-
supported="linux-amd64\nlinux-arm64\nfreebsd-amd64\nmacos-amd64\nmacos-arm64\nwindows-amd64"
74+
supported="linux-amd64\nlinux-arm64\nlinux-armv6\nlinux-armv7\nlinux-ppc64le\nlinux-s390x\nfreebsd-amd64\nfreebsd-arm64\nmacos-amd64\nmacos-arm64\nwindows-amd64\nwindows-arm64"
7375
if ! echo "${supported}" | grep -q "${OS}-${ARCH}"; then
7476
echo "No prebuild binary for ${OS}-${ARCH}."
7577
exit 1

0 commit comments

Comments
 (0)