mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-01-18 19:26:39 +08:00
Use java-package
input instead of version
This commit is contained in:
parent
6670574f7f
commit
30261a858e
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -245,12 +245,12 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
test-liberica:
|
||||
needs: test
|
||||
name: Liberica (${{ matrix.java-version }}, '${{ matrix.version }}', ${{ matrix.os }})
|
||||
name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: ['17', '21.0.2']
|
||||
version: ['', 'std', 'full']
|
||||
java-package: ['', 'jdk', 'jdk+fx']
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -259,7 +259,7 @@ jobs:
|
||||
with:
|
||||
distribution: liberica
|
||||
java-version: ${{ matrix.java-version }}
|
||||
version: ${{ matrix.version }}
|
||||
java-package: ${{ matrix.java-package }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Check environment
|
||||
run: |
|
||||
|
@ -189,6 +189,7 @@ can be replaced with:
|
||||
|-----------------|:--------:|-------------|
|
||||
| `java-version`<br>*(required)* | n/a | Java version <ul><li>major versions: `'21'`, `'17'`, `'11'`, `'8'`</li><li>specific versions: `'21.0.2'`, `'17.0.7'`</li><li>early access (EA) builds: `'22-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'`</li></ul> |
|
||||
| `distribution` | `'graalvm'` | GraalVM distribution <ul><li>Oracle GraalVM: `'graalvm'`</li><li>GraalVM Community Edition: `'graalvm-community'`</li><li>Mandrel: `'mandrel'`</li><li>Liberica: `'liberica'`</li></ul> |
|
||||
| `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. |
|
||||
| `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`. |
|
||||
| `cache` | `''` | Name of the build platform to cache dependencies. Turned off by default (`''`). It can also be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
|
||||
@ -197,7 +198,7 @@ can be replaced with:
|
||||
| `native-image-job-reports` *) | `'false'` | If set to `'true'`, post a job summary containing a Native Image build report. |
|
||||
| `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]. |
|
||||
| `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
|
||||
| `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, <br>`std` (default) or `full` for Liberica|
|
||||
| `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. |
|
||||
| `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)). |
|
||||
|
||||
**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*
|
||||
|
@ -37,13 +37,13 @@ test('find latest JDK version', async () => {
|
||||
|
||||
test('find asset URL', async () => {
|
||||
await expectURL('11.0.22+12', '', 'bellsoft-liberica-vm-openjdk11.0.22')
|
||||
await expectURL('17.0.10+13', 'std', 'bellsoft-liberica-vm-openjdk17.0.10')
|
||||
await expectURL('17.0.10+13', 'jdk', 'bellsoft-liberica-vm-openjdk17.0.10')
|
||||
|
||||
if (!c.IS_LINUX) {
|
||||
// This check can fail on Linux because there's no `full` version for aarch64 and/or musl
|
||||
// This check can fail on Linux because there's no `jdk+fx` package for aarch64 and/or musl
|
||||
await expectURL(
|
||||
'21.0.2+14',
|
||||
'full',
|
||||
'jdk+fx',
|
||||
'bellsoft-liberica-vm-full-openjdk21.0.2'
|
||||
)
|
||||
}
|
||||
@ -127,10 +127,10 @@ async function expectLatestToFail(pattern: string) {
|
||||
|
||||
async function expectURL(
|
||||
javaVersion: string,
|
||||
version: string,
|
||||
javaPackage: string,
|
||||
expectedPrefix: string
|
||||
) {
|
||||
const url = await liberica.findLibericaURL(javaVersion, version)
|
||||
const url = await liberica.findLibericaURL(javaVersion, javaPackage)
|
||||
expect(url).toBeDefined()
|
||||
const parts = url.split('/')
|
||||
const file = parts[parts.length - 1]
|
||||
|
@ -8,6 +8,10 @@ inputs:
|
||||
java-version:
|
||||
required: true
|
||||
description: 'Java version. See examples of supported syntax in the README file.'
|
||||
java-package:
|
||||
description: 'The package type (jdk or jdk+fx). Currently applies to Liberica only.'
|
||||
required: false
|
||||
default: 'jdk'
|
||||
distribution:
|
||||
description: 'GraalVM distribution. See the list of available distributions in the README file.'
|
||||
required: false
|
||||
|
3
dist/cleanup/index.js
generated
vendored
3
dist/cleanup/index.js
generated
vendored
@ -92175,10 +92175,11 @@ else {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
|
||||
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
|
||||
exports.INPUT_VERSION = 'version';
|
||||
exports.INPUT_GDS_TOKEN = 'gds-token';
|
||||
exports.INPUT_JAVA_VERSION = 'java-version';
|
||||
exports.INPUT_JAVA_PACKAGE = 'java-package';
|
||||
exports.INPUT_DISTRIBUTION = 'distribution';
|
||||
exports.INPUT_COMPONENTS = 'components';
|
||||
exports.INPUT_GITHUB_TOKEN = 'github-token';
|
||||
|
26
dist/main/index.js
generated
vendored
26
dist/main/index.js
generated
vendored
@ -92741,10 +92741,11 @@ function wrappy (fn, cb) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
|
||||
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0;
|
||||
exports.INPUT_VERSION = 'version';
|
||||
exports.INPUT_GDS_TOKEN = 'gds-token';
|
||||
exports.INPUT_JAVA_VERSION = 'java-version';
|
||||
exports.INPUT_JAVA_PACKAGE = 'java-package';
|
||||
exports.INPUT_DISTRIBUTION = 'distribution';
|
||||
exports.INPUT_COMPONENTS = 'components';
|
||||
exports.INPUT_GITHUB_TOKEN = 'github-token';
|
||||
@ -94254,11 +94255,11 @@ const LIBERICA_GH_USER = 'bell-sw';
|
||||
const LIBERICA_RELEASES_REPO = 'LibericaNIK';
|
||||
const LIBERICA_JDK_TAG_PREFIX = 'jdk-';
|
||||
const LIBERICA_VM_PREFIX = 'bellsoft-liberica-vm-';
|
||||
function setUpLiberica(javaVersion, version) {
|
||||
function setUpLiberica(javaVersion, javaPackage) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const resolvedJavaVersion = yield findLatestLibericaJavaVersion(javaVersion);
|
||||
const downloadUrl = yield findLibericaURL(resolvedJavaVersion, version);
|
||||
const toolName = determineToolName(javaVersion, version);
|
||||
const downloadUrl = yield findLibericaURL(resolvedJavaVersion, javaPackage);
|
||||
const toolName = determineToolName(javaVersion, javaPackage);
|
||||
return (0, utils_1.downloadExtractAndCacheJDK)(() => __awaiter(this, void 0, void 0, function* () { return (0, tool_cache_1.downloadTool)(downloadUrl); }), toolName, javaVersion);
|
||||
});
|
||||
}
|
||||
@ -94287,11 +94288,11 @@ function findLatestLibericaJavaVersion(javaVersion) {
|
||||
});
|
||||
}
|
||||
exports.findLatestLibericaJavaVersion = findLatestLibericaJavaVersion;
|
||||
function findLibericaURL(javaVersion, version) {
|
||||
function findLibericaURL(javaVersion, javaPackage) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const release = yield (0, utils_1.getTaggedRelease)(LIBERICA_GH_USER, LIBERICA_RELEASES_REPO, LIBERICA_JDK_TAG_PREFIX + javaVersion);
|
||||
const platform = determinePlatformPart();
|
||||
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineToolVersionPart(version)}openjdk${javaVersion}`;
|
||||
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineVariantPart(javaPackage)}openjdk${javaVersion}`;
|
||||
const assetSuffix = `-${platform}${c.GRAALVM_FILE_EXTENSION}`;
|
||||
for (const asset of release.assets) {
|
||||
if (asset.name.startsWith(assetPrefix) &&
|
||||
@ -94299,15 +94300,17 @@ function findLibericaURL(javaVersion, version) {
|
||||
return asset.browser_download_url;
|
||||
}
|
||||
}
|
||||
throw new Error(`Unable to find asset for java-version: ${javaVersion}, version: ${version}, platform: ${platform}`);
|
||||
throw new Error(`Unable to find asset for java-version: ${javaVersion}, java-package: ${javaPackage}, platform: ${platform}`);
|
||||
});
|
||||
}
|
||||
exports.findLibericaURL = findLibericaURL;
|
||||
function determineToolVersionPart(version) {
|
||||
return version === 'std' || version === '' ? '' : `${version}-`;
|
||||
function determineToolName(javaVersion, javaPackage) {
|
||||
const variant = determineVariantPart(javaPackage);
|
||||
const platform = determinePlatformPart();
|
||||
return `${LIBERICA_VM_PREFIX}${variant}openjdk${javaVersion}-${platform}`;
|
||||
}
|
||||
function determineToolName(javaVersion, version) {
|
||||
return `${LIBERICA_VM_PREFIX}${determineToolVersionPart(version)}openjdk${javaVersion}-${determinePlatformPart()}`;
|
||||
function determineVariantPart(javaPackage) {
|
||||
return javaPackage !== null && javaPackage.includes('+fx') ? 'full-' : '';
|
||||
}
|
||||
function determinePlatformPart() {
|
||||
if (isMuslBasedLinux()) {
|
||||
@ -94391,6 +94394,7 @@ function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, { required: true });
|
||||
const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE);
|
||||
const distribution = core.getInput(c.INPUT_DISTRIBUTION);
|
||||
const graalVMVersion = core.getInput(c.INPUT_VERSION);
|
||||
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN);
|
||||
|
@ -3,6 +3,7 @@ import * as otypes from '@octokit/types'
|
||||
export const INPUT_VERSION = 'version'
|
||||
export const INPUT_GDS_TOKEN = 'gds-token'
|
||||
export const INPUT_JAVA_VERSION = 'java-version'
|
||||
export const INPUT_JAVA_PACKAGE = 'java-package'
|
||||
export const INPUT_DISTRIBUTION = 'distribution'
|
||||
export const INPUT_COMPONENTS = 'components'
|
||||
export const INPUT_GITHUB_TOKEN = 'github-token'
|
||||
|
@ -15,11 +15,11 @@ const LIBERICA_VM_PREFIX = 'bellsoft-liberica-vm-'
|
||||
|
||||
export async function setUpLiberica(
|
||||
javaVersion: string,
|
||||
version: string
|
||||
javaPackage: string
|
||||
): Promise<string> {
|
||||
const resolvedJavaVersion = await findLatestLibericaJavaVersion(javaVersion)
|
||||
const downloadUrl = await findLibericaURL(resolvedJavaVersion, version)
|
||||
const toolName = determineToolName(javaVersion, version)
|
||||
const downloadUrl = await findLibericaURL(resolvedJavaVersion, javaPackage)
|
||||
const toolName = determineToolName(javaVersion, javaPackage)
|
||||
return downloadExtractAndCacheJDK(
|
||||
async () => downloadTool(downloadUrl),
|
||||
toolName,
|
||||
@ -61,7 +61,7 @@ export async function findLatestLibericaJavaVersion(
|
||||
|
||||
export async function findLibericaURL(
|
||||
javaVersion: string,
|
||||
version: string
|
||||
javaPackage: string
|
||||
): Promise<string> {
|
||||
const release = await getTaggedRelease(
|
||||
LIBERICA_GH_USER,
|
||||
@ -69,8 +69,8 @@ export async function findLibericaURL(
|
||||
LIBERICA_JDK_TAG_PREFIX + javaVersion
|
||||
)
|
||||
const platform = determinePlatformPart()
|
||||
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineToolVersionPart(
|
||||
version
|
||||
const assetPrefix = `${LIBERICA_VM_PREFIX}${determineVariantPart(
|
||||
javaPackage
|
||||
)}openjdk${javaVersion}`
|
||||
const assetSuffix = `-${platform}${c.GRAALVM_FILE_EXTENSION}`
|
||||
for (const asset of release.assets) {
|
||||
@ -82,18 +82,18 @@ export async function findLibericaURL(
|
||||
}
|
||||
}
|
||||
throw new Error(
|
||||
`Unable to find asset for java-version: ${javaVersion}, version: ${version}, platform: ${platform}`
|
||||
`Unable to find asset for java-version: ${javaVersion}, java-package: ${javaPackage}, platform: ${platform}`
|
||||
)
|
||||
}
|
||||
|
||||
function determineToolVersionPart(version: string) {
|
||||
return version === 'std' || version === '' ? '' : `${version}-`
|
||||
function determineToolName(javaVersion: string, javaPackage: string) {
|
||||
const variant = determineVariantPart(javaPackage)
|
||||
const platform = determinePlatformPart()
|
||||
return `${LIBERICA_VM_PREFIX}${variant}openjdk${javaVersion}-${platform}`
|
||||
}
|
||||
|
||||
function determineToolName(javaVersion: string, version: string) {
|
||||
return `${LIBERICA_VM_PREFIX}${determineToolVersionPart(
|
||||
version
|
||||
)}openjdk${javaVersion}-${determinePlatformPart()}`
|
||||
function determineVariantPart(javaPackage: string) {
|
||||
return javaPackage !== null && javaPackage.includes('+fx') ? 'full-' : ''
|
||||
}
|
||||
|
||||
function determinePlatformPart() {
|
||||
|
@ -18,6 +18,7 @@ import {exec} from '@actions/exec'
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
|
||||
const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE)
|
||||
const distribution = core.getInput(c.INPUT_DISTRIBUTION)
|
||||
const graalVMVersion = core.getInput(c.INPUT_VERSION)
|
||||
const gdsToken = core.getInput(c.INPUT_GDS_TOKEN)
|
||||
@ -67,7 +68,7 @@ async function run(): Promise<void> {
|
||||
graalVMHome = await setUpMandrel(graalVMVersion, javaVersion)
|
||||
break
|
||||
case c.DISTRIBUTION_LIBERICA:
|
||||
graalVMHome = await setUpLiberica(javaVersion, graalVMVersion)
|
||||
graalVMHome = await setUpLiberica(javaVersion, javaPackage)
|
||||
break
|
||||
case '':
|
||||
if (javaVersion === c.VERSION_DEV) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user