GitHub Action for setting up GraalVM distributions.
Go to file
2022-03-30 18:48:08 +02:00
__tests__ Add support for GraalVM Enterprise Edition. 2022-03-11 13:37:06 +01:00
.github/workflows Simplify complex Native Image template. 2022-03-29 15:23:04 +02:00
dist Update zlib-1.2.11 download link. 2022-03-28 18:16:44 +02:00
src Update zlib-1.2.11 download link. 2022-03-28 18:16:44 +02:00
.eslintignore Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
.eslintrc.json Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
.gitattributes Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
.gitignore Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
.prettierignore Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
.prettierrc.json Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
action.yml Add support for GraalVM Enterprise Edition. 2022-03-11 13:37:06 +01:00
jest.config.js Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00
LICENSE Initial commit. 2022-01-03 08:25:38 +01:00
package-lock.json Add support for GraalVM Enterprise Edition. 2022-03-11 13:37:06 +01:00
package.json Add support for GraalVM Enterprise Edition. 2022-03-11 13:37:06 +01:00
README.md Simplify GraalVM Native Image example. 2022-03-30 18:48:08 +02:00
tsconfig.json Add GitHub action infrastructure. 2022-01-03 09:51:37 +01:00

GitHub Action for GraalVM build-test

This GitHub action sets up GraalVM Community Edition and GraalVM components such as Native Image and Truffle languages.

Key Features

This action:

  • supports GraalVM CE releases, dev builds, and Mandrel (see options)
  • has built-in support for GraalVM components and the GraalVM updater
  • exports a $GRAALVM_HOME environment variable
  • adds $GRAALVM_HOME/bin to the $PATH environment variable
    (Truffle languages and tools can be invoked directly)
  • sets $JAVA_HOME to $GRAALVM_HOME by default
    (can be disabled via set-java-home: 'false', see options)
  • supports amd64 and aarch64 (requires a self-hosted runner)
  • sets up Windows environments with build tools using vcvarsall.bat

Templates

Quickstart Template

name: GraalVM build
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: graalvm/setup-graalvm@v1
        with:
          version: 'latest'
          java-version: '11'
          components: 'native-image'
          github-token: ${{ secrets.GITHUB_TOKEN }}
      - name: Example step
        run: |
          echo "GRAALVM_HOME: $GRAALVM_HOME"
          echo "JAVA_HOME: $JAVA_HOME"
          java --version
          gu --version
          native-image --version          

Building a HelloWorld with GraalVM Native Image on Different Platforms

name: GraalVM Native Image build
on: [push, pull_request]
jobs:
  build:
    name: HelloWorld on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
    steps:
      - uses: actions/checkout@v2

      - uses: graalvm/setup-graalvm@v1
        with:
          version: '22.0.0.2'
          java-version: '11'
          components: 'native-image'
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and run HelloWorld.java
        run: |
          echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
          javac HelloWorld.java
          native-image HelloWorld
          ./helloworld          
      
      - name: Upload binary
        uses: actions/upload-artifact@v2
        with:
          name: helloworld-${{ matrix.os }}
          path: helloworld*

Options

Name Default Description
version
(required)
n/a X.Y.Z (e.g., 21.3.0) for a specific GraalVM release
latest for latest stable release,
dev for latest dev build,
mandrel-X.Y.Z (e.g., mandrel-21.3.0.0-Final) for a specific Mandrel release,
mandrel-latest for latest Mandrel stable release.
java-version
(required)
n/a '11' or '17' for a specific Java version.
('8' and '16' are supported for GraalVM 21.2 and earlier.)
components '' Comma-spearated list of GraalVM components (e.g., native-image or ruby,nodejs) that will be installed by the GraalVM Updater.
github-token '' Token for communication with the GitHub API. Please set to ${{ secrets.GITHUB_TOKEN }} (see templates) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues.
set-java-home 'true' If set to 'true', instructs the action to set $JAVA_HOME to the path of the GraalVM installation.
native-image-musl 'false' If set to 'true', sets up musl for building static images with GraalVM Native Image (Linux only). Example usage (be sure to replace uses: ./ with uses: graalvm/setup-graalvm@v1).

Contributing

We welcome code contributions. To get started, you will need to sign the Oracle Contributor Agreement (OCA).

Only pull requests from committers that can be verified as having signed the OCA can be accepted.