Skip to content

Commit 19674b6

Browse files
committed
Add support for GraalVM innovation releases
This also marks the `java-version` option as optional.
1 parent 5a1129d commit 19674b6

10 files changed

Lines changed: 500 additions & 93 deletions

File tree

.github/workflows/ci.yml

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,87 @@ jobs:
3535
env:
3636
INPUT_GITHUB_TOKEN: ${{ github.token }} # for core.getInput()
3737

38-
test-action:
38+
test-action-graalvm-version:
3939
name: GraalVM
4040
runs-on: ${{ matrix.os }}
4141
env:
4242
# Skip builds that require a GDS token but have no access to one (e.g., secrets are unavailable in PR runs)
4343
PASSES_GDS_TOKEN_CHECK: ${{ !matrix.set-gds-token || secrets.GDS_TOKEN != '' }}
4444
strategy:
4545
matrix:
46-
java-version: ['25', '21', '17', 'dev']
46+
version: [
47+
'25.1',
48+
'25i1', # innovation release
49+
'25.1.3', # full version
50+
'25.0' # LTS release
51+
]
52+
distribution: ['graalvm', 'graalvm-community']
53+
os: [
54+
ubuntu-latest, # Linux on Intel
55+
ubuntu-22.04-arm, # Linux on arm64
56+
macos-latest, # macOS on Apple silicon
57+
windows-latest
58+
]
59+
set-gds-token: [false]
60+
include:
61+
# Latest EA build
62+
- version: 'latest-ea'
63+
distribution: 'graalvm'
64+
os: ubuntu-latest
65+
# Latest dev build
66+
- version: 'dev'
67+
distribution: 'graalvm-community'
68+
os: ubuntu-latest
69+
# with GDS token
70+
- version: '25.0'
71+
distribution: 'graalvm'
72+
os: ubuntu-latest
73+
set-gds-token: true
74+
steps:
75+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
76+
- name: Run setup-graalvm action
77+
uses: ./
78+
with:
79+
version: ${{ matrix.version }}
80+
distribution: ${{ matrix.distribution }}
81+
github-token: ${{ secrets.GITHUB_TOKEN }}
82+
gds-token: ${{ matrix.set-gds-token && secrets.GDS_TOKEN || '' }}
83+
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' }}
84+
- name: Check environment
85+
run: |
86+
echo "GRAALVM_HOME: $GRAALVM_HOME"
87+
if [[ "${{ matrix.version }}" == "dev" ]]; then
88+
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
89+
else
90+
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
91+
fi
92+
echo "JAVA_HOME: $JAVA_HOME"
93+
java --version
94+
java --version | grep "GraalVM" || exit 34
95+
native-image --version
96+
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os != 'Windows' }}
97+
- name: Check Windows environment
98+
run: |
99+
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
100+
echo "JAVA_HOME: $env:JAVA_HOME"
101+
java --version
102+
native-image --version
103+
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os == 'Windows' }}
104+
105+
test-action-java-version:
106+
name: GraalVM
107+
runs-on: ${{ matrix.os }}
108+
env:
109+
# Skip builds that require a GDS token but have no access to one (e.g., secrets are unavailable in PR runs)
110+
PASSES_GDS_TOKEN_CHECK: ${{ !matrix.set-gds-token || secrets.GDS_TOKEN != '' }}
111+
strategy:
112+
matrix:
113+
java-version: [
114+
'25',
115+
'21',
116+
'17', # LTS
117+
'dev' # dev build
118+
]
47119
distribution: ['graalvm', 'graalvm-community']
48120
os: [
49121
ubuntu-latest, # Linux on Intel
@@ -99,6 +171,7 @@ jobs:
99171
components: ${{ matrix.components }}
100172
gds-token: ${{ matrix.set-gds-token && secrets.GDS_TOKEN || '' }}
101173
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' }}
174+
102175
- name: Check environment
103176
run: |
104177
echo "GRAALVM_HOME: $GRAALVM_HOME"
@@ -121,7 +194,7 @@ jobs:
121194
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os == 'Windows' }}
122195

123196
test-action-ce: # make sure the action works on a clean machine without building
124-
needs: test-action
197+
needs: [test-action-graalvm-version, test-action-java-version]
125198
name: CE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
126199
runs-on: ${{ matrix.os }}
127200
strategy:
@@ -189,7 +262,7 @@ jobs:
189262
if: ${{ runner.os == 'Windows' }}
190263

191264
test-action-ee:
192-
needs: test-action
265+
needs: [test-action-graalvm-version, test-action-java-version]
193266
name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
194267
if: github.event_name != 'pull_request'
195268
runs-on: ${{ matrix.os }}
@@ -242,7 +315,7 @@ jobs:
242315
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os == 'Windows' }}
243316

244317
test-action-mandrel:
245-
needs: test-action
318+
needs: [test-action-graalvm-version, test-action-java-version]
246319
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
247320
runs-on: ${{ matrix.os }}
248321
strategy:
@@ -299,7 +372,7 @@ jobs:
299372
if: ${{ runner.os == 'Windows' }}
300373

301374
test-action-liberica:
302-
needs: test-action
375+
needs: [test-action-graalvm-version, test-action-java-version]
303376
name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }})
304377
runs-on: ${{ matrix.os }}
305378
strategy:

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
build:
2727
runs-on: ubuntu-latest
2828
steps:
29-
- uses: actions/checkout@v4
29+
- uses: actions/checkout@v6
3030
- uses: graalvm/setup-graalvm@v1
3131
with:
32-
java-version: '25' # See 'Options' for more details
32+
version: '25.1' # See 'Options' for more details
3333
distribution: 'graalvm' # See 'Supported distributions' for available options
3434
github-token: ${{ secrets.GITHUB_TOKEN }}
3535
- name: Example step
@@ -57,7 +57,7 @@ jobs:
5757
matrix:
5858
os: [macos-latest, windows-latest, ubuntu-latest]
5959
steps:
60-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v6
6161

6262
- uses: graalvm/setup-graalvm@v1
6363
with:
@@ -80,6 +80,23 @@ jobs:
8080
path: helloworld*
8181
```
8282
83+
### Template for GraalVM innovation releases
84+
85+
```yml
86+
name: Oracle GraalVM Innovation Release build
87+
on: [push, pull_request]
88+
jobs:
89+
build:
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v6
93+
- uses: graalvm/setup-graalvm@v1
94+
with:
95+
version: '25.1'
96+
distribution: 'graalvm'
97+
github-token: ${{ secrets.GITHUB_TOKEN }}
98+
```
99+
83100
### Template for Oracle GraalVM Early Access (EA) builds
84101
85102
```yml
@@ -89,7 +106,7 @@ jobs:
89106
build:
90107
runs-on: ubuntu-latest
91108
steps:
92-
- uses: actions/checkout@v4
109+
- uses: actions/checkout@v6
93110
- uses: graalvm/setup-graalvm@v1
94111
with:
95112
java-version: '25e1-ea' # or 'latest-ea' for the latest Java version available
@@ -127,7 +144,7 @@ jobs:
127144
build:
128145
runs-on: ubuntu-latest
129146
steps:
130-
- uses: actions/checkout@v4
147+
- uses: actions/checkout@v6
131148
- uses: graalvm/setup-graalvm@v1
132149
with:
133150
distribution: 'graalvm'
@@ -159,7 +176,7 @@ jobs:
159176
build:
160177
runs-on: ubuntu-latest
161178
steps:
162-
- uses: actions/checkout@v4
179+
- uses: actions/checkout@v6
163180
- uses: graalvm/setup-graalvm@v1
164181
with:
165182
version: '22.3.0'
@@ -194,7 +211,8 @@ This actions can be configured with the following options:
194211

195212
| Name | Default | Description |
196213
|-----------------|:--------:|-------------|
197-
| `java-version`<br>*(required)* | n/a | Java version <ul><li>major versions: `'25'`, `'21'`, `'17'`, `'11'`, `'8'`</li><li>specific versions: `'21.0.3'`, `'17.0.11'`</li><li>early access (EA) builds: `'25e1-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'` *(requires `distribution: 'graalvm-community'`)*</li></ul> |
214+
| `java-version` | `''` | Java version <ul><li>major versions: `'25'`, `'21'`, `'17'`, `'11'`, `'8'`</li><li>innovation releases: `'25i1'`</li><li>specific versions: `'25.0.3'`, `'21.0.3'`</li><li>early access (EA) builds: `'25e1-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'` *(requires `distribution: 'graalvm-community'`)*</li></ul> |
215+
| `version` | `''` | `X.Y` (e.g., `25.1`) for GraalVM innovation releases starting 25.1<br>`X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release. |
198216
| `distribution` | `'graalvm'` | GraalVM distribution (see [supported distributions](#supported-distributions)) |
199217
| `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. |
200218
| `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. |
@@ -207,7 +225,6 @@ This actions can be configured with the following options:
207225
| `native-image-pr-reports-update-existing` *) | `'false'` | Instead of posting another comment, update an existing PR comment with the latest Native Image build report. Requires `native-image-pr-reports` to be `true`. |
208226
| `native-image-enable-sbom` | `'false'` | If set to `'true'`, generate a minimal SBOM based on the Native Image static analysis and submit it to GitHub's dependency submission API. This enables the [dependency graph feature](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph) for dependency tracking and vulnerability analysis. Requires `write` permissions for the [`contents` scope][gha-permissions] and the dependency graph to be actived (on by default for public repositories - see [how to activate](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph#enabling-and-disabling-the-dependency-graph-for-a-private-repository)). Only available in Oracle GraalVM for JDK 24 or later. |
209227
| `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
210-
| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release. |
211228
| `gds-token` | `''` Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up Oracle GraalVM (see [Oracle GraalVM via GDS template](#template-for-oracle-graalvm-via-graalvm-download-service)) or GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)) via GDS. |
212229

213230
**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*

__tests__/gds.test.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import * as path from 'path'
2-
import { downloadGraalVM, downloadGraalVMEELegacy, fetchArtifact, fetchArtifactEE } from '../src/gds'
2+
import {
3+
downloadGraalVMViaGDSByJavaVersion,
4+
downloadGraalVMViaGDSByJavaVersionEELegacy,
5+
fetchArtifact,
6+
fetchArtifactByJavaVersion,
7+
fetchArtifactEE
8+
} from '../src/gds'
39
import { expect, test } from '@jest/globals'
410
import { fileURLToPath } from 'url'
511

@@ -9,18 +15,31 @@ const dirname = path.dirname(fileURLToPath(import.meta.url))
915
process.env['RUNNER_TEMP'] = path.join(dirname, 'TEMP')
1016

1117
test('fetch artifacts', async () => {
12-
let artifact = await fetchArtifact(TEST_USER_AGENT, 'isBase:True', '17.0.12')
18+
let artifact
19+
// Test innovation releases
20+
for (const version of ['25.1', '25.1.3']) {
21+
artifact = await fetchArtifact(TEST_USER_AGENT, version, '25')
22+
expect(artifact.id).toBe('FE09EC0A4D9244CA834F1777BCA30041')
23+
expect(artifact.checksum).toBe('efcb8984be5f72ecf8615641bec720c825a6889957f0b98d95123f563ff77c86')
24+
}
25+
// Test 25 LTS
26+
artifact = await fetchArtifact(TEST_USER_AGENT, '25.0', '25')
27+
expect(artifact.checksum).toHaveLength('b6f3dace24cf1960ec790216f4c86f00d4f43df64e4e8b548f6382f04894713f'.length)
28+
})
29+
30+
test('fetch artifacts by java version', async () => {
31+
let artifact = await fetchArtifactByJavaVersion(TEST_USER_AGENT, 'isBase:True', '17.0.12')
1332
expect(artifact.id).toBe('1C351E8F41BB8E9EE0631518000AE5F2')
1433
expect(artifact.checksum).toBe('b6f3dace24cf1960ec790216f4c86f00d4f43df64e4e8b548f6382f04894713f')
15-
artifact = await fetchArtifact(TEST_USER_AGENT, 'isBase:True', '17')
34+
artifact = await fetchArtifactByJavaVersion(TEST_USER_AGENT, 'isBase:True', '17')
1635
expect(artifact.checksum).toHaveLength('b6f3dace24cf1960ec790216f4c86f00d4f43df64e4e8b548f6382f04894713f'.length)
1736
})
1837

1938
test('errors when downloading artifacts', async () => {
20-
await expect(downloadGraalVM('invalid', '17')).rejects.toThrow(
39+
await expect(downloadGraalVMViaGDSByJavaVersion('invalid', '17')).rejects.toThrow(
2140
'The provided "gds-token" was rejected (reason: "Invalid download token", opc-request-id: '
2241
)
23-
await expect(downloadGraalVM('invalid', '1')).rejects.toThrow('Unable to find GraalVM for JDK 1')
42+
await expect(downloadGraalVMViaGDSByJavaVersion('invalid', '1')).rejects.toThrow('Unable to find GraalVM for JDK 1')
2443
})
2544

2645
test('fetch legacy artifacts', async () => {
@@ -40,13 +59,13 @@ test('fetch legacy artifacts', async () => {
4059
})
4160

4261
test('errors when downloading legacy artifacts', async () => {
43-
await expect(downloadGraalVMEELegacy('invalid', '22.1.0', '11')).rejects.toThrow(
62+
await expect(downloadGraalVMViaGDSByJavaVersionEELegacy('invalid', '22.1.0', '11')).rejects.toThrow(
4463
'The provided "gds-token" was rejected (reason: "Invalid download token", opc-request-id: '
4564
)
46-
await expect(downloadGraalVMEELegacy('invalid', '1.0.0', '11')).rejects.toThrow(
65+
await expect(downloadGraalVMViaGDSByJavaVersionEELegacy('invalid', '1.0.0', '11')).rejects.toThrow(
4766
'Unable to find JDK11-based GraalVM EE 1.0.0'
4867
)
49-
await expect(downloadGraalVMEELegacy('invalid', '22.1.0', '1')).rejects.toThrow(
68+
await expect(downloadGraalVMViaGDSByJavaVersionEELegacy('invalid', '22.1.0', '1')).rejects.toThrow(
5069
'Unable to find JDK1-based GraalVM EE 22.1.0'
5170
)
5271
})

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ branding:
66
color: 'blue'
77
inputs:
88
java-version:
9-
required: true
9+
required: false
1010
description: 'Java version. See examples of supported syntax in the README file.'
1111
java-package:
1212
description: 'The package type (jdk or jdk+fx). Currently applies to Liberica only.'

0 commit comments

Comments
 (0)