Skip to content

Use Java modern features/APIs #520

Use Java modern features/APIs

Use Java modern features/APIs #520

Workflow file for this run

name: Test native builds
# No need to run when only the docs are changing. There is
# a workflow to validate the docs.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
on:
pull_request:
paths-ignore:
- 'docs/**'
- 'mkdocs.yml'
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: [17]
os: [windows-2022, macOS-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: ${{ matrix.java_version }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
# Adapted from https://github.com/actions/cache/blob/v3/examples.md#java---gradle
- name: Cache local Gradle
id: gradleCache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-graalvm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-graalvm-
- name: Make Maven Wrapper executable
if: contains(matrix.os, 'win') == false
run: chmod +x ./mvnw
- name: Build with Maven
run: ./mvnw install --file pom.xml -DskipTests=true
- name: Build Gradle Plugin
run: cd jte-gradle-plugin && ./gradlew publishToMavenLocal
- name: Test Gradle Plugin Generate with conventions
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew check nativeTest
- name: Stop Gradle Daemon
if: ${{ always() }}
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew --stop
# This prevents local published artifacts from be added to GH Actions cache
- name: Clean local artifacts
if: contains(matrix.os, 'win') == false
run: rm -rvf ~/.m2/repository/gg/jte
# `rm` syntax for Windows is different. Needs to use `-Force` since `-f`
# is ambiguous (possible matches include: -Filter -Force).
- name: "[Windows]: Clean local artifacts"
if: contains(matrix.os, 'win')
run: rm -r -Force ~/.m2/repository/gg/jte