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 17, 2021
1 parent c8d21d9 commit 84d0f57
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 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.4"
CLI_SCALA_BINARY_VERSION: "2.13"

jobs:

build:
Expand Down Expand Up @@ -70,3 +74,66 @@ 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, windows-latest]
gu-binary: [gu, gu.cmd]
run-binary: [maven2sbt-cli, maven2sbt-cli.cmd]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
run-binary: maven2sbt-cli.cmd
- os: macos-latest
gu-binary: gu.cmd
run-binary: maven2sbt-cli.cmd
- os: windows-latest
gu-binary: gu
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
- 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"

0 comments on commit 84d0f57

Please sign in to comment.