Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f25c0caae | ||
|
|
ee8b81f45c | ||
|
|
3e1010f34c | ||
|
|
fb9f5a0734 |
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: ['21', '17', '20', 'dev']
|
||||
java-version: ['22', '21', '17', '20', 'dev']
|
||||
distribution: ['graalvm', 'graalvm-community']
|
||||
os: [
|
||||
ubuntu-latest,
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- java-version: 'latest-ea'
|
||||
distribution: 'graalvm'
|
||||
os: ubuntu-latest
|
||||
- java-version: '22-ea'
|
||||
- java-version: '23-ea'
|
||||
distribution: 'graalvm'
|
||||
os: ubuntu-latest
|
||||
- java-version: '21'
|
||||
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '22-ea' # or 'latest-ea' for the latest Java version available
|
||||
java-version: '23-ea' # or 'latest-ea' for the latest Java version available
|
||||
distribution: 'graalvm'
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
42
dist/cleanup/index.js
generated
vendored
42
dist/cleanup/index.js
generated
vendored
@@ -90553,10 +90553,10 @@ const c = __importStar(__nccwpck_require__(9042));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
const semver = __importStar(__nccwpck_require__(1383));
|
||||
const path_1 = __nccwpck_require__(1017);
|
||||
const os_1 = __nccwpck_require__(2037);
|
||||
const utils_1 = __nccwpck_require__(1314);
|
||||
const semver_1 = __nccwpck_require__(1383);
|
||||
const BUILD_OUTPUT_JSON_PATH = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-build-output.json');
|
||||
const BYTES_TO_KiB = 1024;
|
||||
const BYTES_TO_MiB = 1024 * 1024;
|
||||
@@ -90565,8 +90565,9 @@ const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-ma
|
||||
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
||||
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
||||
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
||||
const NATIVE_IMAGE_OPTIONS_ENV = 'NATIVE_IMAGE_OPTIONS';
|
||||
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, javaVersionOrDev, graalVMVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const isRequired = areJobReportsEnabled() || arePRReportsEnabled();
|
||||
if (!isRequired) {
|
||||
@@ -90576,12 +90577,12 @@ function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
||||
graalVMVersion === c.VERSION_LATEST ||
|
||||
graalVMVersion === c.VERSION_DEV ||
|
||||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
|
||||
(0, semver_1.gte)((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
|
||||
semver.gte((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
|
||||
if (!isSupported) {
|
||||
core.warning(`Build reports for PRs and job summaries are only available in GraalVM 22.2.0 or later. This build job uses GraalVM ${graalVMVersion}.`);
|
||||
return;
|
||||
}
|
||||
setNativeImageOption(`-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`); // Escape backslashes for Windows
|
||||
setNativeImageOption(javaVersionOrDev, `-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`); // Escape backslashes for Windows
|
||||
});
|
||||
}
|
||||
exports.setUpNativeImageBuildReports = setUpNativeImageBuildReports;
|
||||
@@ -90611,6 +90612,30 @@ function areJobReportsEnabled() {
|
||||
function arePRReportsEnabled() {
|
||||
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
||||
}
|
||||
function setNativeImageOption(javaVersionOrDev, optionValue) {
|
||||
const coercedJavaVersionOrDev = semver.coerce(javaVersionOrDev);
|
||||
if ((coercedJavaVersionOrDev &&
|
||||
semver.gte(coercedJavaVersionOrDev, '22.0.0')) ||
|
||||
javaVersionOrDev === c.VERSION_DEV ||
|
||||
javaVersionOrDev.endsWith('-ea')) {
|
||||
/* NATIVE_IMAGE_OPTIONS was introduced in GraalVM for JDK 22 (so were EA builds). */
|
||||
let newOptionValue = optionValue;
|
||||
const existingOptions = process.env[NATIVE_IMAGE_OPTIONS_ENV];
|
||||
if (existingOptions) {
|
||||
newOptionValue = `${existingOptions} ${newOptionValue}`;
|
||||
}
|
||||
core.exportVariable(NATIVE_IMAGE_OPTIONS_ENV, newOptionValue);
|
||||
}
|
||||
else {
|
||||
const optionsFile = getNativeImageOptionsFile();
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${optionValue}`);
|
||||
}
|
||||
else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${optionValue}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getNativeImageOptionsFile() {
|
||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
||||
if (optionsFile === undefined) {
|
||||
@@ -90619,15 +90644,6 @@ function getNativeImageOptionsFile() {
|
||||
}
|
||||
return optionsFile;
|
||||
}
|
||||
function setNativeImageOption(value) {
|
||||
const optionsFile = getNativeImageOptionsFile();
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${value}`);
|
||||
}
|
||||
else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${value}`);
|
||||
}
|
||||
}
|
||||
function createReport(data) {
|
||||
const context = github.context;
|
||||
const info = data.general_info;
|
||||
|
||||
46
dist/main/index.js
generated
vendored
46
dist/main/index.js
generated
vendored
@@ -91333,10 +91333,10 @@ const c = __importStar(__nccwpck_require__(9042));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
const semver = __importStar(__nccwpck_require__(1383));
|
||||
const path_1 = __nccwpck_require__(1017);
|
||||
const os_1 = __nccwpck_require__(2037);
|
||||
const utils_1 = __nccwpck_require__(1314);
|
||||
const semver_1 = __nccwpck_require__(1383);
|
||||
const BUILD_OUTPUT_JSON_PATH = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-build-output.json');
|
||||
const BYTES_TO_KiB = 1024;
|
||||
const BYTES_TO_MiB = 1024 * 1024;
|
||||
@@ -91345,8 +91345,9 @@ const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-ma
|
||||
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
||||
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
||||
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
||||
const NATIVE_IMAGE_OPTIONS_ENV = 'NATIVE_IMAGE_OPTIONS';
|
||||
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, javaVersionOrDev, graalVMVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const isRequired = areJobReportsEnabled() || arePRReportsEnabled();
|
||||
if (!isRequired) {
|
||||
@@ -91356,12 +91357,12 @@ function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
||||
graalVMVersion === c.VERSION_LATEST ||
|
||||
graalVMVersion === c.VERSION_DEV ||
|
||||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
|
||||
(0, semver_1.gte)((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
|
||||
semver.gte((0, utils_1.toSemVer)(graalVMVersion), '22.2.0'));
|
||||
if (!isSupported) {
|
||||
core.warning(`Build reports for PRs and job summaries are only available in GraalVM 22.2.0 or later. This build job uses GraalVM ${graalVMVersion}.`);
|
||||
return;
|
||||
}
|
||||
setNativeImageOption(`-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`); // Escape backslashes for Windows
|
||||
setNativeImageOption(javaVersionOrDev, `-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`); // Escape backslashes for Windows
|
||||
});
|
||||
}
|
||||
exports.setUpNativeImageBuildReports = setUpNativeImageBuildReports;
|
||||
@@ -91391,6 +91392,30 @@ function areJobReportsEnabled() {
|
||||
function arePRReportsEnabled() {
|
||||
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
||||
}
|
||||
function setNativeImageOption(javaVersionOrDev, optionValue) {
|
||||
const coercedJavaVersionOrDev = semver.coerce(javaVersionOrDev);
|
||||
if ((coercedJavaVersionOrDev &&
|
||||
semver.gte(coercedJavaVersionOrDev, '22.0.0')) ||
|
||||
javaVersionOrDev === c.VERSION_DEV ||
|
||||
javaVersionOrDev.endsWith('-ea')) {
|
||||
/* NATIVE_IMAGE_OPTIONS was introduced in GraalVM for JDK 22 (so were EA builds). */
|
||||
let newOptionValue = optionValue;
|
||||
const existingOptions = process.env[NATIVE_IMAGE_OPTIONS_ENV];
|
||||
if (existingOptions) {
|
||||
newOptionValue = `${existingOptions} ${newOptionValue}`;
|
||||
}
|
||||
core.exportVariable(NATIVE_IMAGE_OPTIONS_ENV, newOptionValue);
|
||||
}
|
||||
else {
|
||||
const optionsFile = getNativeImageOptionsFile();
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${optionValue}`);
|
||||
}
|
||||
else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${optionValue}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
function getNativeImageOptionsFile() {
|
||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
||||
if (optionsFile === undefined) {
|
||||
@@ -91399,15 +91424,6 @@ function getNativeImageOptionsFile() {
|
||||
}
|
||||
return optionsFile;
|
||||
}
|
||||
function setNativeImageOption(value) {
|
||||
const optionsFile = getNativeImageOptionsFile();
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${value}`);
|
||||
}
|
||||
else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${value}`);
|
||||
}
|
||||
}
|
||||
function createReport(data) {
|
||||
const context = github.context;
|
||||
const info = data.general_info;
|
||||
@@ -91690,7 +91706,7 @@ const assert_1 = __nccwpck_require__(9491);
|
||||
const uuid_1 = __nccwpck_require__(5840);
|
||||
function downloadGraalVMEELegacy(gdsToken, version, javaVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const userAgent = `GraalVMGitHubAction/1.2.0 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
||||
const userAgent = `GraalVMGitHubAction/1.2.1 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
||||
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
|
||||
return downloadArtifact(gdsToken, userAgent, baseArtifact);
|
||||
});
|
||||
@@ -92524,7 +92540,7 @@ function run() {
|
||||
if (cache && (0, cache_1.isFeatureAvailable)()) {
|
||||
yield (0, cache_2.restore)(cache);
|
||||
}
|
||||
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, graalVMVersion);
|
||||
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, javaVersion, graalVMVersion);
|
||||
core.startGroup(`Successfully set up '${(0, path_1.basename)(graalVMHome)}'`);
|
||||
yield (0, exec_1.exec)((0, path_1.join)(graalVMHome, 'bin', `java${c.EXECUTABLE_SUFFIX}`), [
|
||||
javaVersion.startsWith('8') ? '-version' : '--version'
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "setup-graalvm",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "setup-graalvm",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"license": "UPL",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.2.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "setup-graalvm",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"private": true,
|
||||
"description": "GitHub Action for GraalVM",
|
||||
"main": "lib/main.js",
|
||||
|
||||
@@ -2,10 +2,10 @@ import * as c from '../constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as github from '@actions/github'
|
||||
import * as semver from 'semver'
|
||||
import {join} from 'path'
|
||||
import {tmpdir} from 'os'
|
||||
import {createPRComment, isPREvent, toSemVer} from '../utils'
|
||||
import {gte} from 'semver'
|
||||
|
||||
const BUILD_OUTPUT_JSON_PATH = join(tmpdir(), 'native-image-build-output.json')
|
||||
const BYTES_TO_KiB = 1024
|
||||
@@ -19,6 +19,7 @@ const NATIVE_IMAGE_CONFIG_FILE = join(
|
||||
tmpdir(),
|
||||
'native-image-options.properties'
|
||||
)
|
||||
const NATIVE_IMAGE_OPTIONS_ENV = 'NATIVE_IMAGE_OPTIONS'
|
||||
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE'
|
||||
|
||||
interface AnalysisResult {
|
||||
@@ -91,6 +92,7 @@ interface BuildOutput {
|
||||
|
||||
export async function setUpNativeImageBuildReports(
|
||||
isGraalVMforJDK17OrLater: boolean,
|
||||
javaVersionOrDev: string,
|
||||
graalVMVersion: string
|
||||
): Promise<void> {
|
||||
const isRequired = areJobReportsEnabled() || arePRReportsEnabled()
|
||||
@@ -102,7 +104,7 @@ export async function setUpNativeImageBuildReports(
|
||||
graalVMVersion === c.VERSION_LATEST ||
|
||||
graalVMVersion === c.VERSION_DEV ||
|
||||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
|
||||
gte(toSemVer(graalVMVersion), '22.2.0'))
|
||||
semver.gte(toSemVer(graalVMVersion), '22.2.0'))
|
||||
if (!isSupported) {
|
||||
core.warning(
|
||||
`Build reports for PRs and job summaries are only available in GraalVM 22.2.0 or later. This build job uses GraalVM ${graalVMVersion}.`
|
||||
@@ -110,6 +112,7 @@ export async function setUpNativeImageBuildReports(
|
||||
return
|
||||
}
|
||||
setNativeImageOption(
|
||||
javaVersionOrDev,
|
||||
`-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`
|
||||
) // Escape backslashes for Windows
|
||||
}
|
||||
@@ -144,6 +147,34 @@ function arePRReportsEnabled(): boolean {
|
||||
return isPREvent() && core.getInput(INPUT_NI_PR_REPORTS) === 'true'
|
||||
}
|
||||
|
||||
function setNativeImageOption(
|
||||
javaVersionOrDev: string,
|
||||
optionValue: string
|
||||
): void {
|
||||
const coercedJavaVersionOrDev = semver.coerce(javaVersionOrDev)
|
||||
if (
|
||||
(coercedJavaVersionOrDev &&
|
||||
semver.gte(coercedJavaVersionOrDev, '22.0.0')) ||
|
||||
javaVersionOrDev === c.VERSION_DEV ||
|
||||
javaVersionOrDev.endsWith('-ea')
|
||||
) {
|
||||
/* NATIVE_IMAGE_OPTIONS was introduced in GraalVM for JDK 22 (so were EA builds). */
|
||||
let newOptionValue = optionValue
|
||||
const existingOptions = process.env[NATIVE_IMAGE_OPTIONS_ENV]
|
||||
if (existingOptions) {
|
||||
newOptionValue = `${existingOptions} ${newOptionValue}`
|
||||
}
|
||||
core.exportVariable(NATIVE_IMAGE_OPTIONS_ENV, newOptionValue)
|
||||
} else {
|
||||
const optionsFile = getNativeImageOptionsFile()
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${optionValue}`)
|
||||
} else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${optionValue}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNativeImageOptionsFile(): string {
|
||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV]
|
||||
if (optionsFile === undefined) {
|
||||
@@ -153,15 +184,6 @@ function getNativeImageOptionsFile(): string {
|
||||
return optionsFile
|
||||
}
|
||||
|
||||
function setNativeImageOption(value: string): void {
|
||||
const optionsFile = getNativeImageOptionsFile()
|
||||
if (fs.existsSync(optionsFile)) {
|
||||
fs.appendFileSync(optionsFile, ` ${value}`)
|
||||
} else {
|
||||
fs.writeFileSync(optionsFile, `NativeImageArgs = ${value}`)
|
||||
}
|
||||
}
|
||||
|
||||
function createReport(data: BuildOutput): string {
|
||||
const context = github.context
|
||||
const info = data.general_info
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function downloadGraalVMEELegacy(
|
||||
version: string,
|
||||
javaVersion: string
|
||||
): Promise<string> {
|
||||
const userAgent = `GraalVMGitHubAction/1.2.0 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
||||
const userAgent = `GraalVMGitHubAction/1.2.1 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
||||
const baseArtifact = await fetchArtifact(
|
||||
userAgent,
|
||||
'isBase:True',
|
||||
|
||||
@@ -160,7 +160,11 @@ async function run(): Promise<void> {
|
||||
if (cache && isCacheAvailable()) {
|
||||
await restore(cache)
|
||||
}
|
||||
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
||||
setUpNativeImageBuildReports(
|
||||
isGraalVMforJDK17OrLater,
|
||||
javaVersion,
|
||||
graalVMVersion
|
||||
)
|
||||
|
||||
core.startGroup(`Successfully set up '${basename(graalVMHome)}'`)
|
||||
await exec(join(graalVMHome, 'bin', `java${c.EXECUTABLE_SUFFIX}`), [
|
||||
|
||||
Reference in New Issue
Block a user