Skip to content

Commit

Permalink
handle ARM64 for linux and darwin builds and releases
Browse files Browse the repository at this point in the history
  • Loading branch information
francoismichel committed Dec 12, 2023
1 parent 2237ed1 commit bc552b3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ jobs:
uses: actions/setup-go@v4
with:
go-version: '1.21.x'
-
name: Install toolchain for compiling ARM
run: sudo apt-get -y install gcc-aarch64-linux-gnu
-
name: Install lcrypt for arm64
run: sudo dpkg --add-architecture arm64 && sudo apt update && sudo apt-get -y install libcrypt-dev:arm64
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,33 @@ jobs:
matrix:
go-version: [ '1.20.x', '1.21.x' ]
goos: [linux]
goarch: [amd64]
archparams: [{goarch: amd64, cc: gcc},{goarch: arm64, cc: aarch64-linux-gnu-gcc}]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install toolchain for compiling ARM
run: sudo apt-get -y install gcc-aarch64-linux-gnu
- name: Install lcrypt for arm64
run: sudo dpkg --add-architecture arm64 && sudo apt update && sudo apt-get -y install libcrypt-dev:arm64
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '${{matrix.go-version}}'
- name: Install dependencies
- name: Install Go dependencies
run: go get ./...
- name: Build Client
run: env CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go build -v client/main.go
run: env CC=${{matrix.archparams.cc}} CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.archparams.goarch}} go build -v client/main.go
- name: Build Server
run: env CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go build -v server/main.go
run: env CC=${{matrix.archparams.cc}} CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.archparams.goarch}} go build -v server/main.go
- name: Test with the Go CLI
run: env CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} go run github.com/onsi/ginkgo/v2/ginkgo -r
run: env CC=${{matrix.archparams.cc}} CGO_ENABLED=1 GOOS=${{matrix.goos}} GOARCH=${{matrix.archparams.goarch}} go run github.com/onsi/ginkgo/v2/ginkgo -r
build-macos:
strategy:
matrix:
go-version: [ '1.20.x', '1.21.x' ]
goos: [darwin]
goarch: [amd64]
goarch: [amd64,arm64]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 13 additions & 1 deletion .goreleaser-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ builds:
- linux
goarch:
- amd64
- arm64
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc
-
id: "ssh3-server"
main: ./server/main.go
Expand All @@ -36,7 +42,13 @@ builds:
- linux
goarch:
- amd64

- arm64
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
Expand Down

0 comments on commit bc552b3

Please sign in to comment.