You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds support for the new GraalVM for JDK17/JDK20 release, including the new Oracle GraalVM distribution.
For this, users only need to specify the 'java-version' option and the new 'distribution' option.
The 'version' option is now marked as optional and kept for compatibility with older GraalVM releases and Mandrel.
Copy file name to clipboardExpand all lines: README.md
+77-22Lines changed: 77 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,54 @@
1
1
# GitHub Action for GraalVM [](https://github.com/graalvm/setup-graalvm/actions/workflows/test.yml)
2
-
This GitHub action sets up GraalVM[Community Edition (CE)][repo] or [Enterprise Edition (EE)][graalvm-ee] as well as GraalVM components such as [Native Image][native-image] and [Truffle languages][truffle-languages].
2
+
This GitHub action sets up [Oracle GraalVM][graalvm], GraalVM [Community Edition (CE)][repo], [Enterprise Edition (EE)][graalvm-ee], or [Mandrel][mandrel], as well as [Native Image][native-image] and GraalVM components such as[Truffle languages][truffle-languages].
3
3
4
4
## Key Features
5
5
6
6
This action:
7
7
8
-
- supports GraalVM Community Edition (CE) [releases], [dev builds][dev-builds], GraalVM Enterprise Edition (EE) [releases][graalvm-ee] (set [`gds-token`](#options)) 22.1.0 and later, and [Mandrel][mandrel] (see [options](#options))
9
-
- has built-in support for GraalVM components and the [GraalVM Updater][gu]
8
+
- supports Oracle GraalVM [releases][graalvm-dl], GraalVM Community Edition (CE) [releases], [dev builds][dev-builds], GraalVM Enterprise Edition (EE) [releases][graalvm-ee] (set [`gds-token`](#options)) 22.1.0 and later, and [Mandrel][mandrel] (see [Options](#options))
10
9
- exports a `$GRAALVM_HOME` environment variable
11
-
- adds `$GRAALVM_HOME/bin` to the `$PATH` environment variable<br>(Truffle languages and tools can be invoked directly)
12
-
- sets `$JAVA_HOME` to `$GRAALVM_HOME` by default<br>(can be disabled via `set-java-home: 'false'`, see [options](#options))
13
-
- supports `amd64` and `aarch64` (selected automatically, `aarch64` requires a [self-hosted runner][gha-self-hosted-runners])
14
-
- sets up Windows environments with build tools using [vcvarsall.bat][vcvarsall]
10
+
- adds `$GRAALVM_HOME/bin` to the `$PATH` environment variable<br>(Native Image, Truffle languages, and tools can be invoked directly)
11
+
- sets `$JAVA_HOME` to `$GRAALVM_HOME` by default<br>(can be disabled via `set-java-home: 'false'`, see [Options](#options))
12
+
- supports `x64` and `aarch64` (selected automatically, `aarch64` requires a [self-hosted runner][gha-self-hosted-runners])
15
13
- supports dependency caching for Apache Maven, Gradle, and sbt (see [`cache` option](#options))
14
+
- sets up Windows environments with build tools using [vcvarsall.bat][vcvarsall]
15
+
- has built-in support for GraalVM components and the [GraalVM Updater][gu]
16
+
17
+
18
+
## Migrating from GraalVM 22.3 or earlier to the new GraalVM for JDK 17 and later
19
+
20
+
The new [GraalVM release](https://medium.com/graalvm/a-new-graalvm-release-and-new-free-license-4aab483692f5) aligns the version scheme with OpenJDK.
21
+
As a result, this action no longer requires the `version` option that was used to select a specific GraalVM version.
22
+
At the same time, it introduces a new `distribution` option that can be used to select a specific GraalVM distribution (`graalvm`, `graalvm-community`, and `mandrel`).
23
+
Therefore, to migrate workflows to use the latest GraalVM release, replace the `version` with the `distribution` option in your workflow `yml` config, for example:
24
+
25
+
```yml
26
+
# ...
27
+
- uses: graalvm/setup-graalvm@v1
28
+
with:
29
+
java-version: '17'
30
+
version: '22.3.2'# Old 'version' option for the GraalVM version
31
+
# ...
32
+
```
33
+
34
+
can be turned into:
35
+
36
+
```yml
37
+
# ...
38
+
- uses: graalvm/setup-graalvm@v1
39
+
with:
40
+
java-version: '17.0.7'# for a specific JDK 17; or '17' for the latest JDK 17
41
+
distribution: 'graalvm'# New 'distribution' option
42
+
# ...
43
+
```
16
44
17
45
18
46
## Templates
19
47
20
48
### Quickstart Template
21
49
22
50
```yml
23
-
name: GraalVM Community Edition build
51
+
name: GraalVM build
24
52
on: [push, pull_request]
25
53
jobs:
26
54
build:
@@ -29,17 +57,19 @@ jobs:
29
57
- uses: actions/checkout@v3
30
58
- uses: graalvm/setup-graalvm@v1
31
59
with:
32
-
version: 'latest'
33
-
java-version: '17'
34
-
components: 'native-image'
60
+
java-version: '17.0.7'
61
+
distribution: 'graalvm'# See 'Options' for all available distributions
35
62
github-token: ${{ secrets.GITHUB_TOKEN }}
36
63
- name: Example step
37
64
run: |
38
65
echo "GRAALVM_HOME: $GRAALVM_HOME"
39
66
echo "JAVA_HOME: $JAVA_HOME"
40
67
java --version
41
-
gu --version
42
68
native-image --version
69
+
- name: Example step using Maven plugin # https://graalvm.github.io/native-build-tools/latest/maven-plugin.html
70
+
run: mvn -Pnative package
71
+
- name: Example step using Gradle plugin # https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html
72
+
run: gradlew nativeCompile
43
73
```
44
74
45
75
### Building a HelloWorld with GraalVM Native Image on Different Platforms
@@ -59,9 +89,8 @@ jobs:
59
89
60
90
- uses: graalvm/setup-graalvm@v1
61
91
with:
62
-
version: '22.3.0'
63
-
java-version: '17'
64
-
components: 'native-image'
92
+
java-version: '17.0.7'
93
+
distribution: 'graalvm'
65
94
github-token: ${{ secrets.GITHUB_TOKEN }}
66
95
native-image-job-reports: 'true'
67
96
@@ -79,7 +108,29 @@ jobs:
79
108
path: helloworld*
80
109
```
81
110
82
-
### Basic GraalVM Enterprise Edition Template
111
+
<details>
112
+
<summary><h4>Template for older GraalVM releases</h4></summary>
113
+
114
+
```yml
115
+
name: GraalVM build
116
+
on: [push, pull_request]
117
+
jobs:
118
+
build:
119
+
runs-on: ubuntu-latest
120
+
steps:
121
+
- uses: actions/checkout@v3
122
+
- uses: graalvm/setup-graalvm@v1
123
+
with:
124
+
version: '22.3.2'# GraalVM version
125
+
java-version: '17'
126
+
components: 'native-image'
127
+
github-token: ${{ secrets.GITHUB_TOKEN }}
128
+
```
129
+
130
+
</details>
131
+
132
+
<details>
133
+
<summary><h4>Template for GraalVM Enterprise Edition</h4></summary>
83
134
84
135
#### Prerequisites
85
136
@@ -109,22 +160,24 @@ jobs:
109
160
native-image --version
110
161
```
111
162
163
+
</details>
112
164
113
165
## Options
114
166
115
167
| Name | Default | Description |
116
168
|-----------------|:--------:|-------------|
117
-
| `version`<br>*(required)* | n/a | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases]<br>`latest` for [latest stable release][stable],<br>`dev` for [latest dev build][dev-build],<br>`mandrel-X.Y.Z` (e.g., `mandrel-21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` for [latest Mandrel stable release][mandrel-stable]. |
118
-
| `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#basic-graalvm-enterprise-edition-template)). |
119
-
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version, `'dev'` for the highest Java version available (requires `version: 'dev'`).<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
120
-
| `components` | `''` | Comma-spearated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
121
-
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
169
+
| `java-version`<br>*(required)* | n/a | `'17.0.7'` or `'20.0.1'` for a specific Java version, `'dev'` for a dev build with the highest Java version available.<br>(`'8'`, `'11'`, `'16'`, `'19'` are supported for older GraalVM releases.) |
170
+
| `distribution` | `''` | GraalVM distribution (`graalvm` for Oracle GraalVM, `graalvm-community` for GraalVM Community Edition, `mandrel` for Mandrel). |
171
+
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set this to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps reduce rate-limiting issues. |
122
172
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. |
123
173
| `cache` | `''` | Name of the build platform to cache dependencies. It can be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
124
-
| `check-for-updates` | `'true'` | [Annotate jobs][gha-annotations] with update notifications, for example, when a new GraalVM release is available. |
174
+
| `check-for-updates` | `'true'` | [Annotate jobs][gha-annotations] with update notifications, for example when a new GraalVM release is available. |
125
175
| `native-image-musl` | `'false'` | If set to `'true'`, sets up [musl] to build [static binaries][native-image-static] with GraalVM Native Image *(Linux only)*. [Example usage][native-image-musl-build] (be sure to replace `uses: ./` with `uses: graalvm/setup-graalvm@v1`). |
126
176
| `native-image-job-reports` *) | `'false'` | If set to `'true'`, post a job summary containing a Native Image build report. |
127
177
| `native-image-pr-reports` *) | `'false'` | If set to `'true'`, post a comment containing a Native Image build report on pull requests. Requires `write` permissions for the [`pull-requests` scope][gha-permissions]. |
178
+
| `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
179
+
| `version` | n/a | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z` (e.g., `mandrel-21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` for [latest Mandrel stable release][mandrel-stable]. |
180
+
| `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)). |
128
181
129
182
**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*
130
183
@@ -143,6 +196,8 @@ Only pull requests from committers that can be verified as having signed the OCA
0 commit comments