Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow java-version: 'dev' for GraalVM dev builds #31

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
version: [latest, dev]
java-version: ['17', '19']
java-version: ['19']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
include:
Expand All @@ -42,6 +42,10 @@ jobs:
java-version: '17'
components: 'native-image'
os: windows-2022
- version: 'dev'
java-version: 'dev'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
Expand Down Expand Up @@ -77,10 +81,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['22.3.0', 'latest']
java-version: ['11', '17', '19']
version: ['latest']
java-version: ['19']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- version: '22.3.0'
java-version: '11'
components: 'native-image'
os: ubuntu-latest
- version: '22.3.0'
java-version: '17'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
Expand Down Expand Up @@ -172,8 +185,8 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'latest'
java-version: '19'
version: 'dev'
java-version: 'dev'
components: 'native-image'
native-image-musl: 'true'
native-image-job-reports: 'true'
Expand All @@ -196,7 +209,7 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'dev'
version: 'latest'
java-version: '17'
components: 'espresso,llvm-toolchain,native-image,nodejs,python,R,ruby,wasm'
set-java-home: 'false'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
|-----------------|:--------:|-------------|
| `version`<br>*(required)* | n/a | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases]<br>`latest` for [latest stable release][stable],<br>`dev` for [latest dev build][dev-build],<br>`mandrel-X.Y.Z` (e.g., `mandrel-21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` for [latest Mandrel stable release][mandrel-stable]. |
| `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.<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `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. |
| `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`. |
Expand Down
27 changes: 27 additions & 0 deletions __tests__/graalvm.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import * as path from 'path'
import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils'
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
import {GRAALVM_RELEASES_REPO} from '../src/constants'

process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
Expand All @@ -23,3 +26,27 @@ test('request invalid version/javaVersion', async () => {
expect(error.message).toContain('Are you sure version')
}
})

test('find version/javaVersion', async () => {
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestVersion = findGraalVMVersion(latestRelease)
expect(latestVersion).not.toBe('')
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
expect(latestJavaVersion).not.toBe('')

let error = new Error('unexpected')
try {
const invalidRelease = {...latestRelease, tag_name: 'invalid'}
findGraalVMVersion(invalidRelease)
} catch (err) {
error = err
}
expect(error.message).toContain('Could not find latest GraalVM release:')

try {
findHighestJavaVersion(latestRelease, 'invalid')
} catch (err) {
error = err
}
expect(error.message).toContain('Could not find highest Java version.')
})
3 changes: 2 additions & 1 deletion dist/cleanup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 56 additions & 24 deletions dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
export const GRAALVM_RELEASES_REPO = 'graalvm-ce-builds'
export const JDK_HOME_SUFFIX = IS_MACOS ? '/Contents/Home' : ''

export const MANDREL_NAMESPACE = 'mandrel-'
Expand Down
9 changes: 6 additions & 3 deletions src/features/check-for-updates.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as core from '@actions/core'
import {toSemVer} from '../utils'
import {getLatestRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver'
import {getLatestReleaseVersion} from '../graalvm'
import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants'

export async function checkForUpdates(
graalVMVersion: string,
Expand All @@ -13,7 +14,9 @@ export async function checkForUpdates(
)
return
}
const latestGraalVMVersion = await getLatestReleaseVersion()

const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion)
if (
Expand Down
Loading