Skip to content

Commit

Permalink
Close #214 - Build with GraalVM - GitHub Actions to generate binary f…
Browse files Browse the repository at this point in the history
…or macOS, Linux and Windows
  • Loading branch information
kevin-lee committed Mar 18, 2021
1 parent c8d21d9 commit ec263ea
Show file tree
Hide file tree
Showing 2 changed files with 783 additions and 0 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches:
- main

env:
CLI_SCALA_VERSION: "2.13.5"
CLI_SCALA_BINARY_VERSION: "2.13"

jobs:

build:
Expand Down Expand Up @@ -70,3 +74,121 @@ jobs:
echo "PR #${PR_NUMBER}"
java -version
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }} ${{ matrix.scala.report }}
graalvm_build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
gu-binary: [gu]
run-binary: [maven2sbt-cli]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: ubuntu-latest
run-binary: maven2sbt-cli.cmd
- os: macos-latest
gu-binary: gu.cmd
- os: macos-latest
run-binary: maven2sbt-cli.cmd
- os: windows-latest
gu-binary: gu
- os: windows-latest
run-binary: maven2sbt-cli
steps:
- name: Setup Graalvm
id: setup-graalvm
uses: DeLaGuardo/setup-graalvm@master
with:
# GraalVM version, no pattern syntax available atm
graalvm: '21.0.0.2'
# Java version, optional, defaults to 'java8'. Available options are 'java8' and 'java11'.
java: 'java11'
# Architecture flag, optional, defaults to 'amd64'. Available options are 'amd64' and 'aarch64'. Later is available only for linux runners.
arch: 'amd64'

- name: Install native-image component
run: |
${{ matrix.gu-binary }} install native-image
- uses: actions/checkout@v2
- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-
- name: "GraalVM Build for Scala ${{ env.CLI_SCALA_VERSION }} - ${{ github.run_number }}"
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
run: |
./sbt -J-Xmx2048m "; ++${{ env.CLI_SCALA_VERSION }}! ; project cli; graalvm-native-image:packageBin"
ls -lGh cli/target/graalvm-native-image/
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} --version"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} --help"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} print --help"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} file --help"
graalvm_build_windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
gu-binary: [gu.cmd]
run-binary: [maven2sbt-cli.cmd]
steps:
- name: Setup Graalvm
id: setup-graalvm
uses: DeLaGuardo/setup-graalvm@master
with:
# GraalVM version, no pattern syntax available atm
graalvm: '21.0.0.2'
# Java version, optional, defaults to 'java8'. Available options are 'java8' and 'java11'.
java: 'java11'
# Architecture flag, optional, defaults to 'amd64'. Available options are 'amd64' and 'aarch64'. Later is available only for linux runners.
arch: 'amd64'

- name: Install native-image component
run: |
${{ matrix.gu-binary }} install native-image
- uses: actions/checkout@v2
- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-
- name: "GraalVM Build for Scala ${{ env.CLI_SCALA_VERSION }} - ${{ github.run_number }}"
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
run: |
echo $PATH
echo $JAVA_HOME
ls -l $JAVA_HOME
ls -l $GRAALVM_HOME/bin
sbt -v "; project cli; graalvm-native-image:packageBin"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} --version"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} --help"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} print --help"
sh -c "cli/target/graalvm-native-image/${{ matrix.run-binary }} file --help"
Loading

0 comments on commit ec263ea

Please sign in to comment.