Skip to content

Commit

Permalink
Merge pull request #223 from yuancjun/patch-1
Browse files Browse the repository at this point in the history
Add linux-arm64 support
  • Loading branch information
riobard authored Dec 19, 2021
2 parents acdbac0 + c545cac commit 71a35d3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ GOBUILD=CGO_ENABLED=0 go build -ldflags '-w -s -buildid='
# The -w and -s flags reduce binary sizes by excluding unnecessary symbols and debug info
# The -buildid= flag makes builds reproducible

all: linux macos-amd64 macos-arm64 win64 win32
all: linux-amd64 linux-arm64 macos-amd64 macos-arm64 win64 win32

linux:
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@

linux-arm64:
GOARCH=arm64 GOOS=linux $(GOBUILD) -o $(BINDIR)/$(NAME)-$@

macos-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD) -o $(BINDIR)/$(NAME)-$@

Expand All @@ -22,11 +25,14 @@ win32:
GOARCH=386 GOOS=windows $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.exe


test: test-linux test-macos-amd64 test-macos-arm64 test-win64 test-win32
test: test-linux-amd64 test-linux-arm64 test-macos-amd64 test-macos-arm64 test-win64 test-win32

test-linux:
test-linux-amd64:
GOARCH=amd64 GOOS=linux go test

test-linux-arm64:
GOARCH=arm64 GOOS=linux go test

test-macos-amd64:
GOARCH=amd64 GOOS=darwin go test

Expand All @@ -39,10 +45,12 @@ test-win64:
test-win32:
GOARCH=386 GOOS=windows go test

releases: linux macos-amd64 macos-arm64 win64 win32
releases: linux-amd64 linux-arm64 macos-amd64 macos-arm64 win64 win32
chmod +x $(BINDIR)/$(NAME)-*
tar czf $(BINDIR)/$(NAME)-linux.tgz -C $(BINDIR) $(NAME)-linux
gzip $(BINDIR)/$(NAME)-linux
tar czf $(BINDIR)/$(NAME)-linux-amd64.tgz -C $(BINDIR) $(NAME)-linux-amd64
tar czf $(BINDIR)/$(NAME)-linux-arm64.tgz -C $(BINDIR) $(NAME)-linux-arm64
gzip $(BINDIR)/$(NAME)-linux-amd64
gzip $(BINDIR)/$(NAME)-linux-arm64
gzip $(BINDIR)/$(NAME)-macos-amd64
gzip $(BINDIR)/$(NAME)-macos-arm64
zip -m -j $(BINDIR)/$(NAME)-win32.zip $(BINDIR)/$(NAME)-win32.exe
Expand All @@ -55,8 +63,10 @@ clean:
GITHUB_UPLOAD_URL=$(shell echo $${GITHUB_RELEASE_UPLOAD_URL%\{*})

upload: releases
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux.tgz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux.tgz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux.gz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux.gz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux-amd64.tgz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux-amd64.tgz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux-arm64.tgz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux-arm64.tgz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux-amd64.gz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux-amd64.gz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-linux-arm64.gz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-linux-arm64.gz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-macos-amd64.gz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-macos-amd64.gz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/gzip" --data-binary @$(BINDIR)/$(NAME)-macos-arm64.gz "$(GITHUB_UPLOAD_URL)?name=$(NAME)-macos-arm64.gz"
curl -H "Authorization: token $(GITHUB_TOKEN)" -H "Content-Type: application/zip" --data-binary @$(BINDIR)/$(NAME)-win64.zip "$(GITHUB_UPLOAD_URL)?name=$(NAME)-win64.zip"
Expand Down

0 comments on commit 71a35d3

Please sign in to comment.