From bc81a295e65b383dbd1134f8cf10e6c1294f4c6f Mon Sep 17 00:00:00 2001 From: Theo Kanning Date: Sun, 12 Nov 2023 17:18:56 -0600 Subject: [PATCH] Require all steps to run in java 1.8 There's definitely a better way to manage version, but trying to run individual steps against later versions was causing my problems than it solved. I'll think of the best way to handle this. --- .github/workflows/gradle-wrapper-validation.yml | 14 -------------- .github/workflows/publish.yml | 12 +++--------- .github/workflows/pull_request.yml | 13 ++----------- .github/workflows/test.yml | 4 ++-- .../example/OpenAiApiDynamicFunctionExample.java | 2 +- .../openai/service/ChatCompletionTest.java | 10 +++------- 6 files changed, 11 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/gradle-wrapper-validation.yml diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index 805c1fcf..00000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Validate Gradle Wrapper" -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - validation: - name: "Validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: gradle/wrapper-validation-action@v1 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d2e93051..6e978294 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,25 +12,19 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK 1.8 uses: actions/setup-java@v3 with: distribution: temurin - java-version: 17 + java-version: 8 - name: Test run: ./gradlew test env: OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }} - - name: Set up JDK 1.8 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 8 - - name: Publish - run: ./gradlew build -x :example:build publish --no-parallel + run: ./gradlew build publish --no-parallel env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8ea36f7e..77d94afb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -17,14 +17,5 @@ jobs: distribution: temurin java-version: 8 - - name: Compile Artifacts - run: ./gradlew api:compileJava client:compileJava service:compileJava - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 17 - - - name: Compile Tests - run: ./gradlew compileTestJava + - name: Compile + run: ./gradlew compileJava compileTestJava diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf169464..830e797f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,11 +11,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK 1.8 uses: actions/setup-java@v3 with: distribution: temurin - java-version: 17 + java-version: 8 - name: Test run: ./gradlew test --stacktrace diff --git a/example/src/main/java/example/OpenAiApiDynamicFunctionExample.java b/example/src/main/java/example/OpenAiApiDynamicFunctionExample.java index ee83689d..75f9b8e2 100644 --- a/example/src/main/java/example/OpenAiApiDynamicFunctionExample.java +++ b/example/src/main/java/example/OpenAiApiDynamicFunctionExample.java @@ -36,7 +36,7 @@ public static void main(String... args) { .name("unit") .type("string") .description("The temperature unit, can be 'celsius' or 'fahrenheit'") - .enumValues(Set.of("celsius", "fahrenheit")) + .enumValues(new HashSet<>(Arrays.asList("celsius", "fahrenheit"))) .required(true) .build()) .build(); diff --git a/service/src/test/java/com/theokanning/openai/service/ChatCompletionTest.java b/service/src/test/java/com/theokanning/openai/service/ChatCompletionTest.java index 41eb498d..25f0defb 100644 --- a/service/src/test/java/com/theokanning/openai/service/ChatCompletionTest.java +++ b/service/src/test/java/com/theokanning/openai/service/ChatCompletionTest.java @@ -7,11 +7,7 @@ import com.theokanning.openai.completion.chat.*; import org.junit.jupiter.api.Test; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.Collections; +import java.util.*; import static org.junit.jupiter.api.Assertions.*; @@ -164,7 +160,7 @@ void createChatCompletionWithDynamicFunctions() { .name("unit") .type("string") .description("The temperature unit, can be 'celsius' or 'fahrenheit'") - .enumValues(Set.of("celsius", "fahrenheit")) + .enumValues(new HashSet<>(Arrays.asList("celsius", "fahrenheit"))) .required(true) .build()) .build(); @@ -273,7 +269,7 @@ void streamChatCompletionWithDynamicFunctions() { .name("unit") .type("string") .description("The temperature unit, can be 'celsius' or 'fahrenheit'") - .enumValues(Set.of("celsius", "fahrenheit")) + .enumValues(new HashSet<>(Arrays.asList("celsius", "fahrenheit"))) .required(true) .build()) .build();