Compare commits

..

10 Commits

Author SHA1 Message Date
Fabio Niephaus
b11d36630f Temporarily use 22.3.1 for latest builds.
This is a temporary fix while we are rolling out the new GraalVM for JDK17/20 release.
2023-06-13 19:24:24 +02:00
Fabio Niephaus
babc303d7e Make parsing of components a bit more robust.
Suggested by @michael-simons
2023-04-18 09:46:32 +02:00
dependabot[bot]
5f2753d6bc Bump xml2js and @azure/core-http
Bumps [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) and [@azure/core-http](https://github.com/Azure/azure-sdk-for-js). These dependencies needed to be updated together.

Updates `xml2js` from 0.4.23 to 0.5.0
- [Release notes](https://github.com/Leonidas-from-XIV/node-xml2js/releases)
- [Commits](https://github.com/Leonidas-from-XIV/node-xml2js/commits/0.5.0)

Updates `@azure/core-http` from 3.0.0 to 3.0.1
- [Release notes](https://github.com/Azure/azure-sdk-for-js/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Changelog-for-next-generation.md)
- [Commits](https://github.com/Azure/azure-sdk-for-js/compare/@azure/core-http_3.0.0...@azure/core-http_3.0.1)

---
updated-dependencies:
- dependency-name: xml2js
  dependency-type: indirect
- dependency-name: "@azure/core-http"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-12 08:56:29 +02:00
Fabio Niephaus
6acd592e3e Bump version to 1.0.11. 2023-04-11 09:11:01 +02:00
Fabio Niephaus
cf001e2d43 Update dependencies. 2023-04-11 09:09:07 +02:00
Fabio Niephaus
90a2c32c8b Default to ${{ github.token }}. 2023-04-11 08:39:53 +02:00
Fabio Niephaus
4297237826 Drop deprecated ubuntu-18.04. 2023-04-10 13:53:31 +02:00
Fabio Niephaus
c85a448ca4 Adjust for JDK 20 dev builds. 2023-04-10 13:42:02 +02:00
Fabio Niephaus
c8fdb59e88 Adjust for new dev build naming scheme. 2023-04-10 12:48:07 +02:00
Fabio Niephaus
40947ba8ce Add test for automatic NI setup on Windows.
Context: https://github.com/oracle/graal/pull/5881
2023-02-13 10:57:38 +01:00
14 changed files with 17329 additions and 24650 deletions

View File

@@ -25,15 +25,20 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: [latest, dev]
java-version: ['19']
version: ['latest', 'dev']
java-version: ['19', '20']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
exclude:
- version: 'latest'
java-version: '20'
- version: 'dev'
java-version: '19'
include:
- version: '22.2.0' # for update notifications
java-version: '17'
components: 'native-image'
os: ubuntu-18.04
os: ubuntu-20.04
- version: '22.3.1'
java-version: '11' # for JDK11 notification
components: 'native-image'
@@ -67,7 +72,7 @@ jobs:
java --version
java --version | grep "GraalVM CE" || exit 34
native-image --version
gu remove native-image
gu list
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
@@ -114,7 +119,7 @@ jobs:
java --version
java --version | grep "GraalVM EE" || exit 23
native-image --version
gu remove native-image
gu list
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
@@ -155,7 +160,7 @@ jobs:
java --version
native-image --version
if: runner.os == 'Windows'
test-native-image-msvc:
test-native-image-windows:
name: native-image on windows-latest
runs-on: windows-latest
permissions:
@@ -166,7 +171,30 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'latest'
version: 'dev'
java-version: 'dev'
components: 'native-image'
native-image-job-reports: 'true'
native-image-pr-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build HelloWorld executable with GraalVM Native Image on Windows
run: |
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
javac HelloWorld.java
native-image HelloWorld
./helloworld
test-native-image-windows-msvc:
name: native-image on windows-2019
runs-on: windows-2019
permissions:
contents: read
pull-requests: write # for `native-image-pr-reports` option
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
uses: ./
with:
version: '22.3.1'
java-version: '17'
components: 'native-image'
native-image-job-reports: 'true'
@@ -258,4 +286,4 @@ jobs:
bundle exec rake test
popd > /dev/null
- name: Remove components
run: gu remove espresso llvm-toolchain native-image nodejs python R ruby wasm
run: gu remove espresso llvm-toolchain nodejs python R ruby wasm

View File

@@ -118,7 +118,7 @@ jobs:
| `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](#basic-graalvm-enterprise-edition-template)). |
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version, `'dev'` for the highest Java version available (requires `version: 'dev'`).<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `components` | `''` | Comma-spearated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
| `github-token` | `''` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to 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. It can be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
| `check-for-updates` | `'true'` | [Annotate jobs][gha-annotations] with update notifications, for example, when a new GraalVM release is available. |

View File

@@ -1,7 +1,7 @@
import * as path from 'path'
import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils'
import {getTaggedRelease} from '../src/utils'
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
import {GRAALVM_RELEASES_REPO} from '../src/constants'
@@ -18,6 +18,9 @@ test('request invalid version/javaVersion', async () => {
try {
await graalvm.setUpGraalVMRelease('', combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`)
}
error = err
}
@@ -28,7 +31,10 @@ test('request invalid version/javaVersion', async () => {
})
test('find version/javaVersion', async () => {
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestRelease = await getTaggedRelease(
GRAALVM_RELEASES_REPO,
'vm-22.3.1'
)
const latestVersion = findGraalVMVersion(latestRelease)
expect(latestVersion).not.toBe('')
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
@@ -39,6 +45,9 @@ test('find version/javaVersion', async () => {
const invalidRelease = {...latestRelease, tag_name: 'invalid'}
findGraalVMVersion(invalidRelease)
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
}
error = err
}
expect(error.message).toContain('Could not find latest GraalVM release:')
@@ -46,6 +55,9 @@ test('find version/javaVersion', async () => {
try {
findHighestJavaVersion(latestRelease, 'invalid')
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`)
}
error = err
}
expect(error.message).toContain('Could not find highest Java version.')

View File

@@ -20,8 +20,8 @@ inputs:
default: ''
github-token:
required: false
description: 'Set it to secrets.GITHUB_TOKEN to increase rate limits when accessing the GitHub API.'
default: ''
description: 'Set it to secrets.GITHUB_TOKEN to increase rate limits when accessing the GitHub API. Defaults to github.token.'
default: ${{ github.token }}
set-java-home:
required: false
description: 'Set $JAVA_HOME to the GraalVM installation. Default: true.'

17413
dist/cleanup/index.js generated vendored

File diff suppressed because one or more lines are too long

17551
dist/main/index.js generated vendored

File diff suppressed because one or more lines are too long

6876
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "setup-graalvm",
"version": "1.0.10",
"version": "1.0.11",
"private": true,
"description": "GitHub Action for GraalVM",
"main": "lib/main.js",
@@ -42,7 +42,7 @@
},
"devDependencies": {
"@types/jest": "^27.5.2",
"@types/node": "^17.0.6",
"@types/node": "^18.15.11",
"@types/semver": "^7.3.13",
"@types/uuid": "^8.3.4",
"@typescript-eslint/parser": "^5.8.1",
@@ -50,10 +50,10 @@
"eslint": "^8.6.0",
"eslint-plugin-github": "^4.3.5",
"eslint-plugin-jest": "^25.3.4",
"jest": "^27.4.5",
"jest": "^29.5.0",
"js-yaml": "^4.1.0",
"prettier": "2.5.1",
"ts-jest": "^27.1.2",
"typescript": "^4.2.3"
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
}

View File

@@ -167,6 +167,10 @@ export async function save(id: string): Promise<void> {
await cache.saveCache(packageManager.path, primaryKey)
core.info(`Cache saved with the key: ${primaryKey}`)
} catch (error) {
if (!(error instanceof Error)) {
core.info(`Not an Error: ${error}`)
throw error
}
if (error.name === cache.ReserveCacheError.name) {
core.info(error.message)
} else {

View File

@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import {getLatestRelease, toSemVer} from '../utils'
import {getTaggedRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver'
import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants'
@@ -15,7 +15,10 @@ export async function checkForUpdates(
return
}
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestRelease = await getTaggedRelease(
GRAALVM_RELEASES_REPO,
'vm-22.3.1'
)
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion)

View File

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

View File

@@ -2,7 +2,8 @@ import * as c from './constants'
import {
downloadAndExtractJDK,
downloadExtractAndCacheJDK,
getLatestRelease
getLatestRelease,
getTaggedRelease
} from './utils'
import {downloadGraalVMEE} from './gds'
import {downloadTool} from '@actions/tool-cache'
@@ -15,10 +16,14 @@ export async function setUpGraalVMLatest(
gdsToken: string,
javaVersion: string
): Promise<string> {
const lockedVersion = '22.3.1'
if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion)
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
}
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO)
const latestRelease = await getTaggedRelease(
c.GRAALVM_RELEASES_REPO,
GRAALVM_TAG_PREFIX + lockedVersion
)
const version = findGraalVMVersion(latestRelease)
return setUpGraalVMRelease(gdsToken, version, javaVersion)
}
@@ -55,7 +60,7 @@ export async function setUpGraalVMRelease(
javaVersion: string
): Promise<string> {
const isEE = gdsToken.length > 0
const toolName = determineToolName(isEE, javaVersion)
const toolName = determineToolName(isEE, version, javaVersion)
let downloader: () => Promise<string>
if (isEE) {
downloader = async () => downloadGraalVMEE(gdsToken, version, javaVersion)
@@ -124,15 +129,18 @@ function determineGraalVMIdentifier(
version: string,
javaVersion: string
): string {
return `graalvm-${isEE ? 'ee' : 'ce'}-java${javaVersion}-${
c.GRAALVM_PLATFORM
}-${c.GRAALVM_ARCH}-${version}`
return `${determineToolName(isEE, version, javaVersion)}-${
c.GRAALVM_ARCH
}-${version}`
}
function determineToolName(isEE: boolean, javaVersion: string): string {
return `graalvm-${isEE ? 'ee' : 'ce'}-java${javaVersion}-${
c.GRAALVM_PLATFORM
}`
function determineToolName(
isEE: boolean,
version: string,
javaVersion: string
): string {
const infix = isEE ? 'ee' : version === c.VERSION_DEV ? 'community' : 'ce'
return `graalvm-${infix}-java${javaVersion}-${c.GRAALVM_PLATFORM}`
}
async function downloadGraalVMCE(

View File

@@ -19,7 +19,9 @@ async function run(): Promise<void> {
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
const componentsString: string = core.getInput(c.INPUT_COMPONENTS)
const components: string[] =
componentsString.length > 0 ? componentsString.split(',') : []
componentsString.length > 0
? componentsString.split(',').map(x => x.trim())
: []
const setJavaHome = core.getInput(c.INPUT_SET_JAVA_HOME) === 'true'
const cache = core.getInput(c.INPUT_CACHE)
const enableCheckForUpdates =

View File

@@ -47,6 +47,22 @@ export async function getLatestRelease(
).data
}
export async function getTaggedRelease(
repo: string,
tag: string
): Promise<c.LatestReleaseResponse['data']> {
const githubToken = getGitHubToken()
const options = githubToken.length > 0 ? {auth: githubToken} : {}
const octokit = new GitHubDotCom(options)
return (
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: c.GRAALVM_GH_USER,
repo,
tag
})
).data
}
export async function downloadAndExtractJDK(
downloadUrl: string
): Promise<string> {