Skip to content

Commit

Permalink
CI build for darwin/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
dh1tw committed Apr 18, 2021
1 parent 2920cf8 commit 00fe466
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:

build_macos:
runs-on: macos-latest
# runs-on: macos-11.0
strategy:
matrix:
version: ['macos-amd64', 'macos-arm64']
Expand Down Expand Up @@ -113,7 +114,10 @@ jobs:
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
run: make dist
CGO_ENABLED: 1
run: |
SDKROOT=$(xcrun --sdk macosx --show-sdk-path) \
make dist
-
name: Prepare build artifact for stashing
run: |
Expand Down Expand Up @@ -163,6 +167,7 @@ jobs:
test_macos:
runs-on: macos-latest
# runs-on: macos-11.0
steps:
-
name: Set up Go 1.16
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ dist:
go build -v -ldflags="-w -s -X github.com/dh1tw/remoteRotator/cmd.commitHash=${COMMIT} \
-X github.com/dh1tw/remoteRotator/cmd.version=${VERSION}"
# compress binary
if [ "${GOOS}" == "windows" ]; then upx remoteRotator.exe; else upx remoteRotator; fi
# there is a know issue that upx currently doesn't work with darwin/arm64.
# See https://github.com/upx/upx/issues/424
# until it's resolved, we ship darwin/arm64 uncompressed.
if [ "${GOOS}" == "windows" ]; \
then upx remoteRotator.exe; \
else \
if [ "${GOOS}" == "darwin" ] && [ "${GOARCH}" == "arm64" ]; \
then true; \
else upx remoteRotator; \
fi \
fi

# test:
# @go test -short ${PKG_LIST}
Expand Down

0 comments on commit 00fe466

Please sign in to comment.