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

Use DISCO APi for getting latest Mandrel releases #67

Merged
merged 4 commits into from
Nov 3, 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
6 changes: 1 addition & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['mandrel-22.2.0.0-Final', 'mandrel-latest']
version: ['mandrel-22.2.0.0-Final', '23.0.1.2-Final', 'mandrel-latest']
java-version: ['17']
distribution: ['mandrel']
os: [windows-latest, ubuntu-latest]
Expand All @@ -196,10 +196,6 @@ jobs:
java-version: '17'
distribution: '' # test empty distribution for backward compatibility
os: ubuntu-latest
exclude: # temporarily disable Mandrel latest builds on Windows due to unavailability
- version: 'mandrel-latest'
java-version: '17'
os: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run setup-graalvm action
Expand Down
76 changes: 76 additions & 0 deletions __tests__/mandrel.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import * as path from 'path'
import * as mandrel from '../src/mandrel'
import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils'

process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')

test('request invalid version/javaVersion combination', async () => {
for (var combination of [
['mandrel-23.1.1.0-Final', '17'],
['mandrel-23.0.2.1-Final', '21']
]) {
let error = new Error('unexpected')
try {
await mandrel.setUpMandrel(combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
}
error = err
}

expect(error).not.toBeUndefined()
expect(error.message).toContain('Failed to download')
expect(error.message).toContain('Are you sure version')
}
})
test('request invalid version', async () => {
for (var combination of [
['mandrel-23.1.1.0', '21'],
['mandrel-23.0.2.1', '17']
]) {
let error = new Error('unexpected')
try {
await mandrel.setUpMandrel(combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
}
error = err
}

expect(error).not.toBeUndefined()
expect(error.message).toContain('Failed to download')
expect(error.message).toContain('Are you sure version')
}
})

test('find latest', async () => {
// Make sure the action can find the latest Mandrel release
const latestRelease = await getLatestRelease(mandrel.MANDREL_REPO)
const tag_name = latestRelease.tag_name
expect(tag_name).toContain(mandrel.MANDREL_TAG_PREFIX)
})

test('get known latest Mandrel for specific JDK', async () => {
// Test deprecated versions that won't get updates anymore
for (var combination of [
['11', '22.2.0.0-Final'],
['20', '23.0.1.2-Final']
]) {
const latest = await mandrel.getLatestMandrelReleaseUrl(combination[0])
expect(latest).toContain(`mandrel-java${combination[0]}`)
expect(latest).toContain(combination[1])
}
})

test('get latest Mandrel for specific JDK', async () => {
// Test supported versions
for (var javaVersion of ['17', '21']) {
const latest = await mandrel.getLatestMandrelReleaseUrl(javaVersion)
expect(latest).toContain(`mandrel-java${javaVersion}`)
}
})

55 changes: 14 additions & 41 deletions dist/cleanup/index.js

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

Loading