From ddb9554eeccdce49b81d469a42d575e004bb0564 Mon Sep 17 00:00:00 2001 From: Dirkjan Bussink Date: Fri, 17 Dec 2021 16:41:38 +0100 Subject: [PATCH] server/etcdmain: add build support for Apple M1 This has been additionally verified by running the tests locally as a basic smoke test. GitHub Actions doesn't provide MacOS M1 (arm64) yet, so there's no good way to automate testing. Ran `TMPDIR=/tmp make test` locally. The `TMPDIR` bit is needed so there's no really long path used that breaks Unix socket setup in one of the tests. --- .github/workflows/build.yaml | 4 ++++ scripts/build-binary | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dd12ca5e7..3098ef2f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,6 +10,7 @@ jobs: - linux-amd64 - linux-386 - darwin-amd64 + - darwin-arm64 - windows-amd64 - linux-arm - linux-arm64 @@ -34,6 +35,9 @@ jobs: darwin-amd64) ARCH=amd64 GOOS=darwin GO_BUILD_FLAGS='-v -mod=readonly' ./build.sh ;; + darwin-arm64) + ARCH=arm64 GOOS=darwin GO_BUILD_FLAGS='-v -mod=readonly' ./build.sh + ;; windows-amd64) ARCH=amd64 GOOS=windows GO_BUILD_FLAGS='-v -mod=readonly' ./build.sh ;; diff --git a/scripts/build-binary b/scripts/build-binary index 6186424aa..b819a3e57 100755 --- a/scripts/build-binary +++ b/scripts/build-binary @@ -79,6 +79,10 @@ function main { TARGET_ARCHS+=("s390x") fi + if [ ${GOOS} == "darwin" ]; then + TARGET_ARCHS+=("arm64") + fi + for TARGET_ARCH in "${TARGET_ARCHS[@]}"; do export GOARCH=${TARGET_ARCH}