Skip to content

Commit e836145

Browse files
committed
OGM-1591 Test with remote Neo4j on GitHub
fix
1 parent 9fd340c commit e836145

File tree

1 file changed

+119
-1
lines changed

1 file changed

+119
-1
lines changed

.github/workflows/build.yml

+119-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
retention-days: 7
5959

6060
test_remote_mongodb:
61-
name: Test remote mongodb instance
61+
name: Test remote MongoDb instance
6262
runs-on: ubuntu-latest
6363
steps:
6464
- name: Checkout default branch
@@ -98,3 +98,121 @@ jobs:
9898
name: reports-db-ogm
9999
path: './**/build/reports/'
100100
retention-days: 7
101+
102+
test_neo4j_bolt_protocol:
103+
name: Test Neo4j Bolt protocol
104+
env:
105+
HTTP_NEO4J_PORT: 7777
106+
BOLT_NEO4J_PORT: 7687
107+
# Checked by the source code
108+
NEO4J_HOSTNAME: localhost
109+
NEO4J_PORT: 7687
110+
NEO4J_USERNAME: neo4j
111+
NEO4J_PASSWORD: jenkins
112+
runs-on: ubuntu-latest
113+
services:
114+
neo4j:
115+
image: neo4j:3.4
116+
ports:
117+
- 7777:7474
118+
- 7687:7687
119+
steps:
120+
- name: Checkout default branch
121+
uses: actions/checkout@v2
122+
- name: Get year/month for cache key
123+
id: get-date
124+
run: |
125+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
126+
shell: bash
127+
- name: Set up JDK 8
128+
uses: actions/[email protected]
129+
with:
130+
distribution: 'temurin'
131+
java-version: 8
132+
# https://github.com/actions/cache/blob/main/examples.md#java---maven
133+
- name: Cache local Maven repository
134+
uses: actions/cache@v4
135+
with:
136+
path: ~/.m2/repository
137+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
138+
restore-keys: |
139+
${{ runner.os }}-maven-
140+
- name: Set up Maven
141+
run: ./mvnw -v
142+
# A new Neo4j instance will set the credentials for the admin to neo4j:neo4j. we change them to check
143+
# that the tests will pass when we are not using the defaults
144+
- name: Set Neo4j credentials
145+
run: |
146+
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
147+
- name: Validate Neo4j credentials
148+
run: |
149+
curl --user $NEO4J_USERNAME:$NEO4J_PASSWORD http://localhost:$HTTP_NEO4J_PORT/db/data
150+
- name: Test Bolt protocol
151+
run: |
152+
./mvnw verify -pl neo4j -s settings-example.xml -Pneo4j-bolt -am
153+
- name: Upload build reports (if build failed)
154+
uses: actions/upload-artifact@v4
155+
if: ${{ failure() || cancelled() }}
156+
with:
157+
name: reports-db-ogm
158+
path: './**/build/reports/'
159+
retention-days: 7
160+
161+
test_neo4j_http_protocol:
162+
name: Test Neo4j Http protocol
163+
env:
164+
HTTP_NEO4J_PORT: 7777
165+
BOLT_NEO4J_PORT: 7687
166+
# Checked by the source code
167+
NEO4J_HOSTNAME: localhost
168+
NEO4J_PORT: 7777
169+
NEO4J_USERNAME: neo4j
170+
NEO4J_PASSWORD: jenkins
171+
runs-on: ubuntu-latest
172+
services:
173+
neo4j:
174+
image: neo4j:3.4
175+
ports:
176+
- 7777:7474
177+
- 7687:7687
178+
steps:
179+
- name: Checkout default branch
180+
uses: actions/checkout@v2
181+
- name: Get year/month for cache key
182+
id: get-date
183+
run: |
184+
echo "::set-output name=yearmonth::$(/bin/date -u "+%Y-%m")"
185+
shell: bash
186+
- name: Set up JDK 8
187+
uses: actions/[email protected]
188+
with:
189+
distribution: 'temurin'
190+
java-version: 8
191+
# https://github.com/actions/cache/blob/main/examples.md#java---maven
192+
- name: Cache local Maven repository
193+
uses: actions/cache@v4
194+
with:
195+
path: ~/.m2/repository
196+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
197+
restore-keys: |
198+
${{ runner.os }}-maven-
199+
- name: Set up Maven
200+
run: ./mvnw -v
201+
# A new Neo4j instance will set the credentials for the admin to neo4j:neo4j. we change them to check
202+
# that the tests will pass when we are not using the defaults
203+
- name: Set Neo4j credentials
204+
run: |
205+
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
206+
- name: Validate Neo4j credentials
207+
run: |
208+
curl --user $NEO4J_USERNAME:$NEO4J_PASSWORD http://localhost:$HTTP_NEO4J_PORT/db/data
209+
- name: Test Bolt protocol
210+
run: |
211+
./mvnw verify -pl neo4j -s settings-example.xml -Pneo4j-http -am
212+
- name: Upload build reports (if build failed)
213+
uses: actions/upload-artifact@v4
214+
if: ${{ failure() || cancelled() }}
215+
with:
216+
name: reports-db-ogm
217+
path: './**/build/reports/'
218+
retention-days: 7

0 commit comments

Comments
 (0)