mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-07-05 01:03:13 +08:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5c3001733f | ||
|
bd9c75cac6 | ||
|
0fee1abbca | ||
|
ca91f399b9 | ||
|
2e2e6f1823 | ||
|
4a6d7d10cf | ||
|
10650533bf |
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@ -35,6 +35,9 @@ jobs:
|
|||||||
]
|
]
|
||||||
components: ['']
|
components: ['']
|
||||||
include:
|
include:
|
||||||
|
- java-version: 'latest-ea'
|
||||||
|
distribution: 'graalvm'
|
||||||
|
os: ubuntu-latest
|
||||||
- java-version: '22-ea'
|
- java-version: '22-ea'
|
||||||
distribution: 'graalvm'
|
distribution: 'graalvm'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
|
31
README.md
31
README.md
@ -5,7 +5,7 @@ This GitHub action sets up [Oracle GraalVM][graalvm-medium], GraalVM [Community
|
|||||||
|
|
||||||
This action:
|
This action:
|
||||||
|
|
||||||
- supports Oracle GraalVM [releases][graalvm-dl], GraalVM Community Edition (CE) [releases], [dev builds][dev-builds], GraalVM Enterprise Edition (EE) [releases][graalvm-ee] (set [`gds-token`](#options)) 22.1.0 and later, and [Mandrel][mandrel] (see [Options](#options))
|
- supports Oracle GraalVM [releases][graalvm-dl], [EA builds][ea-builds], GraalVM Community Edition (CE) [releases], [dev builds][dev-builds], GraalVM Enterprise Edition (EE) [releases][graalvm-ee] (set [`gds-token`](#options)) 22.1.0 and later, and [Mandrel][mandrel] (see [Options](#options))
|
||||||
- exports a `$GRAALVM_HOME` environment variable
|
- exports a `$GRAALVM_HOME` environment variable
|
||||||
- adds `$GRAALVM_HOME/bin` to the `$PATH` environment variable<br>(Native Image, Truffle languages, and tools can be invoked directly)
|
- adds `$GRAALVM_HOME/bin` to the `$PATH` environment variable<br>(Native Image, Truffle languages, and tools can be invoked directly)
|
||||||
- sets `$JAVA_HOME` to `$GRAALVM_HOME` by default<br>(can be disabled via `set-java-home: 'false'`, see [Options](#options))
|
- sets `$JAVA_HOME` to `$GRAALVM_HOME` by default<br>(can be disabled via `set-java-home: 'false'`, see [Options](#options))
|
||||||
@ -29,8 +29,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: graalvm/setup-graalvm@v1
|
- uses: graalvm/setup-graalvm@v1
|
||||||
with:
|
with:
|
||||||
java-version: '21'
|
java-version: '21' # See 'Options' section below for all supported versions
|
||||||
distribution: 'graalvm' # See 'Options' for all available distributions
|
distribution: 'graalvm' # See 'Options' section below for all available distributions
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Example step
|
- name: Example step
|
||||||
run: |
|
run: |
|
||||||
@ -80,6 +80,26 @@ jobs:
|
|||||||
path: helloworld*
|
path: helloworld*
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h4>Template for Oracle GraalVM Early Access (EA) builds</h4></summary>
|
||||||
|
|
||||||
|
```yml
|
||||||
|
name: Oracle GraalVM Early Access build
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: graalvm/setup-graalvm@v1
|
||||||
|
with:
|
||||||
|
java-version: '22-ea' # or 'latest-ea' for the latest Java version available
|
||||||
|
distribution: 'graalvm'
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><h4>Template for older GraalVM releases</h4></summary>
|
<summary><h4>Template for older GraalVM releases</h4></summary>
|
||||||
|
|
||||||
@ -167,8 +187,8 @@ can be replaced with:
|
|||||||
|
|
||||||
| Name | Default | Description |
|
| Name | Default | Description |
|
||||||
|-----------------|:--------:|-------------|
|
|-----------------|:--------:|-------------|
|
||||||
| `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.) |
|
| `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 distribution (`graalvm` for Oracle GraalVM, `graalvm-community` for GraalVM Community Edition, `mandrel` for Mandrel). |
|
| `distribution` | `'graalvm'` | GraalVM distribution <ul><li>Oracle GraalVM: `'graalvm'`</li><li>GraalVM Community Edition: `'graalvm-community'`</li><li>Mandrel: `'mandrel'`</li></ul> |
|
||||||
| `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`. |
|
||||||
| `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]. |
|
| `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]. |
|
||||||
@ -192,6 +212,7 @@ Only pull requests from committers that can be verified as having signed the OCA
|
|||||||
|
|
||||||
[dev-build]: https://github.com/graalvm/graalvm-ce-dev-builds/releases/latest
|
[dev-build]: https://github.com/graalvm/graalvm-ce-dev-builds/releases/latest
|
||||||
[dev-builds]: https://github.com/graalvm/graalvm-ce-dev-builds
|
[dev-builds]: https://github.com/graalvm/graalvm-ce-dev-builds
|
||||||
|
[ea-builds]: https://github.com/graalvm/oracle-graalvm-ea-builds
|
||||||
[gha-annotations]: https://github.com/actions/toolkit/tree/main/packages/core#annotations
|
[gha-annotations]: https://github.com/actions/toolkit/tree/main/packages/core#annotations
|
||||||
[gha-permissions]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
[gha-permissions]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
|
||||||
[gha-secrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository
|
[gha-secrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository
|
||||||
|
@ -2,7 +2,11 @@ import * as path from 'path'
|
|||||||
import * as graalvm from '../src/graalvm'
|
import * as graalvm from '../src/graalvm'
|
||||||
import {expect, test} from '@jest/globals'
|
import {expect, test} from '@jest/globals'
|
||||||
import {getTaggedRelease} from '../src/utils'
|
import {getTaggedRelease} from '../src/utils'
|
||||||
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
|
import {
|
||||||
|
findGraalVMVersion,
|
||||||
|
findHighestJavaVersion,
|
||||||
|
findLatestEABuildDownloadUrl
|
||||||
|
} from '../src/graalvm'
|
||||||
import {GRAALVM_RELEASES_REPO} from '../src/constants'
|
import {GRAALVM_RELEASES_REPO} from '../src/constants'
|
||||||
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
|
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
|
||||||
@ -79,3 +83,21 @@ test('find version/javaVersion', async () => {
|
|||||||
}
|
}
|
||||||
expect(error.message).toContain('Could not find highest Java version.')
|
expect(error.message).toContain('Could not find highest Java version.')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('find version/javaVersion', async () => {
|
||||||
|
let url22EA = await findLatestEABuildDownloadUrl('22-ea')
|
||||||
|
expect(url22EA).not.toBe('')
|
||||||
|
let urlLatestEA = await findLatestEABuildDownloadUrl('latest-ea')
|
||||||
|
expect(urlLatestEA).not.toBe('')
|
||||||
|
|
||||||
|
let error = new Error('unexpected')
|
||||||
|
try {
|
||||||
|
await findLatestEABuildDownloadUrl('8-ea')
|
||||||
|
} catch (err) {
|
||||||
|
if (!(err instanceof Error)) {
|
||||||
|
fail(`Unexpected non-Error: ${err}`)
|
||||||
|
}
|
||||||
|
error = err
|
||||||
|
}
|
||||||
|
expect(error.message).toContain('Unable to resolve download URL for')
|
||||||
|
})
|
||||||
|
36
dist/cleanup/index.js
generated
vendored
36
dist/cleanup/index.js
generated
vendored
@ -92172,7 +92172,7 @@ else {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.ERROR_HINT = 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_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = 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_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.INPUT_VERSION = 'version';
|
exports.INPUT_VERSION = 'version';
|
||||||
exports.INPUT_GDS_TOKEN = 'gds-token';
|
exports.INPUT_GDS_TOKEN = 'gds-token';
|
||||||
exports.INPUT_JAVA_VERSION = 'java-version';
|
exports.INPUT_JAVA_VERSION = 'java-version';
|
||||||
@ -92186,6 +92186,7 @@ exports.INPUT_NI_MUSL = 'native-image-musl';
|
|||||||
exports.IS_LINUX = process.platform === 'linux';
|
exports.IS_LINUX = process.platform === 'linux';
|
||||||
exports.IS_MACOS = process.platform === 'darwin';
|
exports.IS_MACOS = process.platform === 'darwin';
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
|
exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS ? '.exe' : '';
|
||||||
exports.DISTRIBUTION_GRAALVM = 'graalvm';
|
exports.DISTRIBUTION_GRAALVM = 'graalvm';
|
||||||
exports.DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community';
|
exports.DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community';
|
||||||
exports.DISTRIBUTION_MANDREL = 'mandrel';
|
exports.DISTRIBUTION_MANDREL = 'mandrel';
|
||||||
@ -92204,6 +92205,7 @@ exports.GDS_BASE = 'https://gds.oracle.com/api/20220101';
|
|||||||
exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6';
|
exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6';
|
||||||
exports.ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME';
|
exports.ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME';
|
||||||
exports.EVENT_NAME_PULL_REQUEST = 'pull_request';
|
exports.EVENT_NAME_PULL_REQUEST = 'pull_request';
|
||||||
|
exports.ERROR_REQUEST = 'Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
||||||
exports.ERROR_HINT = 'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
exports.ERROR_HINT = 'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
||||||
function determineJDKArchitecture() {
|
function determineJDKArchitecture() {
|
||||||
switch (process.arch) {
|
switch (process.arch) {
|
||||||
@ -92864,7 +92866,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.getLatestPrerelease = exports.exec = void 0;
|
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getContents = exports.getLatestRelease = exports.exec = void 0;
|
||||||
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 github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
@ -92895,23 +92897,6 @@ function exec(commandLine, args, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.exec = exec;
|
exports.exec = exec;
|
||||||
function getLatestPrerelease(repo) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const githubToken = getGitHubToken();
|
|
||||||
const options = githubToken.length > 0 ? { auth: githubToken } : {};
|
|
||||||
const octokit = new GitHubDotCom(options);
|
|
||||||
const releases = (yield octokit.request('GET /repos/{owner}/{repo}/releases', {
|
|
||||||
owner: c.GRAALVM_GH_USER,
|
|
||||||
repo
|
|
||||||
})).data;
|
|
||||||
const firstPrerelease = releases.find(r => r.prerelease);
|
|
||||||
if (!firstPrerelease) {
|
|
||||||
throw new Error(`Unable to find latest prerelease in ${repo}`);
|
|
||||||
}
|
|
||||||
return firstPrerelease;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getLatestPrerelease = getLatestPrerelease;
|
|
||||||
function getLatestRelease(repo) {
|
function getLatestRelease(repo) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const githubToken = getGitHubToken();
|
const githubToken = getGitHubToken();
|
||||||
@ -92924,6 +92909,19 @@ function getLatestRelease(repo) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getLatestRelease = getLatestRelease;
|
exports.getLatestRelease = getLatestRelease;
|
||||||
|
function getContents(repo, path) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const githubToken = getGitHubToken();
|
||||||
|
const options = githubToken.length > 0 ? { auth: githubToken } : {};
|
||||||
|
const octokit = new GitHubDotCom(options);
|
||||||
|
return (yield octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
|
||||||
|
owner: c.GRAALVM_GH_USER,
|
||||||
|
repo,
|
||||||
|
path
|
||||||
|
})).data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getContents = getContents;
|
||||||
function getTaggedRelease(repo, tag) {
|
function getTaggedRelease(repo, tag) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const githubToken = getGitHubToken();
|
const githubToken = getGitHubToken();
|
||||||
|
114
dist/main/index.js
generated
vendored
114
dist/main/index.js
generated
vendored
@ -92738,7 +92738,7 @@ function wrappy (fn, cb) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.ERROR_HINT = 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_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = 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_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.INPUT_VERSION = 'version';
|
exports.INPUT_VERSION = 'version';
|
||||||
exports.INPUT_GDS_TOKEN = 'gds-token';
|
exports.INPUT_GDS_TOKEN = 'gds-token';
|
||||||
exports.INPUT_JAVA_VERSION = 'java-version';
|
exports.INPUT_JAVA_VERSION = 'java-version';
|
||||||
@ -92752,6 +92752,7 @@ exports.INPUT_NI_MUSL = 'native-image-musl';
|
|||||||
exports.IS_LINUX = process.platform === 'linux';
|
exports.IS_LINUX = process.platform === 'linux';
|
||||||
exports.IS_MACOS = process.platform === 'darwin';
|
exports.IS_MACOS = process.platform === 'darwin';
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
|
exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS ? '.exe' : '';
|
||||||
exports.DISTRIBUTION_GRAALVM = 'graalvm';
|
exports.DISTRIBUTION_GRAALVM = 'graalvm';
|
||||||
exports.DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community';
|
exports.DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community';
|
||||||
exports.DISTRIBUTION_MANDREL = 'mandrel';
|
exports.DISTRIBUTION_MANDREL = 'mandrel';
|
||||||
@ -92770,6 +92771,7 @@ exports.GDS_BASE = 'https://gds.oracle.com/api/20220101';
|
|||||||
exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6';
|
exports.GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6';
|
||||||
exports.ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME';
|
exports.ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME';
|
||||||
exports.EVENT_NAME_PULL_REQUEST = 'pull_request';
|
exports.EVENT_NAME_PULL_REQUEST = 'pull_request';
|
||||||
|
exports.ERROR_REQUEST = 'Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
||||||
exports.ERROR_HINT = 'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
exports.ERROR_HINT = 'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.';
|
||||||
function determineJDKArchitecture() {
|
function determineJDKArchitecture() {
|
||||||
switch (process.arch) {
|
switch (process.arch) {
|
||||||
@ -93659,7 +93661,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.7 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`;
|
const userAgent = `GraalVMGitHubAction/1.1.8 (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);
|
||||||
});
|
});
|
||||||
@ -93841,7 +93843,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.setUpGraalVMRelease = exports.findGraalVMVersion = exports.setUpGraalVMLatest_22_X = exports.findHighestJavaVersion = exports.setUpGraalVMJDKDevBuild = exports.findLatestGraalVMJDKCEJavaVersion = exports.setUpGraalVMJDKCE = exports.setUpGraalVMJDK = void 0;
|
exports.setUpGraalVMRelease = exports.findGraalVMVersion = exports.setUpGraalVMLatest_22_X = exports.findHighestJavaVersion = exports.setUpGraalVMJDKDevBuild = exports.findLatestGraalVMJDKCEJavaVersion = exports.setUpGraalVMJDKCE = exports.findLatestEABuildDownloadUrl = exports.setUpGraalVMJDK = void 0;
|
||||||
const c = __importStar(__nccwpck_require__(9042));
|
const c = __importStar(__nccwpck_require__(9042));
|
||||||
const semver = __importStar(__nccwpck_require__(1383));
|
const semver = __importStar(__nccwpck_require__(1383));
|
||||||
const utils_1 = __nccwpck_require__(1314);
|
const utils_1 = __nccwpck_require__(1314);
|
||||||
@ -93850,7 +93852,8 @@ const tool_cache_1 = __nccwpck_require__(7784);
|
|||||||
const path_1 = __nccwpck_require__(1017);
|
const path_1 = __nccwpck_require__(1017);
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`;
|
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`;
|
||||||
const ORACLE_GRAALVM_REPO_EA_BUILDS = 'oracle-graalvm-dev-builds';
|
const ORACLE_GRAALVM_REPO_EA_BUILDS = 'oracle-graalvm-ea-builds';
|
||||||
|
const ORACLE_GRAALVM_REPO_EA_BUILDS_LATEST_SYMBOL = 'latest-ea';
|
||||||
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds';
|
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds';
|
||||||
const GRAALVM_JDK_TAG_PREFIX = 'jdk-';
|
const GRAALVM_JDK_TAG_PREFIX = 'jdk-';
|
||||||
const GRAALVM_TAG_PREFIX = 'vm-';
|
const GRAALVM_TAG_PREFIX = 'vm-';
|
||||||
@ -93860,11 +93863,20 @@ function setUpGraalVMJDK(javaVersionOrDev) {
|
|||||||
if (javaVersionOrDev === c.VERSION_DEV) {
|
if (javaVersionOrDev === c.VERSION_DEV) {
|
||||||
return setUpGraalVMJDKDevBuild();
|
return setUpGraalVMJDKDevBuild();
|
||||||
}
|
}
|
||||||
const javaVersion = javaVersionOrDev;
|
let javaVersion = javaVersionOrDev;
|
||||||
const toolName = determineToolName(javaVersion, false);
|
const toolName = determineToolName(javaVersion, false);
|
||||||
let downloadName = toolName;
|
let downloadName = toolName;
|
||||||
let downloadUrl;
|
let downloadUrl;
|
||||||
if (javaVersion.includes('.')) {
|
if (javaVersion.endsWith('-ea')) {
|
||||||
|
downloadUrl = yield findLatestEABuildDownloadUrl(javaVersion);
|
||||||
|
const filename = (0, path_1.basename)(downloadUrl);
|
||||||
|
const resolvedVersion = semver.valid(semver.coerce(filename));
|
||||||
|
if (!resolvedVersion) {
|
||||||
|
throw new Error(`Unable to determine resolved version based on '${filename}'. ${c.ERROR_REQUEST}`);
|
||||||
|
}
|
||||||
|
javaVersion = resolvedVersion;
|
||||||
|
}
|
||||||
|
else if (javaVersion.includes('.')) {
|
||||||
if (semver.valid(javaVersion)) {
|
if (semver.valid(javaVersion)) {
|
||||||
const majorJavaVersion = semver.major(javaVersion);
|
const majorJavaVersion = semver.major(javaVersion);
|
||||||
const minorJavaVersion = semver.minor(javaVersion);
|
const minorJavaVersion = semver.minor(javaVersion);
|
||||||
@ -93880,9 +93892,6 @@ function setUpGraalVMJDK(javaVersionOrDev) {
|
|||||||
throw new Error(`java-version set to '${javaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`);
|
throw new Error(`java-version set to '${javaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (javaVersion === '22-ea') {
|
|
||||||
downloadUrl = yield findLatestEABuildDownloadUrl(javaVersion);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
downloadUrl = `${GRAALVM_DL_BASE}/${javaVersion}/latest/${downloadName}${c.GRAALVM_FILE_EXTENSION}`;
|
downloadUrl = `${GRAALVM_DL_BASE}/${javaVersion}/latest/${downloadName}${c.GRAALVM_FILE_EXTENSION}`;
|
||||||
}
|
}
|
||||||
@ -93893,18 +93902,38 @@ function setUpGraalVMJDK(javaVersionOrDev) {
|
|||||||
exports.setUpGraalVMJDK = setUpGraalVMJDK;
|
exports.setUpGraalVMJDK = setUpGraalVMJDK;
|
||||||
function findLatestEABuildDownloadUrl(javaEaVersion) {
|
function findLatestEABuildDownloadUrl(javaEaVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const latestPrerelease = yield (0, utils_1.getLatestPrerelease)(ORACLE_GRAALVM_REPO_EA_BUILDS);
|
const filePath = `versions/${javaEaVersion}.json`;
|
||||||
const expectedFileNamePrefix = 'graalvm-jdk-';
|
let response;
|
||||||
const expectedFileNameSuffix = `_${c.JDK_PLATFORM}-${c.JDK_ARCH}_bin${c.GRAALVM_FILE_EXTENSION}`;
|
try {
|
||||||
for (const asset of latestPrerelease.assets) {
|
response = yield (0, utils_1.getContents)(ORACLE_GRAALVM_REPO_EA_BUILDS, filePath);
|
||||||
if (asset.name.startsWith(expectedFileNamePrefix) &&
|
}
|
||||||
asset.name.endsWith(expectedFileNameSuffix)) {
|
catch (error) {
|
||||||
return asset.browser_download_url;
|
throw new Error(`Unable to resolve download URL for '${javaEaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`);
|
||||||
|
}
|
||||||
|
if (Array.isArray(response) ||
|
||||||
|
response.type !== 'file' ||
|
||||||
|
!response.content) {
|
||||||
|
throw new Error(`Unexpected response when resolving download URL for '${javaEaVersion}'. ${c.ERROR_REQUEST}`);
|
||||||
|
}
|
||||||
|
const versionData = JSON.parse(Buffer.from(response.content, 'base64').toString('utf-8'));
|
||||||
|
let latestVersion;
|
||||||
|
if (javaEaVersion === ORACLE_GRAALVM_REPO_EA_BUILDS_LATEST_SYMBOL) {
|
||||||
|
latestVersion = versionData;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
latestVersion = versionData.find(v => v.latest);
|
||||||
|
if (!latestVersion) {
|
||||||
|
throw new Error(`Unable to find latest version for '${javaEaVersion}'. ${c.ERROR_REQUEST}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(`Could not find Oracle GraalVM build for ${javaEaVersion}. ${c.ERROR_HINT}`);
|
const file = latestVersion.files.find(f => f.arch === c.JDK_ARCH && f.platform === c.GRAALVM_PLATFORM);
|
||||||
|
if (!file || !file.filename.startsWith('graalvm-jdk-')) {
|
||||||
|
throw new Error(`Unable to find file metadata for '${javaEaVersion}'. ${c.ERROR_REQUEST}`);
|
||||||
|
}
|
||||||
|
return `${latestVersion.download_base_url}${file.filename}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
exports.findLatestEABuildDownloadUrl = findLatestEABuildDownloadUrl;
|
||||||
function setUpGraalVMJDKCE(javaVersionOrDev) {
|
function setUpGraalVMJDKCE(javaVersionOrDev) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (javaVersionOrDev === c.VERSION_DEV) {
|
if (javaVersionOrDev === c.VERSION_DEV) {
|
||||||
@ -94225,6 +94254,7 @@ const check_for_updates_1 = __nccwpck_require__(6780);
|
|||||||
const musl_1 = __nccwpck_require__(316);
|
const musl_1 = __nccwpck_require__(316);
|
||||||
const msvc_1 = __nccwpck_require__(1165);
|
const msvc_1 = __nccwpck_require__(1165);
|
||||||
const reports_1 = __nccwpck_require__(2046);
|
const reports_1 = __nccwpck_require__(2046);
|
||||||
|
const exec_1 = __nccwpck_require__(1514);
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@ -94241,7 +94271,7 @@ 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)(javaVersion, graalVMVersion);
|
||||||
}
|
}
|
||||||
yield (0, dependencies_1.setUpDependencies)(components);
|
yield (0, dependencies_1.setUpDependencies)(components);
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
@ -94332,6 +94362,11 @@ function run() {
|
|||||||
yield (0, cache_2.restore)(cache);
|
yield (0, cache_2.restore)(cache);
|
||||||
}
|
}
|
||||||
(0, reports_1.setUpNativeImageBuildReports)(isGraalVMforJDK17OrLater, graalVMVersion);
|
(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'
|
||||||
|
]);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error instanceof Error)
|
if (error instanceof Error)
|
||||||
@ -94537,6 +94572,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.setUpWindowsEnvironment = void 0;
|
exports.setUpWindowsEnvironment = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
|
const semver = __importStar(__nccwpck_require__(1383));
|
||||||
const child_process_1 = __nccwpck_require__(2081);
|
const child_process_1 = __nccwpck_require__(2081);
|
||||||
const fs_1 = __nccwpck_require__(7147);
|
const fs_1 = __nccwpck_require__(7147);
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
@ -94560,10 +94596,16 @@ function findVcvarsallPath() {
|
|||||||
}
|
}
|
||||||
throw new Error('Failed to find vcvarsall.bat');
|
throw new Error('Failed to find vcvarsall.bat');
|
||||||
}
|
}
|
||||||
function setUpWindowsEnvironment(graalVMVersion) {
|
function setUpWindowsEnvironment(javaVersion, graalVMVersion) {
|
||||||
if (graalVMVersion === constants_1.VERSION_DEV) {
|
if (javaVersion === javaVersion || graalVMVersion === constants_1.VERSION_DEV) {
|
||||||
return; // no longer required in dev builds
|
return; // 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
|
||||||
|
}
|
||||||
core.startGroup('Updating Windows environment...');
|
core.startGroup('Updating Windows environment...');
|
||||||
const vcvarsallPath = findVcvarsallPath();
|
const vcvarsallPath = findVcvarsallPath();
|
||||||
core.debug(`Calling "${vcvarsallPath}"...`);
|
core.debug(`Calling "${vcvarsallPath}"...`);
|
||||||
@ -94639,7 +94681,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getLatestRelease = exports.getLatestPrerelease = exports.exec = void 0;
|
exports.createPRComment = exports.isPREvent = exports.toSemVer = exports.calculateSHA256 = exports.downloadExtractAndCacheJDK = exports.downloadAndExtractJDK = exports.getMatchingTags = exports.getTaggedRelease = exports.getContents = exports.getLatestRelease = exports.exec = void 0;
|
||||||
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 github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
@ -94670,23 +94712,6 @@ function exec(commandLine, args, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.exec = exec;
|
exports.exec = exec;
|
||||||
function getLatestPrerelease(repo) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const githubToken = getGitHubToken();
|
|
||||||
const options = githubToken.length > 0 ? { auth: githubToken } : {};
|
|
||||||
const octokit = new GitHubDotCom(options);
|
|
||||||
const releases = (yield octokit.request('GET /repos/{owner}/{repo}/releases', {
|
|
||||||
owner: c.GRAALVM_GH_USER,
|
|
||||||
repo
|
|
||||||
})).data;
|
|
||||||
const firstPrerelease = releases.find(r => r.prerelease);
|
|
||||||
if (!firstPrerelease) {
|
|
||||||
throw new Error(`Unable to find latest prerelease in ${repo}`);
|
|
||||||
}
|
|
||||||
return firstPrerelease;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.getLatestPrerelease = getLatestPrerelease;
|
|
||||||
function getLatestRelease(repo) {
|
function getLatestRelease(repo) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const githubToken = getGitHubToken();
|
const githubToken = getGitHubToken();
|
||||||
@ -94699,6 +94724,19 @@ function getLatestRelease(repo) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getLatestRelease = getLatestRelease;
|
exports.getLatestRelease = getLatestRelease;
|
||||||
|
function getContents(repo, path) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const githubToken = getGitHubToken();
|
||||||
|
const options = githubToken.length > 0 ? { auth: githubToken } : {};
|
||||||
|
const octokit = new GitHubDotCom(options);
|
||||||
|
return (yield octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
|
||||||
|
owner: c.GRAALVM_GH_USER,
|
||||||
|
repo,
|
||||||
|
path
|
||||||
|
})).data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.getContents = getContents;
|
||||||
function getTaggedRelease(repo, tag) {
|
function getTaggedRelease(repo, tag) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const githubToken = getGitHubToken();
|
const githubToken = getGitHubToken();
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"license": "UPL",
|
"license": "UPL",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.2.3",
|
"@actions/cache": "^3.2.3",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-graalvm",
|
"name": "setup-graalvm",
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "GitHub Action for GraalVM",
|
"description": "GitHub Action for GraalVM",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
@ -15,6 +15,8 @@ export const IS_LINUX = process.platform === 'linux'
|
|||||||
export const IS_MACOS = process.platform === 'darwin'
|
export const IS_MACOS = process.platform === 'darwin'
|
||||||
export const IS_WINDOWS = process.platform === 'win32'
|
export const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
|
export const EXECUTABLE_SUFFIX = IS_WINDOWS ? '.exe' : ''
|
||||||
|
|
||||||
export const DISTRIBUTION_GRAALVM = 'graalvm'
|
export const DISTRIBUTION_GRAALVM = 'graalvm'
|
||||||
export const DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community'
|
export const DISTRIBUTION_GRAALVM_COMMUNITY = 'graalvm-community'
|
||||||
export const DISTRIBUTION_MANDREL = 'mandrel'
|
export const DISTRIBUTION_MANDREL = 'mandrel'
|
||||||
@ -40,6 +42,9 @@ export const GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'
|
|||||||
export const ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME'
|
export const ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME'
|
||||||
export const EVENT_NAME_PULL_REQUEST = 'pull_request'
|
export const EVENT_NAME_PULL_REQUEST = 'pull_request'
|
||||||
|
|
||||||
|
export const ERROR_REQUEST =
|
||||||
|
'Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
|
||||||
|
|
||||||
export const ERROR_HINT =
|
export const ERROR_HINT =
|
||||||
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
|
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
|
||||||
|
|
||||||
@ -52,6 +57,22 @@ export type MatchingRefsResponse =
|
|||||||
export type ReleasesResponse =
|
export type ReleasesResponse =
|
||||||
otypes.Endpoints['GET /repos/{owner}/{repo}/releases']['response']
|
otypes.Endpoints['GET /repos/{owner}/{repo}/releases']['response']
|
||||||
|
|
||||||
|
export type ContentsResponse =
|
||||||
|
otypes.Endpoints['GET /repos/{owner}/{repo}/contents/{path}']['response']
|
||||||
|
|
||||||
|
export interface OracleGraalVMEAFile {
|
||||||
|
filename: string
|
||||||
|
arch: 'aarch64' | 'x64'
|
||||||
|
platform: 'darwin' | 'linux' | 'windows'
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OracleGraalVMEAVersion {
|
||||||
|
version: string
|
||||||
|
latest?: boolean
|
||||||
|
download_base_url: string
|
||||||
|
files: OracleGraalVMEAFile[]
|
||||||
|
}
|
||||||
|
|
||||||
function determineJDKArchitecture(): string {
|
function determineJDKArchitecture(): string {
|
||||||
switch (process.arch) {
|
switch (process.arch) {
|
||||||
case 'x64': {
|
case 'x64': {
|
||||||
|
@ -31,7 +31,7 @@ export async function downloadGraalVMEELegacy(
|
|||||||
version: string,
|
version: string,
|
||||||
javaVersion: string
|
javaVersion: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const userAgent = `GraalVMGitHubAction/1.1.7 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
const userAgent = `GraalVMGitHubAction/1.1.8 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
|
||||||
const baseArtifact = await fetchArtifact(
|
const baseArtifact = await fetchArtifact(
|
||||||
userAgent,
|
userAgent,
|
||||||
'isBase:True',
|
'isBase:True',
|
||||||
|
@ -3,11 +3,10 @@ import * as semver from 'semver'
|
|||||||
import {
|
import {
|
||||||
downloadAndExtractJDK,
|
downloadAndExtractJDK,
|
||||||
downloadExtractAndCacheJDK,
|
downloadExtractAndCacheJDK,
|
||||||
getLatestPrerelease,
|
getContents,
|
||||||
getLatestRelease,
|
getLatestRelease,
|
||||||
getMatchingTags,
|
getMatchingTags,
|
||||||
getTaggedRelease,
|
getTaggedRelease
|
||||||
toSemVer
|
|
||||||
} from './utils'
|
} from './utils'
|
||||||
import {downloadGraalVMEELegacy} from './gds'
|
import {downloadGraalVMEELegacy} from './gds'
|
||||||
import {downloadTool} from '@actions/tool-cache'
|
import {downloadTool} from '@actions/tool-cache'
|
||||||
@ -15,7 +14,8 @@ import {basename} from 'path'
|
|||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm'
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm'
|
||||||
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`
|
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`
|
||||||
const ORACLE_GRAALVM_REPO_EA_BUILDS = 'oracle-graalvm-dev-builds'
|
const ORACLE_GRAALVM_REPO_EA_BUILDS = 'oracle-graalvm-ea-builds'
|
||||||
|
const ORACLE_GRAALVM_REPO_EA_BUILDS_LATEST_SYMBOL = 'latest-ea'
|
||||||
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds'
|
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds'
|
||||||
const GRAALVM_JDK_TAG_PREFIX = 'jdk-'
|
const GRAALVM_JDK_TAG_PREFIX = 'jdk-'
|
||||||
const GRAALVM_TAG_PREFIX = 'vm-'
|
const GRAALVM_TAG_PREFIX = 'vm-'
|
||||||
@ -28,11 +28,21 @@ export async function setUpGraalVMJDK(
|
|||||||
if (javaVersionOrDev === c.VERSION_DEV) {
|
if (javaVersionOrDev === c.VERSION_DEV) {
|
||||||
return setUpGraalVMJDKDevBuild()
|
return setUpGraalVMJDKDevBuild()
|
||||||
}
|
}
|
||||||
const javaVersion = javaVersionOrDev
|
let javaVersion = javaVersionOrDev
|
||||||
const toolName = determineToolName(javaVersion, false)
|
const toolName = determineToolName(javaVersion, false)
|
||||||
let downloadName = toolName
|
let downloadName = toolName
|
||||||
let downloadUrl: string
|
let downloadUrl: string
|
||||||
if (javaVersion.includes('.')) {
|
if (javaVersion.endsWith('-ea')) {
|
||||||
|
downloadUrl = await findLatestEABuildDownloadUrl(javaVersion)
|
||||||
|
const filename = basename(downloadUrl)
|
||||||
|
const resolvedVersion = semver.valid(semver.coerce(filename))
|
||||||
|
if (!resolvedVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to determine resolved version based on '${filename}'. ${c.ERROR_REQUEST}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
javaVersion = resolvedVersion
|
||||||
|
} else if (javaVersion.includes('.')) {
|
||||||
if (semver.valid(javaVersion)) {
|
if (semver.valid(javaVersion)) {
|
||||||
const majorJavaVersion = semver.major(javaVersion)
|
const majorJavaVersion = semver.major(javaVersion)
|
||||||
const minorJavaVersion = semver.minor(javaVersion)
|
const minorJavaVersion = semver.minor(javaVersion)
|
||||||
@ -48,8 +58,6 @@ export async function setUpGraalVMJDK(
|
|||||||
`java-version set to '${javaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`
|
`java-version set to '${javaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (javaVersion === '22-ea') {
|
|
||||||
downloadUrl = await findLatestEABuildDownloadUrl(javaVersion)
|
|
||||||
} else {
|
} else {
|
||||||
downloadUrl = `${GRAALVM_DL_BASE}/${javaVersion}/latest/${downloadName}${c.GRAALVM_FILE_EXTENSION}`
|
downloadUrl = `${GRAALVM_DL_BASE}/${javaVersion}/latest/${downloadName}${c.GRAALVM_FILE_EXTENSION}`
|
||||||
}
|
}
|
||||||
@ -57,25 +65,52 @@ export async function setUpGraalVMJDK(
|
|||||||
return downloadExtractAndCacheJDK(downloader, toolName, javaVersion)
|
return downloadExtractAndCacheJDK(downloader, toolName, javaVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findLatestEABuildDownloadUrl(
|
export async function findLatestEABuildDownloadUrl(
|
||||||
javaEaVersion: string
|
javaEaVersion: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const latestPrerelease = await getLatestPrerelease(
|
const filePath = `versions/${javaEaVersion}.json`
|
||||||
ORACLE_GRAALVM_REPO_EA_BUILDS
|
let response
|
||||||
|
try {
|
||||||
|
response = await getContents(ORACLE_GRAALVM_REPO_EA_BUILDS, filePath)
|
||||||
|
} catch (error) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to resolve download URL for '${javaEaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
Array.isArray(response) ||
|
||||||
|
response.type !== 'file' ||
|
||||||
|
!response.content
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
`Unexpected response when resolving download URL for '${javaEaVersion}'. ${c.ERROR_REQUEST}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
const versionData = JSON.parse(
|
||||||
|
Buffer.from(response.content, 'base64').toString('utf-8')
|
||||||
)
|
)
|
||||||
const expectedFileNamePrefix = 'graalvm-jdk-'
|
let latestVersion
|
||||||
const expectedFileNameSuffix = `_${c.JDK_PLATFORM}-${c.JDK_ARCH}_bin${c.GRAALVM_FILE_EXTENSION}`
|
if (javaEaVersion === ORACLE_GRAALVM_REPO_EA_BUILDS_LATEST_SYMBOL) {
|
||||||
for (const asset of latestPrerelease.assets) {
|
latestVersion = versionData as c.OracleGraalVMEAVersion
|
||||||
if (
|
} else {
|
||||||
asset.name.startsWith(expectedFileNamePrefix) &&
|
latestVersion = (versionData as c.OracleGraalVMEAVersion[]).find(
|
||||||
asset.name.endsWith(expectedFileNameSuffix)
|
v => v.latest
|
||||||
) {
|
)
|
||||||
return asset.browser_download_url
|
if (!latestVersion) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to find latest version for '${javaEaVersion}'. ${c.ERROR_REQUEST}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(
|
const file = latestVersion.files.find(
|
||||||
`Could not find Oracle GraalVM build for ${javaEaVersion}. ${c.ERROR_HINT}`
|
f => f.arch === c.JDK_ARCH && f.platform === c.GRAALVM_PLATFORM
|
||||||
)
|
)
|
||||||
|
if (!file || !file.filename.startsWith('graalvm-jdk-')) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to find file metadata for '${javaEaVersion}'. ${c.ERROR_REQUEST}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return `${latestVersion.download_base_url}${file.filename}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setUpGraalVMJDKCE(
|
export async function setUpGraalVMJDKCE(
|
||||||
|
11
src/main.ts
11
src/main.ts
@ -3,7 +3,7 @@ import * as core from '@actions/core'
|
|||||||
import * as graalvm from './graalvm'
|
import * as graalvm from './graalvm'
|
||||||
import * as semver 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 {basename, join} from 'path'
|
||||||
import {restore} from './features/cache'
|
import {restore} from './features/cache'
|
||||||
import {setUpDependencies} from './dependencies'
|
import {setUpDependencies} from './dependencies'
|
||||||
import {setUpGUComponents} from './gu'
|
import {setUpGUComponents} from './gu'
|
||||||
@ -12,6 +12,7 @@ import {checkForUpdates} from './features/check-for-updates'
|
|||||||
import {setUpNativeImageMusl} from './features/musl'
|
import {setUpNativeImageMusl} from './features/musl'
|
||||||
import {setUpWindowsEnvironment} from './msvc'
|
import {setUpWindowsEnvironment} from './msvc'
|
||||||
import {setUpNativeImageBuildReports} from './features/reports'
|
import {setUpNativeImageBuildReports} from './features/reports'
|
||||||
|
import {exec} from '@actions/exec'
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
@ -31,7 +32,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(javaVersion, graalVMVersion)
|
||||||
}
|
}
|
||||||
await setUpDependencies(components)
|
await setUpDependencies(components)
|
||||||
if (enableNativeImageMusl) {
|
if (enableNativeImageMusl) {
|
||||||
@ -151,6 +152,12 @@ async function run(): Promise<void> {
|
|||||||
await restore(cache)
|
await restore(cache)
|
||||||
}
|
}
|
||||||
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion)
|
||||||
|
|
||||||
|
core.startGroup(`Successfully set up '${basename(graalVMHome)}'`)
|
||||||
|
await exec(join(graalVMHome, 'bin', `java${c.EXECUTABLE_SUFFIX}`), [
|
||||||
|
'--version'
|
||||||
|
])
|
||||||
|
core.endGroup()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) core.setFailed(error.message)
|
if (error instanceof Error) core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
16
src/msvc.ts
16
src/msvc.ts
@ -1,4 +1,5 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
|
import * as semver from 'semver'
|
||||||
import {execSync} from 'child_process'
|
import {execSync} from 'child_process'
|
||||||
import {existsSync} from 'fs'
|
import {existsSync} from 'fs'
|
||||||
import {VERSION_DEV} from './constants'
|
import {VERSION_DEV} from './constants'
|
||||||
@ -27,10 +28,21 @@ function findVcvarsallPath(): string {
|
|||||||
throw new Error('Failed to find vcvarsall.bat')
|
throw new Error('Failed to find vcvarsall.bat')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setUpWindowsEnvironment(graalVMVersion: string): void {
|
export function setUpWindowsEnvironment(
|
||||||
if (graalVMVersion === VERSION_DEV) {
|
javaVersion: string,
|
||||||
|
graalVMVersion: string
|
||||||
|
): void {
|
||||||
|
if (javaVersion === javaVersion || graalVMVersion === VERSION_DEV) {
|
||||||
return // no longer required in dev builds
|
return // 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
|
||||||
|
}
|
||||||
|
|
||||||
core.startGroup('Updating Windows environment...')
|
core.startGroup('Updating Windows environment...')
|
||||||
|
|
||||||
|
35
src/utils.ts
35
src/utils.ts
@ -34,25 +34,6 @@ export async function exec(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLatestPrerelease(
|
|
||||||
repo: string
|
|
||||||
): Promise<c.ReleasesResponse['data'][number]> {
|
|
||||||
const githubToken = getGitHubToken()
|
|
||||||
const options = githubToken.length > 0 ? {auth: githubToken} : {}
|
|
||||||
const octokit = new GitHubDotCom(options)
|
|
||||||
const releases: c.ReleasesResponse['data'] = (
|
|
||||||
await octokit.request('GET /repos/{owner}/{repo}/releases', {
|
|
||||||
owner: c.GRAALVM_GH_USER,
|
|
||||||
repo
|
|
||||||
})
|
|
||||||
).data
|
|
||||||
const firstPrerelease = releases.find(r => r.prerelease)
|
|
||||||
if (!firstPrerelease) {
|
|
||||||
throw new Error(`Unable to find latest prerelease in ${repo}`)
|
|
||||||
}
|
|
||||||
return firstPrerelease
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getLatestRelease(
|
export async function getLatestRelease(
|
||||||
repo: string
|
repo: string
|
||||||
): Promise<c.LatestReleaseResponse['data']> {
|
): Promise<c.LatestReleaseResponse['data']> {
|
||||||
@ -67,6 +48,22 @@ export async function getLatestRelease(
|
|||||||
).data
|
).data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getContents(
|
||||||
|
repo: string,
|
||||||
|
path: string
|
||||||
|
): Promise<c.ContentsResponse['data']> {
|
||||||
|
const githubToken = getGitHubToken()
|
||||||
|
const options = githubToken.length > 0 ? {auth: githubToken} : {}
|
||||||
|
const octokit = new GitHubDotCom(options)
|
||||||
|
return (
|
||||||
|
await octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
|
||||||
|
owner: c.GRAALVM_GH_USER,
|
||||||
|
repo,
|
||||||
|
path
|
||||||
|
})
|
||||||
|
).data
|
||||||
|
}
|
||||||
|
|
||||||
export async function getTaggedRelease(
|
export async function getTaggedRelease(
|
||||||
repo: string,
|
repo: string,
|
||||||
tag: string
|
tag: string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user