Merge pull request #10 from sbt/wip/universal #55
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: Native Image | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
native-image: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
uploaded_filename: sbtn-x86_64-pc-linux | |
local_path: client/target/bin/sbtn | |
- os: windows-2019 | |
uploaded_filename: sbtn-x86_64-pc-win32.exe | |
local_path: client\target\bin\sbtn.exe | |
env: | |
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M | |
steps: | |
- name: Checkout sbt/sbt | |
uses: actions/checkout@v3 | |
with: | |
repository: sbt/sbt | |
# Make sure the native-image-macos and native-image-aarch64-pc-linux-linux also updated | |
ref: 1.9.x | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 8 | |
- run: git fetch --tags || true | |
- name: Setup Windows C++ toolchain | |
uses: ilammy/msvc-dev-cmd@v1 | |
if: ${{ matrix.os == 'windows-2019' }} | |
- name: Build | |
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 | |
native-image-macos: | |
needs: native-image | |
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 | |
native-image-aarch64-pc-linux-linux: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
uploaded_filename: sbtn-aarch64-pc-linux | |
local_path: client/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 | |
- name: Build Linux aarch64 | |
uses: uraimo/[email protected] | |
with: | |
arch: aarch64 | |
distro: ubuntu20.04 | |
# Speeds up builds per the run-on-arch-action README | |
githubToken: ${{ github.token }} | |
# The shell to run commands with in the container | |
shell: /bin/bash | |
# build-essential and libz-dev are required to build native images. | |
install: | | |
apt-get update -q -y | |
apt-get install -q -y curl openjdk-8-jdk build-essential libz-dev | |
# Does not work, see https://github.com/sbt/sbt/issues/6614 | |
#echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list | |
#curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add | |
#apt-get update -q && apt-get install -q -y sbt | |
# Workaround: | |
curl -Ls https://scala.jfrog.io/artifactory/debian/sbt-1.8.0.deb -o sbt-1.8.0.deb | |
apt install -y ./sbt-1.8.0.deb | |
run: | | |
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 |