GitHub Actions
GraalVM provides official GitHub Actions support.
Below is an example of GitHub Actions workflow file. In this workflow, the Maven project is built on Linux, macOS, and Windows platforms to create native images.
name: GraalVM build
on: [ push, pull_request ]
jobs:
build:
name: ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: [ latest ]
os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v2
- uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm-community'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B -ntp package
env:
NO_DOCKER: ${{ runner.os != 'Linux' }}
See the real project here.