From ec7c92084fced04705b0ea107d630f72ed28a8f8 Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Wed, 19 Jul 2023 11:20:55 +0200 Subject: [PATCH] refactor: start using setup-graal --- .github/workflows/ci.yml | 48 +++++++++++++++++++++--------------- .github/workflows/native.yml | 8 +++++- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 747eb9e..cbae637 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI on: push: branches: - - master - main pull_request: + jobs: native-image: name: Compile @@ -13,33 +13,41 @@ jobs: fail-fast: false matrix: os: [macOS-latest, ubuntu-latest, windows-latest] - java: [11] + java: ['17.0.7'] + steps: - uses: actions/checkout@v3 - - uses: olafurpg/setup-scala@v13 + - uses: graalvm/setup-graalvm@v1 with: - java-version: "adopt@1.${{ matrix.java }}" - - name: Setup Windows C++ toolchain - uses: ilammy/msvc-dev-cmd@v1 - if: ${{ matrix.os == 'windows-latest' }} + java-version: ${{ matrix.java }} + cache: sbt + components: native-image + - name: sbt test plugin/scripted - if: ${{ matrix.os == 'ubuntu-latest' }} - shell: bash + if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} + env: + NATIVE_IMAGE_COMMAND: native-image run: | - export JABBA=/home/runner/bin/jabba - $JABBA install graalvm@22.3.0 - export GRAALVM_HOME=$($JABBA which --home graalvm@22.3.0) - $GRAALVM_HOME/bin/gu install native-image - export NATIVE_IMAGE_COMMAND=$GRAALVM_HOME/bin/native-image + # Copied from https://github.com/graalvm/setup-graalvm#quickstart-template + echo "GRAALVM_HOME: $GRAALVM_HOME" + echo "JAVA_HOME: $JAVA_HOME" + java --version + native-image --version sbt test plugin/scripted - - name: sbt test - shell: bash - if: ${{ matrix.os == 'windows-latest' }} - run: | - sbt example/nativeImage + + # - name: sbt test + # shell: bash + # if: ${{ matrix.os == 'windows-latest' }} + # run: | + # sbt example/nativeImage + check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: olafurpg/setup-scala@v13 + - uses: actions/setup-java@v3 - run: sbt checkAll + with: + distribution: 'temurin' + java-version: '17' + cache: 'sbt' diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml index 6a91c92..4347114 100644 --- a/.github/workflows/native.yml +++ b/.github/workflows/native.yml @@ -2,11 +2,11 @@ name: Native Image on: push: branches: - - master - main pull_request: release: types: [published] + jobs: native-image: runs-on: ${{ matrix.os }} @@ -29,6 +29,7 @@ jobs: # define Java options for both official sbt and sbt-extras JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8 + steps: - uses: actions/checkout@v3 - name: Setup JDK @@ -37,19 +38,24 @@ jobs: distribution: temurin java-version: 8 cache: sbt + - run: git fetch --tags || true + - name: Setup Windows C++ toolchain uses: ilammy/msvc-dev-cmd@v1 if: ${{ matrix.os == 'windows-latest' }} + - name: Build shell: bash run: | echo $(pwd) sbt clean example/nativeImage + - uses: actions/upload-artifact@v2 with: path: ${{ matrix.local_path }} name: ${{ matrix.uploaded_filename }} + - name: Upload release if: github.event_name == 'release' uses: actions/upload-release-asset@v1.0.2