Compare commits

..

12 Commits

Author SHA1 Message Date
Fabio Niephaus
3d7ab58c1d Bump version to 1.1.9. 2024-03-12 20:41:34 +01:00
Fabio Niephaus
d3f9e14fc3 Fix and test check for MSVC setup. 2024-03-12 17:01:21 +01:00
Fabio Niephaus
b03aef7455 Fix GraalVM for JDK 17+ detection in MSVC feature.
Fixes #88
2024-03-12 17:01:21 +01:00
Fabio Niephaus
5393c3d809 Use -version on JDK 8. Fixes #86 2024-02-23 08:45:57 +01:00
Fabio Niephaus
e878075a91 Bump version to 1.1.8. 2024-02-22 13:17:14 +01:00
Fabio Niephaus
9a425fb910 Report java --version when done.
Fixes #81
2024-02-22 13:17:14 +01:00
Fabio Niephaus
7652cc43b3 Disable MSVC feature for javaVersion gte 18.
Fixes #32.
2024-02-22 13:17:14 +01:00
Fabio Niephaus
a2b35c9a1c Turn descriptions for versions & distros into list.
[ci skip]
2024-02-22 13:17:14 +01:00
Fabio Niephaus
791f27b2b8 Document support for Oracle GraalVM EA builds.
[ci skip]
2024-02-22 13:17:14 +01:00
Fabio Niephaus
f6947ecb49 Derive javaVersion from downloadUrl.
This ensures that `latest-ea` and `22-ea` can be cached based on the actual version number (e.g., `22.0.0`).
2024-02-22 13:17:14 +01:00
Fabio Niephaus
cb063c121c Use new Oracle GraalVM EA builds repo. 2024-02-22 13:17:14 +01:00
dependabot[bot]
076347913e Bump undici from 5.28.2 to 5.28.3
Bumps [undici](https://github.com/nodejs/undici) from 5.28.2 to 5.28.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.2...v5.28.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-19 09:32:54 +01:00
8 changed files with 97 additions and 38 deletions

View File

@@ -102,8 +102,12 @@ jobs:
java-version: '17'
components: 'native-image'
os: ubuntu-20.04
- version: '21.2.0'
java-version: '8' # for JDK 8 notification
components: 'native-image'
os: ubuntu-latest
- version: '22.3.1'
java-version: '11' # for JDK11 notification
java-version: '11' # for JDK 11 notification
components: 'native-image'
os: macos-11
- version: '22.3.1'
@@ -132,8 +136,8 @@ jobs:
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
fi
echo "JAVA_HOME: $JAVA_HOME"
java --version
java --version | grep "GraalVM" || exit 34
java -version
java -version 2>&1 | grep "GraalVM" || exit 34
native-image --version
if [[ "${{ matrix.java-version }}" != "dev" ]]; then
gu list
@@ -143,7 +147,7 @@ jobs:
run: |
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
echo "JAVA_HOME: $env:JAVA_HOME"
java --version
java -version
native-image --version
gu.cmd remove native-image
if: runner.os == 'Windows'

36
__tests__/msvc.test.ts Normal file
View File

@@ -0,0 +1,36 @@
import * as path from 'path'
import {expect, test} from '@jest/globals'
import {needsWindowsEnvironmentSetup} from '../src/msvc'
import {VERSION_DEV, VERSION_LATEST} from '../src/constants'
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('decide whether Window env must be set up for GraalVM for JDK', async () => {
for (var javaVersion of [
'17',
'17.0.8',
'17.0',
'21',
'22',
'22-ea',
'23-ea',
VERSION_DEV
]) {
expect(needsWindowsEnvironmentSetup(javaVersion, '', true)).toBe(false)
}
})
test('decide whether Window env must be set up for legacy GraalVM', async () => {
for (var combination of [
['7', '22.3.0'],
['17', '22.3'],
['7', '22.3'],
['7', VERSION_DEV],
['17', VERSION_LATEST]
]) {
expect(
needsWindowsEnvironmentSetup(combination[0], combination[1], false)
).toBe(combination[1] !== VERSION_DEV)
}
})

31
dist/main/index.js generated vendored
View File

@@ -93661,7 +93661,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.1.8 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
const userAgent = `GraalVMGitHubAction/1.1.9 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
const baseArtifact = yield fetchArtifact(userAgent, 'isBase:True', version, javaVersion);
return downloadArtifact(gdsToken, userAgent, baseArtifact);
});
@@ -94270,15 +94270,15 @@ function run() {
const cache = core.getInput(c.INPUT_CACHE);
const enableCheckForUpdates = core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true';
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true';
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0;
if (c.IS_WINDOWS) {
(0, msvc_1.setUpWindowsEnvironment)(javaVersion, graalVMVersion);
(0, msvc_1.setUpWindowsEnvironment)(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater);
}
yield (0, dependencies_1.setUpDependencies)(components);
if (enableNativeImageMusl) {
yield (0, musl_1.setUpNativeImageMusl)();
}
// Download GraalVM JDK
const isGraalVMforJDK17OrLater = distribution.length > 0 || graalVMVersion.length == 0;
let graalVMHome;
if (isGraalVMforJDK17OrLater) {
if (enableCheckForUpdates &&
@@ -94364,7 +94364,7 @@ function run() {
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, 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}`), [
'--version'
javaVersion.startsWith('8') ? '-version' : '--version'
]);
core.endGroup();
}
@@ -94570,9 +94570,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setUpWindowsEnvironment = void 0;
exports.setUpWindowsEnvironment = exports.needsWindowsEnvironmentSetup = void 0;
const core = __importStar(__nccwpck_require__(2186));
const semver = __importStar(__nccwpck_require__(1383));
const child_process_1 = __nccwpck_require__(2081);
const fs_1 = __nccwpck_require__(7147);
const constants_1 = __nccwpck_require__(9042);
@@ -94596,15 +94595,19 @@ function findVcvarsallPath() {
}
throw new Error('Failed to find vcvarsall.bat');
}
function setUpWindowsEnvironment(javaVersion, graalVMVersion) {
if (javaVersion === javaVersion || graalVMVersion === constants_1.VERSION_DEV) {
return; // no longer required in dev builds
function needsWindowsEnvironmentSetup(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater) {
if (javaVersion === constants_1.VERSION_DEV || graalVMVersion === constants_1.VERSION_DEV) {
return false; // no longer required in dev builds
}
const javaVersionSemVer = semver.coerce(javaVersion);
if (javaVersionSemVer &&
semver.valid(javaVersionSemVer) &&
semver.gte(javaVersionSemVer, '18.0.0')) {
return; // no longer required in GraalVM for JDK 17 and later. JDK 17 builds from 22.3 still need this, so skip 17.X.X
else if (isGraalVMforJDK17OrLater) {
return false; // no longer required in GraalVM for JDK 17 and later.
}
return true;
}
exports.needsWindowsEnvironmentSetup = needsWindowsEnvironmentSetup;
function setUpWindowsEnvironment(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater) {
if (!needsWindowsEnvironmentSetup(javaVersion, graalVMVersion, isGraalVMforJDK17OrLater)) {
return;
}
core.startGroup('Updating Windows environment...');
const vcvarsallPath = findVcvarsallPath();

10
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "setup-graalvm",
"version": "1.1.8",
"version": "1.1.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-graalvm",
"version": "1.1.8",
"version": "1.1.9",
"license": "UPL",
"dependencies": {
"@actions/cache": "^3.2.3",
@@ -7323,9 +7323,9 @@
}
},
"node_modules/undici": {
"version": "5.28.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz",
"integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==",
"version": "5.28.3",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
"integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},

View File

@@ -1,6 +1,6 @@
{
"name": "setup-graalvm",
"version": "1.1.8",
"version": "1.1.9",
"private": true,
"description": "GitHub Action for GraalVM",
"main": "lib/main.js",

View File

@@ -31,7 +31,7 @@ export async function downloadGraalVMEELegacy(
version: string,
javaVersion: string
): Promise<string> {
const userAgent = `GraalVMGitHubAction/1.1.8 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
const userAgent = `GraalVMGitHubAction/1.1.9 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
const baseArtifact = await fetchArtifact(
userAgent,
'isBase:True',

View File

@@ -30,9 +30,15 @@ async function run(): Promise<void> {
const enableCheckForUpdates =
core.getInput(c.INPUT_CHECK_FOR_UPDATES) === 'true'
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
const isGraalVMforJDK17OrLater =
distribution.length > 0 || graalVMVersion.length == 0
if (c.IS_WINDOWS) {
setUpWindowsEnvironment(javaVersion, graalVMVersion)
setUpWindowsEnvironment(
javaVersion,
graalVMVersion,
isGraalVMforJDK17OrLater
)
}
await setUpDependencies(components)
if (enableNativeImageMusl) {
@@ -40,8 +46,6 @@ async function run(): Promise<void> {
}
// Download GraalVM JDK
const isGraalVMforJDK17OrLater =
distribution.length > 0 || graalVMVersion.length == 0
let graalVMHome
if (isGraalVMforJDK17OrLater) {
if (
@@ -155,7 +159,7 @@ async function run(): Promise<void> {
core.startGroup(`Successfully set up '${basename(graalVMHome)}'`)
await exec(join(graalVMHome, 'bin', `java${c.EXECUTABLE_SUFFIX}`), [
'--version'
javaVersion.startsWith('8') ? '-version' : '--version'
])
core.endGroup()
} catch (error) {

View File

@@ -28,20 +28,32 @@ function findVcvarsallPath(): string {
throw new Error('Failed to find vcvarsall.bat')
}
export function needsWindowsEnvironmentSetup(
javaVersion: string,
graalVMVersion: string,
isGraalVMforJDK17OrLater: boolean
): boolean {
if (javaVersion === VERSION_DEV || graalVMVersion === VERSION_DEV) {
return false // no longer required in dev builds
} else if (isGraalVMforJDK17OrLater) {
return false // no longer required in GraalVM for JDK 17 and later.
}
return true
}
export function setUpWindowsEnvironment(
javaVersion: string,
graalVMVersion: string
graalVMVersion: string,
isGraalVMforJDK17OrLater: boolean
): void {
if (javaVersion === javaVersion || graalVMVersion === VERSION_DEV) {
return // no longer required in dev builds
}
const javaVersionSemVer = semver.coerce(javaVersion)
if (
javaVersionSemVer &&
semver.valid(javaVersionSemVer) &&
semver.gte(javaVersionSemVer, '18.0.0')
!needsWindowsEnvironmentSetup(
javaVersion,
graalVMVersion,
isGraalVMforJDK17OrLater
)
) {
return // no longer required in GraalVM for JDK 17 and later. JDK 17 builds from 22.3 still need this, so skip 17.X.X
return
}
core.startGroup('Updating Windows environment...')