From eee7347f52db117ee31ac891354257d47ffbdd6f Mon Sep 17 00:00:00 2001 From: Mark Pollack Date: Mon, 2 Dec 2024 15:21:05 -0500 Subject: [PATCH] Add some vector stores to IT tests to run --- .../actions/do-integration-test/action.yml | 2 +- .../actions/do-multi-module-test/action.yml | 45 +++++++++++++++++++ .../workflows/spring-ai-integration-tests.yml | 13 ++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/actions/do-multi-module-test/action.yml diff --git a/.github/actions/do-integration-test/action.yml b/.github/actions/do-integration-test/action.yml index 926c795..910e513 100644 --- a/.github/actions/do-integration-test/action.yml +++ b/.github/actions/do-integration-test/action.yml @@ -6,7 +6,7 @@ inputs: description: "SpringAI Model to integration test" required: true maven-properties: - description: "Maven properties to pass to the build (e.g., -Dskip.vectorstore.milvus=true -Dskip.vectorstore.neo4j=true)" + description: "Maven properties to pass to the build required: false default: "" diff --git a/.github/actions/do-multi-module-test/action.yml b/.github/actions/do-multi-module-test/action.yml new file mode 100644 index 0000000..3be2751 --- /dev/null +++ b/.github/actions/do-multi-module-test/action.yml @@ -0,0 +1,45 @@ +name: "Setup for SpringAI Multi-Module Tests" +description: "Setup For SpringAI Multi-Module Tests" + +inputs: + modules: + description: "Comma-separated list of modules to test" + required: true + maven-properties: + description: "Maven properties to pass to the build" + required: false + default: "" + +runs: + using: "composite" + steps: + - name: Check environment + uses: actions/github-script@v7 + with: + script: | + const env = ${{ toJson(env) }} + const emptyEnvEntries = Object.entries(env).filter(e => e[1].length === 0) + emptyEnvEntries.length > 0 && + core.setFailed('Missing value for environment variable(s): ' + emptyEnvEntries.map(e => e[0]).join(', ')); + + - name: Check out repository code + uses: actions/checkout@v4 + with: + repository: spring-projects/spring-ai + ref: refs/heads/main + path: spring-ai + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + + - name: Install + shell: bash + run: cd spring-ai && ./mvnw install -DskipTests + + - name: Run integration tests + shell: bash + run: cd spring-ai && ./mvnw -pl ${{ inputs.modules }} -Pintegration-tests ${{ inputs.maven-properties }} -Dfailsafe.rerunFailingTestsCount=2 verify \ No newline at end of file diff --git a/.github/workflows/spring-ai-integration-tests.yml b/.github/workflows/spring-ai-integration-tests.yml index c0b087b..32c2bc0 100644 --- a/.github/workflows/spring-ai-integration-tests.yml +++ b/.github/workflows/spring-ai-integration-tests.yml @@ -198,6 +198,19 @@ jobs: # with: # model-name: vertex-ai-gemini + test-vectorstores: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Configure Testcontainers + run: | + mkdir -p $HOME + echo "testcontainers.reuse.enable = true" >> $HOME/.testcontainers.properties + - name: Integration Test + uses: ./.github/actions/do-multi-module-test + with: + modules: spring-ai-vector-store/spring-ai-vector-store-chroma, spring-ai-vector-store/spring-ai-vector-store-neo4j, spring-ai-vector-store/spring-ai-vector-store-pgvector, spring-ai-vector-store/spring-ai-vector-store-redis + test-autoconfigure: env: # TODO: uncomment keys that have values