Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fb264a6b0 | ||
|
|
0a27862568 | ||
|
|
70003e7f9f | ||
|
|
814434c7a9 | ||
|
|
3282b5e43f | ||
|
|
26eec53160 | ||
|
|
0e29e36dce | ||
|
|
ac032b0e7e | ||
|
|
8cd3284efc | ||
|
|
8f1dbd2ce5 | ||
|
|
d3b90f817c | ||
|
|
570f6b20e6 | ||
|
|
265e01895c |
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
|||||||
62
.github/workflows/test.yml
vendored
62
.github/workflows/test.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
build: # make sure build/ci work properly
|
build: # make sure build/ci work properly
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: |
|
- run: |
|
||||||
npm install
|
npm install
|
||||||
- run: |
|
- run: |
|
||||||
@@ -25,18 +25,22 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: ['17', '20', 'dev']
|
java-version: ['21', '17', '20', 'dev']
|
||||||
distribution: ['graalvm', 'graalvm-community']
|
distribution: ['graalvm', 'graalvm-community']
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
include:
|
include:
|
||||||
- java-version: '17.0.7'
|
- java-version: '21'
|
||||||
distribution: ''
|
distribution: ''
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- java-version: 'dev'
|
- java-version: 'dev'
|
||||||
distribution: ''
|
distribution: ''
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
|
- java-version: '21'
|
||||||
|
distribution: 'graalvm-community'
|
||||||
|
os: ubuntu-latest
|
||||||
|
components: 'native-image' # should print a warning but not fail
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -95,7 +99,7 @@ jobs:
|
|||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -106,7 +110,7 @@ jobs:
|
|||||||
- name: Check environment
|
- name: Check environment
|
||||||
run: |
|
run: |
|
||||||
echo "GRAALVM_HOME: $GRAALVM_HOME"
|
echo "GRAALVM_HOME: $GRAALVM_HOME"
|
||||||
if [[ "${{ matrix.version }}" == "dev" ]]; then
|
if [[ "${{ matrix.version }}" == "dev" ]] && [[ "${{ matrix.java-version }}" == "dev" ]]; then
|
||||||
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
|
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
|
||||||
else
|
else
|
||||||
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
|
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
|
||||||
@@ -115,7 +119,9 @@ jobs:
|
|||||||
java --version
|
java --version
|
||||||
java --version | grep "GraalVM" || exit 34
|
java --version | grep "GraalVM" || exit 34
|
||||||
native-image --version
|
native-image --version
|
||||||
gu list
|
if [[ "${{ matrix.java-version }}" != "dev" ]]; then
|
||||||
|
gu list
|
||||||
|
fi
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
- name: Check Windows environment
|
- name: Check Windows environment
|
||||||
run: |
|
run: |
|
||||||
@@ -133,20 +139,20 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
version: ['latest']
|
version: ['latest']
|
||||||
java-version: ['19']
|
java-version: ['17']
|
||||||
components: ['native-image']
|
components: ['native-image']
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
include:
|
include:
|
||||||
- version: '22.3.0'
|
- version: '22.3.3'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- version: '22.3.0'
|
- version: '22.3.3'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
components: 'native-image'
|
components: 'native-image'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -161,7 +167,7 @@ jobs:
|
|||||||
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
|
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
|
||||||
echo "JAVA_HOME: $JAVA_HOME"
|
echo "JAVA_HOME: $JAVA_HOME"
|
||||||
java --version
|
java --version
|
||||||
java --version | grep "GraalVM EE" || exit 23
|
java --version | grep -e "GraalVM EE" -e "Oracle GraalVM" || exit 23
|
||||||
native-image --version
|
native-image --version
|
||||||
gu list
|
gu list
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
@@ -193,7 +199,7 @@ jobs:
|
|||||||
java-version: '17'
|
java-version: '17'
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -224,7 +230,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write # for `native-image-pr-reports` option
|
pull-requests: write # for `native-image-pr-reports` option
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -246,7 +252,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write # for `native-image-pr-reports` option
|
pull-requests: write # for `native-image-pr-reports` option
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -268,7 +274,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write # for `native-image-pr-reports` option
|
pull-requests: write # for `native-image-pr-reports` option
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -291,7 +297,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write # for `native-image-pr-reports` option
|
pull-requests: write # for `native-image-pr-reports` option
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: Run setup-graalvm action
|
- name: Run setup-graalvm action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
@@ -326,16 +332,16 @@ jobs:
|
|||||||
javac HelloWorld.java
|
javac HelloWorld.java
|
||||||
native-image -g HelloWorld
|
native-image -g HelloWorld
|
||||||
./helloworld
|
./helloworld
|
||||||
- name: Build Ruby-FFI with TruffleRuby
|
# - name: Build Ruby-FFI with TruffleRuby
|
||||||
run: |
|
# run: |
|
||||||
[[ $(which bundle) == *"graalvm"* ]] || exit 57
|
# [[ $(which bundle) == *"graalvm"* ]] || exit 57
|
||||||
git clone --depth 1 https://github.com/ffi/ffi.git
|
# git clone --depth 1 https://github.com/ffi/ffi.git
|
||||||
pushd ffi > /dev/null
|
# pushd ffi > /dev/null
|
||||||
# https://github.com/ffi/ffi/blob/447845cb3030194c79700c86fb388a12e6f81386/.github/workflows/ci.yml#L58-L62
|
# # https://github.com/ffi/ffi/blob/447845cb3030194c79700c86fb388a12e6f81386/.github/workflows/ci.yml#L58-L62
|
||||||
bundle install
|
# bundle install
|
||||||
bundle exec rake libffi
|
# bundle exec rake libffi
|
||||||
bundle exec rake compile
|
# bundle exec rake compile
|
||||||
bundle exec rake test
|
# bundle exec rake test
|
||||||
popd > /dev/null
|
# popd > /dev/null
|
||||||
- name: Remove components
|
- name: Remove components
|
||||||
run: gu remove espresso llvm-toolchain nodejs python ruby wasm
|
run: gu remove espresso llvm-toolchain nodejs python ruby wasm
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -17,7 +17,7 @@ This action:
|
|||||||
|
|
||||||
## Migrating from GraalVM 22.3 or Earlier to the New GraalVM for JDK 17 and Later
|
## Migrating from GraalVM 22.3 or Earlier to the New GraalVM for JDK 17 and Later
|
||||||
|
|
||||||
The new [GraalVM for JDK 17 and JDK 20 release](https://medium.com/graalvm/a-new-graalvm-release-and-new-free-license-4aab483692f5) aligns the GraalVM version scheme with OpenJDK.
|
The [GraalVM for JDK 17 and JDK 20 release](https://medium.com/graalvm/a-new-graalvm-release-and-new-free-license-4aab483692f5) aligns the GraalVM version scheme with OpenJDK.
|
||||||
As a result, this action no longer requires the `version` option to select a specific GraalVM version.
|
As a result, this action no longer requires the `version` option to select a specific GraalVM version.
|
||||||
At the same time, it introduces a new `distribution` option to select a specific GraalVM distribution (`graalvm`, `graalvm-community`, or `mandrel`).
|
At the same time, it introduces a new `distribution` option to select a specific GraalVM distribution (`graalvm`, `graalvm-community`, or `mandrel`).
|
||||||
Therefore, to migrate your workflow to use the latest GraalVM release, replace the `version` with the `distribution` option in the workflow `yml` config, for example:
|
Therefore, to migrate your workflow to use the latest GraalVM release, replace the `version` with the `distribution` option in the workflow `yml` config, for example:
|
||||||
@@ -54,10 +54,10 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
java-version: '17.0.7'
|
java-version: '21'
|
||||||
distribution: 'graalvm' # See 'Options' for all available distributions
|
distribution: 'graalvm' # See 'Options' for all available distributions
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Example step
|
- name: Example step
|
||||||
@@ -85,11 +85,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
java-version: '17.0.7'
|
java-version: '21'
|
||||||
distribution: 'graalvm'
|
distribution: 'graalvm'
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
native-image-job-reports: 'true'
|
native-image-job-reports: 'true'
|
||||||
@@ -118,7 +118,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
version: '22.3.2' # GraalVM version
|
version: '22.3.2' # GraalVM version
|
||||||
@@ -146,7 +146,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
version: '22.3.0'
|
version: '22.3.0'
|
||||||
@@ -166,7 +166,7 @@ jobs:
|
|||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
|-----------------|:--------:|-------------|
|
|-----------------|:--------:|-------------|
|
||||||
| `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 latest Java version available.<br>(`'8'`, `'11'`, `'16'`, `'19'` are supported for older GraalVM releases.) |
|
| `java-version`<br>*(required)* | n/a | `'21'` or `'17.0.7'` for a specific Java version, `'dev'` for a dev build with the latest Java version available.<br>(`'8'`, `'11'`, `'16'`, `'19'` are supported for older GraalVM releases.) |
|
||||||
| `distribution` | `''` | GraalVM distribution (`graalvm` for Oracle GraalVM, `graalvm-community` for GraalVM Community Edition, `mandrel` for Mandrel). |
|
| `distribution` | `''` | GraalVM distribution (`graalvm` for Oracle GraalVM, `graalvm-community` for GraalVM Community Edition, `mandrel` for Mandrel). |
|
||||||
| `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. |
|
| `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. |
|
||||||
| `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`. |
|
| `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`. |
|
||||||
|
|||||||
145
dist/main/index.js
generated
vendored
145
dist/main/index.js
generated
vendored
@@ -70308,32 +70308,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.checkForUpdates = void 0;
|
exports.checkForUpdates = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
function checkForUpdates(graalVMVersion, javaVersion) {
|
function checkForUpdates(graalVMVersion, javaVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (javaVersion === '20') {
|
||||||
if (graalVMVersion.length > 0 &&
|
core.notice('A new GraalVM release is available! Please consider upgrading to GraalVM for JDK 21: https://medium.com/graalvm/graalvm-for-jdk-21-is-here-ee01177dd12d');
|
||||||
(javaVersion === '17' || javaVersion === '19')) {
|
return;
|
||||||
const recommendedJDK = javaVersion === '17' ? '17' : '20';
|
}
|
||||||
core.notice(`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`);
|
if (graalVMVersion.length > 0 &&
|
||||||
return;
|
(javaVersion === '17' || javaVersion === '19')) {
|
||||||
}
|
const recommendedJDK = javaVersion === '17' ? '17' : '21';
|
||||||
if (graalVMVersion.startsWith('22.3.') && javaVersion === '11') {
|
core.notice(`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`);
|
||||||
core.notice('Please consider upgrading your project to Java 17+. GraalVM 22.3.X releases are the last to support JDK11: https://github.com/oracle/graal/issues/5063');
|
return;
|
||||||
return;
|
}
|
||||||
}
|
if (graalVMVersion.startsWith('22.3.') && javaVersion === '11') {
|
||||||
// TODO: add support for JDK-specific update checks (e.g., 17.0.X)
|
core.notice('Please consider upgrading your project to Java 17+. GraalVM 22.3.X releases are the last to support JDK11: https://github.com/oracle/graal/issues/5063');
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
// TODO: add support for JDK-specific update checks (e.g., 17.0.X)
|
||||||
}
|
}
|
||||||
exports.checkForUpdates = checkForUpdates;
|
exports.checkForUpdates = checkForUpdates;
|
||||||
|
|
||||||
@@ -70824,7 +70817,7 @@ const assert_1 = __nccwpck_require__(9491);
|
|||||||
const uuid_1 = __nccwpck_require__(5840);
|
const uuid_1 = __nccwpck_require__(5840);
|
||||||
function downloadGraalVMEELegacy(gdsToken, version, javaVersion) {
|
function downloadGraalVMEELegacy(gdsToken, version, javaVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const userAgent = `GraalVMGitHubAction/1.1.2 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
const userAgent = `GraalVMGitHubAction/1.1.4 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
||||||
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
|
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
|
||||||
return downloadArtifact(gdsToken, userAgent, baseArtifact);
|
return downloadArtifact(gdsToken, userAgent, baseArtifact);
|
||||||
});
|
});
|
||||||
@@ -71129,7 +71122,7 @@ exports.findHighestJavaVersion = findHighestJavaVersion;
|
|||||||
// Support for GraalVM 22.X releases and earlier
|
// Support for GraalVM 22.X releases and earlier
|
||||||
function setUpGraalVMLatest_22_X(gdsToken, javaVersion) {
|
function setUpGraalVMLatest_22_X(gdsToken, javaVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const lockedVersion = javaVersion === '19' ? '22.3.1' : '22.3.2';
|
const lockedVersion = javaVersion === '19' ? '22.3.1' : '22.3.3';
|
||||||
if (gdsToken.length > 0) {
|
if (gdsToken.length > 0) {
|
||||||
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion);
|
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion);
|
||||||
}
|
}
|
||||||
@@ -71204,6 +71197,29 @@ function downloadGraalVMCELegacy(version, javaVersion) {
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
|
}) : (function(o, m, k, k2) {
|
||||||
|
if (k2 === undefined) k2 = k;
|
||||||
|
o[k2] = m[k];
|
||||||
|
}));
|
||||||
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
|
}) : function(o, v) {
|
||||||
|
o["default"] = v;
|
||||||
|
});
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
|
__setModuleDefault(result, mod);
|
||||||
|
return result;
|
||||||
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
@@ -71215,9 +71231,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.setUpGUComponents = void 0;
|
exports.setUpGUComponents = void 0;
|
||||||
|
const c = __importStar(__nccwpck_require__(9042));
|
||||||
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
const utils_1 = __nccwpck_require__(1314);
|
const utils_1 = __nccwpck_require__(1314);
|
||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
|
const semver_1 = __nccwpck_require__(1383);
|
||||||
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress'];
|
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress'];
|
||||||
const COMPONENT_TO_POST_INSTALL_HOOK = new Map([
|
const COMPONENT_TO_POST_INSTALL_HOOK = new Map([
|
||||||
[
|
[
|
||||||
@@ -71236,7 +71255,31 @@ const COMPONENT_TO_POST_INSTALL_HOOK = new Map([
|
|||||||
]
|
]
|
||||||
// No post install hooks for Windows (yet)
|
// No post install hooks for Windows (yet)
|
||||||
]);
|
]);
|
||||||
function setUpGUComponents(gdsToken, graalVMHome, components) {
|
function setUpGUComponents(javaVersion, graalVMVersion, graalVMHome, components, gdsToken) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (components.length == 0) {
|
||||||
|
return; // nothing to do
|
||||||
|
}
|
||||||
|
if (graalVMVersion === c.VERSION_DEV ||
|
||||||
|
javaVersion === c.VERSION_DEV ||
|
||||||
|
((0, semver_1.valid)(javaVersion) && (0, semver_1.gte)(javaVersion, '21.0.0'))) {
|
||||||
|
if (components.length == 1 && components[0] === 'native-image') {
|
||||||
|
core.warning(`Please remove "components: 'native-image'" from your workflow file. It is automatically included since GraalVM for JDK 17: https://github.com/oracle/graal/pull/5995`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.warning(`Unable to install component(s): '${components.join(',')}'. The latest GraalVM dev builds and the upcoming GraalVM for JDK 21 no longer include the GraalVM Updater: https://github.com/oracle/graal/issues/6855`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
|
core.warning(`Mandrel does not support GraalVM component(s): '${components.join(',')}'`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield installGUComponents(gdsToken, graalVMHome, components);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.setUpGUComponents = setUpGUComponents;
|
||||||
|
function installGUComponents(gdsToken, graalVMHome, components) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield (0, utils_1.exec)('gu', BASE_FLAGS.concat(components), {
|
yield (0, utils_1.exec)('gu', BASE_FLAGS.concat(components), {
|
||||||
env: Object.assign(Object.assign({}, process.env), { GRAAL_EE_DOWNLOAD_TOKEN: gdsToken })
|
env: Object.assign(Object.assign({}, process.env), { GRAAL_EE_DOWNLOAD_TOKEN: gdsToken })
|
||||||
@@ -71252,7 +71295,6 @@ function setUpGUComponents(gdsToken, graalVMHome, components) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.setUpGUComponents = setUpGUComponents;
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -71298,7 +71340,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
const c = __importStar(__nccwpck_require__(9042));
|
const c = __importStar(__nccwpck_require__(9042));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const graalvm = __importStar(__nccwpck_require__(5254));
|
const graalvm = __importStar(__nccwpck_require__(5254));
|
||||||
const semver_1 = __nccwpck_require__(1383);
|
const semver = __importStar(__nccwpck_require__(1383));
|
||||||
const cache_1 = __nccwpck_require__(7799);
|
const cache_1 = __nccwpck_require__(7799);
|
||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
const cache_2 = __nccwpck_require__(9179);
|
const cache_2 = __nccwpck_require__(9179);
|
||||||
@@ -71314,7 +71356,7 @@ function run() {
|
|||||||
try {
|
try {
|
||||||
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, { required: true });
|
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, { required: true });
|
||||||
const distribution = core.getInput(c.INPUT_DISTRIBUTION);
|
const distribution = core.getInput(c.INPUT_DISTRIBUTION);
|
||||||
const graalvmVersion = core.getInput(c.INPUT_VERSION);
|
const graalVMVersion = core.getInput(c.INPUT_VERSION);
|
||||||
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN);
|
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN);
|
||||||
const componentsString = core.getInput(c.INPUT_COMPONENTS);
|
const componentsString = core.getInput(c.INPUT_COMPONENTS);
|
||||||
const components = componentsString.length > 0
|
const components = componentsString.length > 0
|
||||||
@@ -71325,16 +71367,21 @@ function run() {
|
|||||||
const enableCheckForUpdates = core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true';
|
const enableCheckForUpdates = core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true';
|
||||||
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true';
|
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true';
|
||||||
if (c.IS_WINDOWS) {
|
if (c.IS_WINDOWS) {
|
||||||
(0, msvc_1.setUpWindowsEnvironment)(graalvmVersion);
|
(0, msvc_1.setUpWindowsEnvironment)(graalVMVersion);
|
||||||
}
|
}
|
||||||
yield (0, dependencies_1.setUpDependencies)(components);
|
yield (0, dependencies_1.setUpDependencies)(components);
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
yield (0, musl_1.setUpNativeImageMusl)();
|
yield (0, musl_1.setUpNativeImageMusl)();
|
||||||
}
|
}
|
||||||
// Download GraalVM JDK
|
// Download GraalVM JDK
|
||||||
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalvmVersion.length == 0;
|
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0;
|
||||||
let graalVMHome;
|
let graalVMHome;
|
||||||
if (isGraalVMforJDK17OrLater) {
|
if (isGraalVMforJDK17OrLater) {
|
||||||
|
if (enableCheckForUpdates &&
|
||||||
|
(distribution === c.DISTRIBUTION_GRAALVM ||
|
||||||
|
distribution === c.DISTRIBUTION_GRAALVM_COMMUNITY)) {
|
||||||
|
(0, check_for_updates_1.checkForUpdates)(graalVMVersion, javaVersion);
|
||||||
|
}
|
||||||
switch (distribution) {
|
switch (distribution) {
|
||||||
case c.DISTRIBUTION_GRAALVM:
|
case c.DISTRIBUTION_GRAALVM:
|
||||||
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
|
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
|
||||||
@@ -71343,8 +71390,8 @@ function run() {
|
|||||||
graalVMHome = yield graalvm.setUpGraalVMJDKCE(javaVersion);
|
graalVMHome = yield graalvm.setUpGraalVMJDKCE(javaVersion);
|
||||||
break;
|
break;
|
||||||
case c.DISTRIBUTION_MANDREL:
|
case c.DISTRIBUTION_MANDREL:
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
graalVMHome = yield (0, mandrel_1.setUpMandrel)(graalvmVersion, javaVersion);
|
graalVMHome = yield (0, mandrel_1.setUpMandrel)(graalVMVersion, javaVersion);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error(`Mandrel requires the 'version' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`);
|
throw new Error(`Mandrel requires the 'version' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`);
|
||||||
@@ -71365,10 +71412,10 @@ function run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (graalvmVersion) {
|
switch (graalVMVersion) {
|
||||||
case c.VERSION_LATEST:
|
case c.VERSION_LATEST:
|
||||||
if (javaVersion.startsWith('17') ||
|
if (javaVersion.startsWith('17') ||
|
||||||
((0, semver_1.valid)(javaVersion) && (0, semver_1.gte)(javaVersion, '20'))) {
|
(semver.valid(javaVersion) && semver.gte(javaVersion, '20.0.0'))) {
|
||||||
core.info(`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`);
|
core.info(`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`);
|
||||||
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
|
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
|
||||||
}
|
}
|
||||||
@@ -71380,17 +71427,25 @@ function run() {
|
|||||||
if (gdsToken.length > 0) {
|
if (gdsToken.length > 0) {
|
||||||
throw new Error('Downloading GraalVM EE dev builds is not supported');
|
throw new Error('Downloading GraalVM EE dev builds is not supported');
|
||||||
}
|
}
|
||||||
graalVMHome = yield graalvm.setUpGraalVMJDKDevBuild();
|
const coercedJavaVersion = semver.coerce(javaVersion);
|
||||||
|
if (coercedJavaVersion !== null &&
|
||||||
|
!semver.gte(coercedJavaVersion, '21.0.0')) {
|
||||||
|
core.warning(`GraalVM dev builds are only available for JDK 21. This build is now using a stable release of GraalVM for JDK ${javaVersion}.`);
|
||||||
|
graalVMHome = yield graalvm.setUpGraalVMJDK(javaVersion);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
graalVMHome = yield graalvm.setUpGraalVMJDKDevBuild();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
graalVMHome = yield (0, mandrel_1.setUpMandrel)(graalvmVersion, javaVersion);
|
graalVMHome = yield (0, mandrel_1.setUpMandrel)(graalVMVersion, javaVersion);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (enableCheckForUpdates) {
|
if (enableCheckForUpdates) {
|
||||||
yield (0, check_for_updates_1.checkForUpdates)(graalvmVersion, javaVersion);
|
(0, check_for_updates_1.checkForUpdates)(graalVMVersion, javaVersion);
|
||||||
}
|
}
|
||||||
graalVMHome = yield graalvm.setUpGraalVMRelease(gdsToken, graalvmVersion, javaVersion);
|
graalVMHome = yield graalvm.setUpGraalVMRelease(gdsToken, graalVMVersion, javaVersion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -71402,19 +71457,11 @@ function run() {
|
|||||||
if (setJavaHome) {
|
if (setJavaHome) {
|
||||||
core.exportVariable('JAVA_HOME', graalVMHome);
|
core.exportVariable('JAVA_HOME', graalVMHome);
|
||||||
}
|
}
|
||||||
// Set up GraalVM components (if any)
|
yield (0, gu_1.setUpGUComponents)(javaVersion, graalVMVersion, graalVMHome, components, gdsToken);
|
||||||
if (components.length > 0) {
|
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
|
||||||
core.warning(`Mandrel does not support GraalVM components: ${componentsString}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield (0, gu_1.setUpGUComponents)(gdsToken, graalVMHome, components);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cache && (0, cache_1.isFeatureAvailable)()) {
|
if (cache && (0, cache_1.isFeatureAvailable)()) {
|
||||||
yield (0, cache_2.restore)(cache);
|
yield (0, cache_2.restore)(cache);
|
||||||
}
|
}
|
||||||
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, graalvmVersion);
|
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, graalVMVersion);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error instanceof Error)
|
if (error instanceof Error)
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.2",
|
"version": "1.1.4",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.2",
|
"version": "1.1.4",
|
||||||
"license": "UPL",
|
"license": "UPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.0.4",
|
"@actions/cache": "^3.0.4",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.2",
|
"version": "1.1.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "GitHub Action for GraalVM",
|
"description": "GitHub Action for GraalVM",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
|
||||||
export async function checkForUpdates(
|
export function checkForUpdates(
|
||||||
graalVMVersion: string,
|
graalVMVersion: string,
|
||||||
javaVersion: string
|
javaVersion: string
|
||||||
): Promise<void> {
|
): void {
|
||||||
|
if (javaVersion === '20') {
|
||||||
|
core.notice(
|
||||||
|
'A new GraalVM release is available! Please consider upgrading to GraalVM for JDK 21: https://medium.com/graalvm/graalvm-for-jdk-21-is-here-ee01177dd12d'
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
graalVMVersion.length > 0 &&
|
graalVMVersion.length > 0 &&
|
||||||
(javaVersion === '17' || javaVersion === '19')
|
(javaVersion === '17' || javaVersion === '19')
|
||||||
) {
|
) {
|
||||||
const recommendedJDK = javaVersion === '17' ? '17' : '20'
|
const recommendedJDK = javaVersion === '17' ? '17' : '21'
|
||||||
core.notice(
|
core.notice(
|
||||||
`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`
|
`A new GraalVM release is available! Please consider upgrading to GraalVM for JDK ${recommendedJDK}. Instructions: https://github.com/graalvm/setup-graalvm#migrating-from-graalvm-223-or-earlier-to-the-new-graalvm-for-jdk-17-and-later`
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export async function downloadGraalVMEELegacy(
|
|||||||
version: string,
|
version: string,
|
||||||
javaVersion: string
|
javaVersion: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const userAgent = `GraalVMGitHubAction/1.1.2 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
const userAgent = `GraalVMGitHubAction/1.1.4 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
||||||
const baseArtifact = await fetchArtifact(
|
const baseArtifact = await fetchArtifact(
|
||||||
userAgent,
|
userAgent,
|
||||||
'isBase:True',
|
'isBase:True',
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ export async function setUpGraalVMLatest_22_X(
|
|||||||
gdsToken: string,
|
gdsToken: string,
|
||||||
javaVersion: string
|
javaVersion: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const lockedVersion = javaVersion === '19' ? '22.3.1' : '22.3.2'
|
const lockedVersion = javaVersion === '19' ? '22.3.1' : '22.3.3'
|
||||||
if (gdsToken.length > 0) {
|
if (gdsToken.length > 0) {
|
||||||
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
|
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
|
||||||
}
|
}
|
||||||
|
|||||||
38
src/gu.ts
38
src/gu.ts
@@ -1,6 +1,9 @@
|
|||||||
|
import * as c from './constants'
|
||||||
|
import * as core from '@actions/core'
|
||||||
import {GRAALVM_PLATFORM} from './constants'
|
import {GRAALVM_PLATFORM} from './constants'
|
||||||
import {exec} from './utils'
|
import {exec} from './utils'
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
|
import {gte as semverGte, valid as semverValid} from 'semver'
|
||||||
|
|
||||||
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']
|
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']
|
||||||
const COMPONENT_TO_POST_INSTALL_HOOK = new Map<string, Map<string, string>>([
|
const COMPONENT_TO_POST_INSTALL_HOOK = new Map<string, Map<string, string>>([
|
||||||
@@ -22,6 +25,41 @@ const COMPONENT_TO_POST_INSTALL_HOOK = new Map<string, Map<string, string>>([
|
|||||||
])
|
])
|
||||||
|
|
||||||
export async function setUpGUComponents(
|
export async function setUpGUComponents(
|
||||||
|
javaVersion: string,
|
||||||
|
graalVMVersion: string,
|
||||||
|
graalVMHome: string,
|
||||||
|
components: string[],
|
||||||
|
gdsToken: string
|
||||||
|
): Promise<void> {
|
||||||
|
if (components.length == 0) {
|
||||||
|
return // nothing to do
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
graalVMVersion === c.VERSION_DEV ||
|
||||||
|
javaVersion === c.VERSION_DEV ||
|
||||||
|
(semverValid(javaVersion) && semverGte(javaVersion, '21.0.0'))
|
||||||
|
) {
|
||||||
|
if (components.length == 1 && components[0] === 'native-image') {
|
||||||
|
core.warning(
|
||||||
|
`Please remove "components: 'native-image'" from your workflow file. It is automatically included since GraalVM for JDK 17: https://github.com/oracle/graal/pull/5995`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
core.warning(
|
||||||
|
`Unable to install component(s): '${components.join(
|
||||||
|
','
|
||||||
|
)}'. The latest GraalVM dev builds and the upcoming GraalVM for JDK 21 no longer include the GraalVM Updater: https://github.com/oracle/graal/issues/6855`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
|
core.warning(
|
||||||
|
`Mandrel does not support GraalVM component(s): '${components.join(',')}'`
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
await installGUComponents(gdsToken, graalVMHome, components)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installGUComponents(
|
||||||
gdsToken: string,
|
gdsToken: string,
|
||||||
graalVMHome: string,
|
graalVMHome: string,
|
||||||
components: string[]
|
components: string[]
|
||||||
|
|||||||
63
src/main.ts
63
src/main.ts
@@ -1,7 +1,7 @@
|
|||||||
import * as c from './constants'
|
import * as c from './constants'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as graalvm from './graalvm'
|
import * as graalvm from './graalvm'
|
||||||
import {gte as semverGte, valid as semverValid} from 'semver'
|
import * as semver from 'semver'
|
||||||
import {isFeatureAvailable as isCacheAvailable} from '@actions/cache'
|
import {isFeatureAvailable as isCacheAvailable} from '@actions/cache'
|
||||||
import {join} from 'path'
|
import {join} from 'path'
|
||||||
import {restore} from './features/cache'
|
import {restore} from './features/cache'
|
||||||
@@ -17,7 +17,7 @@ async function run(): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
|
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
|
||||||
const distribution = core.getInput(c.INPUT_DISTRIBUTION)
|
const distribution = core.getInput(c.INPUT_DISTRIBUTION)
|
||||||
const graalvmVersion = core.getInput(c.INPUT_VERSION)
|
const graalVMVersion = core.getInput(c.INPUT_VERSION)
|
||||||
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN)
|
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN)
|
||||||
const componentsString: string = core.getInput(c.INPUT_COMPONENTS)
|
const componentsString: string = core.getInput(c.INPUT_COMPONENTS)
|
||||||
const components: string[] =
|
const components: string[] =
|
||||||
@@ -31,7 +31,7 @@ async function run(): Promise<void> {
|
|||||||
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
|
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
|
||||||
|
|
||||||
if (c.IS_WINDOWS) {
|
if (c.IS_WINDOWS) {
|
||||||
setUpWindowsEnvironment(graalvmVersion)
|
setUpWindowsEnvironment(graalVMVersion)
|
||||||
}
|
}
|
||||||
await setUpDependencies(components)
|
await setUpDependencies(components)
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
@@ -40,9 +40,16 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
// Download GraalVM JDK
|
// Download GraalVM JDK
|
||||||
const isGraalVMforJDK17OrLater =
|
const isGraalVMforJDK17OrLater =
|
||||||
distribution.length > 0 || graalvmVersion.length == 0
|
distribution.length > 0 || graalVMVersion.length == 0
|
||||||
let graalVMHome
|
let graalVMHome
|
||||||
if (isGraalVMforJDK17OrLater) {
|
if (isGraalVMforJDK17OrLater) {
|
||||||
|
if (
|
||||||
|
enableCheckForUpdates &&
|
||||||
|
(distribution === c.DISTRIBUTION_GRAALVM ||
|
||||||
|
distribution === c.DISTRIBUTION_GRAALVM_COMMUNITY)
|
||||||
|
) {
|
||||||
|
checkForUpdates(graalVMVersion, javaVersion)
|
||||||
|
}
|
||||||
switch (distribution) {
|
switch (distribution) {
|
||||||
case c.DISTRIBUTION_GRAALVM:
|
case c.DISTRIBUTION_GRAALVM:
|
||||||
graalVMHome = await graalvm.setUpGraalVMJDK(javaVersion)
|
graalVMHome = await graalvm.setUpGraalVMJDK(javaVersion)
|
||||||
@@ -51,8 +58,8 @@ async function run(): Promise<void> {
|
|||||||
graalVMHome = await graalvm.setUpGraalVMJDKCE(javaVersion)
|
graalVMHome = await graalvm.setUpGraalVMJDKCE(javaVersion)
|
||||||
break
|
break
|
||||||
case c.DISTRIBUTION_MANDREL:
|
case c.DISTRIBUTION_MANDREL:
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
graalVMHome = await setUpMandrel(graalvmVersion, javaVersion)
|
graalVMHome = await setUpMandrel(graalVMVersion, javaVersion)
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Mandrel requires the 'version' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
|
`Mandrel requires the 'version' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
|
||||||
@@ -76,11 +83,11 @@ async function run(): Promise<void> {
|
|||||||
throw new Error(`Unsupported distribution: ${distribution}`)
|
throw new Error(`Unsupported distribution: ${distribution}`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (graalvmVersion) {
|
switch (graalVMVersion) {
|
||||||
case c.VERSION_LATEST:
|
case c.VERSION_LATEST:
|
||||||
if (
|
if (
|
||||||
javaVersion.startsWith('17') ||
|
javaVersion.startsWith('17') ||
|
||||||
(semverValid(javaVersion) && semverGte(javaVersion, '20'))
|
(semver.valid(javaVersion) && semver.gte(javaVersion, '20.0.0'))
|
||||||
) {
|
) {
|
||||||
core.info(
|
core.info(
|
||||||
`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
|
`This build is using the new Oracle GraalVM. To select a specific distribution, use the 'distribution' option (see https://github.com/graalvm/setup-graalvm/tree/main#options).`
|
||||||
@@ -99,18 +106,29 @@ async function run(): Promise<void> {
|
|||||||
'Downloading GraalVM EE dev builds is not supported'
|
'Downloading GraalVM EE dev builds is not supported'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
graalVMHome = await graalvm.setUpGraalVMJDKDevBuild()
|
const coercedJavaVersion = semver.coerce(javaVersion)
|
||||||
|
if (
|
||||||
|
coercedJavaVersion !== null &&
|
||||||
|
!semver.gte(coercedJavaVersion, '21.0.0')
|
||||||
|
) {
|
||||||
|
core.warning(
|
||||||
|
`GraalVM dev builds are only available for JDK 21. This build is now using a stable release of GraalVM for JDK ${javaVersion}.`
|
||||||
|
)
|
||||||
|
graalVMHome = await graalvm.setUpGraalVMJDK(javaVersion)
|
||||||
|
} else {
|
||||||
|
graalVMHome = await graalvm.setUpGraalVMJDKDevBuild()
|
||||||
|
}
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
if (graalVMVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
||||||
graalVMHome = await setUpMandrel(graalvmVersion, javaVersion)
|
graalVMHome = await setUpMandrel(graalVMVersion, javaVersion)
|
||||||
} else {
|
} else {
|
||||||
if (enableCheckForUpdates) {
|
if (enableCheckForUpdates) {
|
||||||
await checkForUpdates(graalvmVersion, javaVersion)
|
checkForUpdates(graalVMVersion, javaVersion)
|
||||||
}
|
}
|
||||||
graalVMHome = await graalvm.setUpGraalVMRelease(
|
graalVMHome = await graalvm.setUpGraalVMRelease(
|
||||||
gdsToken,
|
gdsToken,
|
||||||
graalvmVersion,
|
graalVMVersion,
|
||||||
javaVersion
|
javaVersion
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -126,21 +144,18 @@ async function run(): Promise<void> {
|
|||||||
core.exportVariable('JAVA_HOME', graalVMHome)
|
core.exportVariable('JAVA_HOME', graalVMHome)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up GraalVM components (if any)
|
await setUpGUComponents(
|
||||||
if (components.length > 0) {
|
javaVersion,
|
||||||
if (graalvmVersion.startsWith(c.MANDREL_NAMESPACE)) {
|
graalVMVersion,
|
||||||
core.warning(
|
graalVMHome,
|
||||||
`Mandrel does not support GraalVM components: ${componentsString}`
|
components,
|
||||||
)
|
gdsToken
|
||||||
} else {
|
)
|
||||||
await setUpGUComponents(gdsToken, graalVMHome, components)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cache && isCacheAvailable()) {
|
if (cache && isCacheAvailable()) {
|
||||||
await restore(cache)
|
await restore(cache)
|
||||||
}
|
}
|
||||||
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalvmVersion)
|
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) core.setFailed(error.message)
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user