diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16ae663a56..68318bcf3d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: retention-days: 7 test_remote_mongodb: - name: Test remote mongodb instance + name: Test remote MongoDb instance runs-on: ubuntu-latest steps: - name: Checkout default branch @@ -98,3 +98,121 @@ jobs: name: reports-db-ogm path: './**/build/reports/' retention-days: 7 + + test_neo4j_bolt_protocol: + name: Test Neo4j Bolt protocol + env: + HTTP_NEO4J_PORT: 7777 + BOLT_NEO4J_PORT: 7687 + # Checked by the source code + NEO4J_HOSTNAME: localhost + NEO4J_PORT: 7687 + NEO4J_USERNAME: neo4j + NEO4J_PASSWORD: jenkins + runs-on: ubuntu-latest + services: + neo4j: + image: neo4j:3.4 + ports: + - 7777:7474 + - 7687:7687 + steps: + - name: Checkout default branch + uses: actions/checkout@v2 + - name: Get year/month for cache key + id: get-date + run: | + echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")" + shell: bash + - name: Set up JDK 8 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'temurin' + java-version: 8 + # https://github.com/actions/cache/blob/main/examples.md#java---maven + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set up Maven + run: ./mvnw -v + # A new Neo4j instance will set the credentials for the admin to neo4j:neo4j. we change them to check + # that the tests will pass when we are not using the defaults + - name: Set Neo4j credentials + run: | + curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic `echo -n 'neo4j:neo4j' | base64`" -d "{\"password\":\"$NEO4J_PASSWORD\"}" http://localhost:$HTTP_NEO4J_PORT/user/neo4j/password + - name: Validate Neo4j credentials + run: | + curl --user $NEO4J_USERNAME:$NEO4J_PASSWORD http://localhost:$HTTP_NEO4J_PORT/db/data + - name: Test Bolt protocol + run: | + ./mvnw verify -pl neo4j -s settings-example.xml -Pneo4j-bolt -am + - name: Upload build reports (if build failed) + uses: actions/upload-artifact@v4 + if: ${{ failure() || cancelled() }} + with: + name: reports-db-ogm + path: './**/build/reports/' + retention-days: 7 + + test_neo4j_http_protocol: + name: Test Neo4j Http protocol + env: + HTTP_NEO4J_PORT: 7777 + BOLT_NEO4J_PORT: 7687 + # Checked by the source code + NEO4J_HOSTNAME: localhost + NEO4J_PORT: 7777 + NEO4J_USERNAME: neo4j + NEO4J_PASSWORD: jenkins + runs-on: ubuntu-latest + services: + neo4j: + image: neo4j:3.4 + ports: + - 7777:7474 + - 7687:7687 + steps: + - name: Checkout default branch + uses: actions/checkout@v2 + - name: Get year/month for cache key + id: get-date + run: | + echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")" + shell: bash + - name: Set up JDK 8 + uses: actions/setup-java@v2.2.0 + with: + distribution: 'temurin' + java-version: 8 + # https://github.com/actions/cache/blob/main/examples.md#java---maven + - name: Cache local Maven repository + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Set up Maven + run: ./mvnw -v + # A new Neo4j instance will set the credentials for the admin to neo4j:neo4j. we change them to check + # that the tests will pass when we are not using the defaults + - name: Set Neo4j credentials + run: | + curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic `echo -n 'neo4j:neo4j' | base64`" -d "{\"password\":\"$NEO4J_PASSWORD\"}" http://localhost:$HTTP_NEO4J_PORT/user/neo4j/password + - name: Validate Neo4j credentials + run: | + curl --user $NEO4J_USERNAME:$NEO4J_PASSWORD http://localhost:$HTTP_NEO4J_PORT/db/data + - name: Test Bolt protocol + run: | + ./mvnw verify -pl neo4j -s settings-example.xml -Pneo4j-http -am + - name: Upload build reports (if build failed) + uses: actions/upload-artifact@v4 + if: ${{ failure() || cancelled() }} + with: + name: reports-db-ogm + path: './**/build/reports/' + retention-days: 7