Skip to content

Commit

Permalink
Use new Oracle GraalVM EA builds repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Feb 21, 2024
1 parent d72e3db commit 1065053
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 77 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
]
components: ['']
include:
- java-version: 'latest-ea'
distribution: 'graalvm'
os: ubuntu-latest
- java-version: '22-ea'
distribution: 'graalvm'
os: ubuntu-latest
Expand Down
24 changes: 23 additions & 1 deletion __tests__/graalvm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import * as path from 'path'
import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals'
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'

process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
Expand Down Expand Up @@ -79,3 +83,21 @@ test('find version/javaVersion', async () => {
}
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')
})
25 changes: 11 additions & 14 deletions dist/cleanup/index.js

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

74 changes: 46 additions & 28 deletions dist/main/index.js

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

19 changes: 19 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export const GDS_GRAALVM_PRODUCT_ID = 'D53FAE8052773FFAE0530F15000AA6C6'
export const ENV_GITHUB_EVENT_NAME = 'GITHUB_EVENT_NAME'
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 =
'If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'

Expand All @@ -52,6 +55,22 @@ export type MatchingRefsResponse =
export type ReleasesResponse =
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 {
switch (process.arch) {
case 'x64': {
Expand Down
Loading

0 comments on commit 1065053

Please sign in to comment.