Skip to content

feat(client): publish GraalVM metadata files #534

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

Merged
merged 2 commits into from
Jul 17, 2025
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
33 changes: 32 additions & 1 deletion .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Set up Java
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
Expand All @@ -36,6 +36,37 @@ jobs:
if: ${{ steps.release.outputs.releases_created }}
uses: gradle/gradle-build-action@v2

- name: Compile the openai-java-core project
run: |
./gradlew :openai-java-core:compileJava :openai-java-core:compileTestJava -x test

- name: Run the Prism server
run: |
./scripts/mock --daemon

- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: 21
distribution: 'graalvm-community'
cache: gradle

- name: Run tests on the openai-java-core project with the GraalVM native-image agent
run: |
./gradlew :openai-java-core:test -x compileJava -x compileTestJava -x compileKotlin -x compileTestKotlin -PgraalvmAgent

- name: Check generated GraalVM file
run: |
echo "Checking for GraalVM agent metadata files..."
DIRECTORY=openai-java-core/src/main/resources/META-INF/native-image
if [ -d "$DIRECTORY" ] && [ "$(ls -A $DIRECTORY)" ]; then
echo "Files found in $DIRECTORY:"
ls -l $DIRECTORY
else
echo "No files found in $DIRECTORY"
exit 1
fi

- name: Publish to Sonatype
if: ${{ steps.release.outputs.releases_created }}
run: |-
Expand Down
17 changes: 17 additions & 0 deletions openai-java-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id("java")
id("openai.kotlin")
id("openai.publish")
}
Expand Down Expand Up @@ -43,3 +44,19 @@ dependencies {
testImplementation("org.mockito:mockito-junit-jupiter:5.14.2")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.1.0")
}

if (project.hasProperty("graalvmAgent")) {
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.GRAAL_VM)
}
}

tasks.test {
maxParallelForks = 1
forkEvery = 0
jvmArgs =
listOf("-agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image")
}
}
Loading