diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6858746e..4c4da02a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,8 +17,10 @@ jobs: with: java-version: "17" distribution: "oracle" - - name: Run the Maven tests - run: mvn test + - name: Maven tests + run: | + ./tools/mvn_test.sh + shell: bash publish: runs-on: ubuntu-latest @@ -28,7 +30,7 @@ jobs: uses: dev-vince/actions-publish-javadoc@v1.0.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - java-version: "17" # Replace with your java version. Default is 17 - java-distribution: "adopt" # The distributor of the target JDK. See https://github.com/actions/setup-java for more information. Defauly is adopt - project: maven # The project type. By default maven - branch: "gh-pages" # The branch for the javadoc contents. By default gh-pages + java-version: "17" + java-distribution: "adopt" # The distributor of the target JDK. See https://github.com/actions/setup-java for more information. + project: maven # The project type. + branch: "gh-pages" # The branch for the javadoc contents. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..48b9fba4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Maven Tests + +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: "17" + distribution: "oracle" + - name: Maven tests + run: | + ./tools/mvn_test.sh + shell: bash \ No newline at end of file diff --git a/tools/mvn_test.sh b/tools/mvn_test.sh new file mode 100644 index 00000000..5548a21b --- /dev/null +++ b/tools/mvn_test.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -ex + +function stop_docker() +{ + echo "Stopping qdrant_test" + docker stop qdrant_test +} + +# Ensure current path is project root +cd "$(dirname "$0")/../" + +QDRANT_VERSION='v1.6.1' + +QDRANT_HOST='localhost:6333' + +docker run -d --rm \ + -p 6333:6333 \ + -p 6334:6334 \ + --name qdrant_test qdrant/qdrant:${QDRANT_VERSION} + +trap stop_docker SIGINT +trap stop_docker ERR + +until curl --output /dev/null --silent --get --fail http://$QDRANT_HOST/collections; do + printf 'Waiting for the Qdrant server to start...' + sleep 5 +done + +mvn test + +stop_docker \ No newline at end of file