Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
ci: build binaries for both AMD and ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Jun 4, 2024
1 parent 648337a commit a7386ae
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ jobs:

upload_macos_binaries:
needs: [upload_binaries]
runs-on: macos-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
suffix:
- arm64
include:
- os: macos-13
suffix: amd64
env:
GO111MODULE: on
CGO_ENABLED: "0"
Expand All @@ -78,6 +87,9 @@ jobs:
key: vendor-${{ hashFiles('**/go.sum') }}
restore-keys: |
vendor-
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- run: go mod vendor
- uses: ruby/setup-ruby@v1
with:
Expand All @@ -86,24 +98,20 @@ jobs:
bundler-cache: true
- name: Build mruby
run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Set VERSION (if any)
if: ${{ contains(github.ref, 'refs/tags/v') }}
id: version
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Build binaries for MacOS
run: |
env GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-darwin-amd64 cmd/anycable-go/main.go
env GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-darwin-arm64 cmd/anycable-go/main.go
env GOOS=darwin GOARCH=${{ matrix.suffix }} go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-darwin-${{ matrix.suffix }} cmd/anycable-go/main.go
- name: Build binaries with MRuby for MacOS
env:
CGO_ENABLED: "1"
run: |
env GOOS=darwin GOARCH=amd64 go build -tags mrb -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-mrb-darwin-amd64 cmd/anycable-go/main.go
dist/anycable-go-mrb-darwin-amd64 -v
env GOOS=darwin GOARCH=${{ matrix.suffix }} go build -tags mrb -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-mrb-darwin-${{ matrix.suffix }} cmd/anycable-go/main.go
dist/anycable-go-mrb-darwin-${{ matrix.suffix }} -v
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit a7386ae

Please sign in to comment.