Building on Linux arm64 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.** | |
paths-ignore: | |
- "docs/**" | |
merge_group: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths-ignore: | |
- "docs/**" | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Build | |
run: | | |
./build.sh | |
- name: Archive libgoast library (amd64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libgoast-amd64.dylib | |
path: libgoast-amd64.dylib | |
- name: Archive libgoast library (arm64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libgoast-arm64.dylib | |
path: libgoast-arm64.dylib | |
build-linux-amd64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Build | |
run: | | |
./build.sh | |
- name: Archive libgoast library (amd64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libgoast-amd64.so | |
path: libgoast-amd64.so | |
build-linux-arm64: | |
runs-on: [self-hosted, linux, ARM64] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
- name: Build | |
run: | | |
./build.sh | |
- name: Archive libgoast library (amd64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libgoast-arm64.so | |
path: libgoast-arm64.so | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- build-macos | |
- build-linux-amd64 | |
- build-linux-arm64 | |
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha') | |
steps: | |
- name: Determine Version | |
run: | | |
# determine version from tag | |
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3) | |
if [[ $VERSION != v* ]] | |
then | |
export VERSION="" | |
echo "Building version-less (main or feature branch)" | |
else | |
# make version more Java-friendly by dropping the 'v' | |
export VERSION=${VERSION:1:${#VERSION}} | |
echo "Building as ${VERSION}" | |
fi | |
# store version in GitHub environment file | |
echo "version=$VERSION" >> $GITHUB_ENV | |
- uses: actions/download-artifact@v4 | |
with: | |
name: libgoast-arm64.dylib | |
path: . | |
- uses: actions/download-artifact@v4 | |
with: | |
name: libgoast-amd64.dylib | |
path: . | |
- uses: actions/download-artifact@v4 | |
with: | |
name: libgoast-amd64.so | |
path: . | |
- uses: actions/download-artifact@v4 | |
with: | |
name: libgoast-arm64.so | |
path: . | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: ${{ env.version }} | |
draft: false | |
prerelease: false | |
files: | | |
libgoast-arm64.dylib | |
libgoast-amd64.dylib | |
libgoast-amd64.so |