Skip to content

Commit

Permalink
Try creating a universal macOS binary
Browse files Browse the repository at this point in the history
  • Loading branch information
eed3si9n committed Nov 5, 2023
1 parent 992ada2 commit 6cf7a1c
Showing 1 changed file with 58 additions and 4 deletions.
62 changes: 58 additions & 4 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
fail-fast: false
matrix:
include:
- os: macOS-latest
uploaded_filename: sbtn-x86_64-apple-darwin
local_path: client/target/bin/sbtn
jobtype: 1
- os: ubuntu-20.04
uploaded_filename: sbtn-x86_64-pc-linux
local_path: client/target/bin/sbtn
Expand All @@ -36,6 +32,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: sbt/sbt
# Make sure the native-image-macos is also updated
ref: 1.9.x
- name: Setup JDK
uses: actions/setup-java@v3
Expand Down Expand Up @@ -92,3 +89,60 @@ jobs:
asset_path: ${{ matrix.local_path }}
asset_name: ${{ matrix.uploaded_filename }}
asset_content_type: application/zip

native-image-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macOS-latest
uploaded_filename: sbtn-x86_64-apple-darwin
local_path: target/bin/sbtn
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M
steps:
- name: Checkout sbt/sbt
uses: actions/checkout@v3
with:
repository: sbt/sbt
ref: 1.9.x
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
- run: git fetch --tags || true
- name: Build
if: github.event_name == 'release'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo $(pwd)
mkdir -p target/bin/
curl -L "https://github.com/sbt/sbtn-dist/releases/download/${{ github.event.release.tag_name }}/sbtn-aarch64-apple-darwin" \
--header "Authorization: token $GITHUB_TOKEN" \
--output target/bin/sbtn-aarch64-apple-darwin
sbt clean nativeImage
lipo -create -o target/bin/sbtn "client/target/bin/sbtn" "target/bin/sbtn-aarch64-apple-darwin"
- name: Build
if: github.event_name != 'release'
shell: bash
run: |
echo $(pwd)
sbt clean nativeImage
- uses: actions/upload-artifact@v3
with:
path: ${{ matrix.local_path }}
name: ${{ matrix.uploaded_filename }}
- name: Upload release
if: github.event_name == 'release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ matrix.local_path }}
asset_name: ${{ matrix.uploaded_filename }}
asset_content_type: application/zip

0 comments on commit 6cf7a1c

Please sign in to comment.