From f94a3740b42adce3a9b481499205daa463bd204c Mon Sep 17 00:00:00 2001 From: Tyson McNulty Date: Tue, 1 Oct 2024 12:45:05 -0400 Subject: [PATCH] Add Spring AI integration test workflows - Azure OpenAI, Bedrock jobs in automated workflow - MiniMax, Moonshot, Qianfan, and Zhipu AI jobs in manual-only workflow - Spring Boot Autoconfigure jobs in both workflows - Secrets configured and consumed from repository-level secrets for actions --- ...pring-ai-integration-tests-manual-only.yml | 147 ++++++++++++++++++ .../workflows/spring-ai-integration-tests.yml | 90 +++++++++++ README.md | 2 + 3 files changed, 239 insertions(+) create mode 100644 .github/workflows/spring-ai-integration-tests-manual-only.yml create mode 100644 .github/workflows/spring-ai-integration-tests.yml diff --git a/.github/workflows/spring-ai-integration-tests-manual-only.yml b/.github/workflows/spring-ai-integration-tests-manual-only.yml new file mode 100644 index 0000000..9f3bcf0 --- /dev/null +++ b/.github/workflows/spring-ai-integration-tests-manual-only.yml @@ -0,0 +1,147 @@ +name: Spring AI Integration Tests (Manual Only) +run-name: Spring AI Integration Tests (Manual Only) +on: + - workflow_dispatch + +jobs: + test-minimax: + env: + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} + runs-on: ubuntu-latest + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run MiniMax model tests + run: ./mvnw -pl models/spring-ai-minimax -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-moonshot: + env: + MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }} + runs-on: ubuntu-latest + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Moonshot model tests + run: ./mvnw -pl models/spring-ai-moonshot -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-qianfan: + env: + QIANFAN_API_KEY: ${{ secrets.QIANFAN_API_KEY }} + QIANFAN_SECRET_KEY: ${{ secrets.QIANFAN_SECRET_KEY }} + runs-on: ubuntu-latest + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Qianfan model tests + run: ./mvnw -pl models/spring-ai-qianfan -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-zhipu-ai: + env: + ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }} + runs-on: ubuntu-latest + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Zhipu AI model tests + run: ./mvnw -pl models/spring-ai-zhipu -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-autoconfigure: + env: + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} + MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }} + QIANFAN_API_KEY: ${{ secrets.QIANFAN_API_KEY }} + QIANFAN_SECRET_KEY: ${{ secrets.QIANFAN_SECRET_KEY }} + ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }} + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Spring Boot Autoconfigure tests + run: ./mvnw -pl spring-ai-spring-boot-autoconfigure -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify diff --git a/.github/workflows/spring-ai-integration-tests.yml b/.github/workflows/spring-ai-integration-tests.yml new file mode 100644 index 0000000..36e760f --- /dev/null +++ b/.github/workflows/spring-ai-integration-tests.yml @@ -0,0 +1,90 @@ +name: Spring AI Integration Tests +run-name: Spring AI Integration Tests +on: + - push + - workflow_dispatch + +jobs: + test-azure: + env: + AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} + AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} + runs-on: ubuntu-latest + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Azure OpenAI model tests + run: ./mvnw -pl models/spring-ai-azure-openai -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-bedrock: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + Object.values(env).some(v => v.length === 0) && + core.setFailed('Missing one or more secrets: ' + Object.keys(env).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Bedrock model tests + run: ./mvnw -pl models/spring-ai-bedrock -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify + + test-autoconfigure: + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} + AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Install + run: ./mvnw install -DskipTests + - name: Run Spring Boot Autoconfigure tests + run: ./mvnw -pl spring-ai-spring-boot-autoconfigure -Pintegration-tests -Dfailsafe.rerunFailingTestsCount=2 verify diff --git a/README.md b/README.md index 1854e16..e42a5e9 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # spring-ai-integration-tests + +This repository contains workflows that define the integration test automation for the Spring AI project.