2
0
mirror of https://github.com/jmespath/jp synced 2025-08-22 01:27:28 +00:00

Add ARM64 builds for MacOS

Also updated the GitHub action to run the `build-all-platforms`
script as part of CI.
This commit is contained in:
James Saryerwinnie 2021-09-29 15:05:01 -04:00
parent c8e89d903b
commit 157841e914
2 changed files with 26 additions and 6 deletions

View File

@ -18,3 +18,18 @@ jobs:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Build and test - name: Build and test
run: make run: make
build-all-platforms:
name: Build all platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
go-version: [1.17]
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Build all supported platforms
run: JP_VERSION=100.100.100 ./scripts/build-all-platforms

View File

@ -6,6 +6,7 @@ then
fi fi
go get ./... go get ./...
rm -rf ./build/jp-* rm -rf ./build/jp-*
# All builds for 386/amd64.
for goos in darwin linux windows freebsd; do for goos in darwin linux windows freebsd; do
export GOOS="$goos" export GOOS="$goos"
for goarch in 386 amd64; do for goarch in 386 amd64; do
@ -14,18 +15,22 @@ for goos in darwin linux windows freebsd; do
go build -v -o build/jp-$GOOS-$GOARCH 2>/dev/null go build -v -o build/jp-$GOOS-$GOARCH 2>/dev/null
done done
done done
# Also build for ARM7/linux # Now handle ARM builds.
export GOOS=linux # First handle 32bit builds separately
export GOARCH=arm export GOARCH=arm
export GOARM=7 export GOARM=7
export GOOS=linux
echo "Building for $GOOS/$GOARCH/$GOARM" echo "Building for $GOOS/$GOARCH/$GOARM"
go build -v -o build/jp-$GOOS-$GOARCH-arm$GOARM 2> /dev/null go build -v -o build/jp-$GOOS-$GOARCH-arm$GOARM 2> /dev/null
# Also build for ARM64/linux # Now handled supported ARM64 builds.
export GOOS=linux
export GOARCH=arm64 export GOARCH=arm64
echo "Building for $GOOS/$GOARCH" for goos in linux darwin; do
go build -v -o build/jp-$GOOS-$GOARCH 2> /dev/null export GOOS="$goos"
echo "Building for $GOOS/$GOARCH"
go build -v -o build/jp-$GOOS-$GOARCH 2>/dev/null
done
# And finally we'll create a .tar.gz version for homebrew users. # And finally we'll create a .tar.gz version for homebrew users.
# We'll neend to figure out how to deal with M1 macbooks in the future.
cp build/jp-darwin-amd64 build/jp cp build/jp-darwin-amd64 build/jp
cd build cd build
tar cvfz jp-$JP_VERSION.tar.gz jp tar cvfz jp-$JP_VERSION.tar.gz jp