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

Add support for GraalVM Enterprise Edition. #8

Merged
merged 5 commits into from
Mar 11, 2022
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
87 changes: 76 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
npm install
- run: |
npm run all
test: # make sure the action works on a clean machine without building
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
test-ce: # make sure the action works on a clean machine without building
name: CE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -40,14 +40,6 @@ jobs:
java-version: '17'
components: 'native-image'
os: windows-2022
- version: 'mandrel-latest'
java-version: '11'
components: ''
os: ubuntu-latest
- version: 'mandrel-21.3.0.0-Final'
java-version: '17'
components: ''
os: windows-latest
steps:
- uses: actions/checkout@v2
- name: Run setup-graalvm action
Expand All @@ -60,6 +52,79 @@ jobs:
- name: Check environment
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
if [[ "${{ matrix.version }}" == "dev" ]]; then
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
else
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
fi
echo "JAVA_HOME: $JAVA_HOME"
java --version
java --version | grep "GraalVM CE" || exit 34
native-image --version
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
echo "JAVA_HOME: $env:JAVA_HOME"
java --version
native-image.cmd --version
if: runner.os == 'Windows'
test-ee:
name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['21.3.0', 'latest']
java-version: ['11', '17']
components: [''] # ['native-image'] (activate after 22.1.0 is released)
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Run setup-graalvm action
uses: ./
with:
version: ${{ matrix.version }}
gds-token: ${{ secrets.GDS_TOKEN }}
java-version: ${{ matrix.java-version }}
components: ${{ matrix.components }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check environment
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
echo "JAVA_HOME: $JAVA_HOME"
java --version
java --version | grep "GraalVM EE" || exit 23
# native-image --version (activate after 22.1.0 is released)
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
echo "JAVA_HOME: $env:JAVA_HOME"
java --version
# native-image.cmd --version (activate after 22.1.0 is released)
if: runner.os == 'Windows'
test-mandrel:
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['mandrel-21.3.0.0-Final', 'mandrel-latest']
java-version: ['11', '17']
os: [windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Run setup-graalvm action
uses: ./
with:
version: ${{ matrix.version }}
java-version: ${{ matrix.java-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check environment
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
Expand Down Expand Up @@ -90,7 +155,7 @@ jobs:
javac HelloWorld.java
native-image --static --libc=musl HelloWorld
./helloworld
test-additional:
test-extensive:
name: extensive tests on ubuntu-latest
runs-on: ubuntu-latest
steps:
Expand Down
44 changes: 44 additions & 0 deletions __tests__/gds.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as path from 'path'
import {downloadGraalVMEE, fetchArtifact} from '../src/gds'
import {expect, test} from '@jest/globals'

const TEST_USER_AGENT = 'GraalVMGitHubActionTest/1.0.4'

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

test('fetch artifacts', async () => {
let artifact = await fetchArtifact(
TEST_USER_AGENT,
'isBase:True',
'21.3.0',
'11'
)
expect(artifact.id).toBe('D540A9EA0F406A12E0530F15000A38C7')
expect(artifact.checksum).toBe(
'78e1ee14861eb6a58fd0d7f64878d544ad11515c237a6557452f4d3a63a070fc'
)
artifact = await fetchArtifact(TEST_USER_AGENT, 'isBase:True', '21.3.0', '17')
expect(artifact.id).toBe('D540A9EA10C26A12E0530F15000A38C7')
expect(artifact.checksum).toBe(
'173e0e2b1f80033115216ebbad574c977e74fc4a37fa30ae5e6eff0f215070f4'
)

await expect(
fetchArtifact(TEST_USER_AGENT, 'isBase:False', '21.3.0', '11')
).rejects.toThrow('Found more than one GDS artifact')
await expect(
fetchArtifact(TEST_USER_AGENT, 'isBase:True', '1.0.0', '11')
).rejects.toThrow('Unable to find JDK11-based GraalVM EE 1.0.0')
})

test('errors when downloading artifacts', async () => {
await expect(downloadGraalVMEE('invalid', '21.3.0', '11')).rejects.toThrow(
'The provided "gds-token" was rejected (reason: "Invalid download token", opc-request-id: /'
)
await expect(downloadGraalVMEE('invalid', '1.0.0', '11')).rejects.toThrow(
'Unable to find JDK11-based GraalVM EE 1.0.0'
)
await expect(downloadGraalVMEE('invalid', '21.3.0', '1')).rejects.toThrow(
'Unable to find JDK1-based GraalVM EE 21.3.0'
)
})
5 changes: 0 additions & 5 deletions __tests__/main.test.ts

This file was deleted.

5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'GitHub Action for GraalVM'
description: 'Set up a specific version of GraalVM Community Edition'
description: 'Set up a specific version of GraalVM Enterprise Edition (EE) or Community Edition (CE)'
author: 'GraalVM Developers'
branding:
icon: 'terminal'
Expand All @@ -8,6 +8,9 @@ inputs:
version:
required: true
description: 'GraalVM version (release, latest, dev).'
gds-token:
required: false
description: 'Download token for the GraalVM Download Service. Set this to use GraalVM EE.'
java-version:
required: true
description: 'Java version (11 or 17, 8 or 16 for older releases).'
Expand Down
Loading