@@ -319,6 +319,60 @@ jobs:
319319 command : |
320320 ./mvnw -ntp -B package -Pci -Dgroups=com.querydsl.core.testutil.EmbeddedDatabase
321321 - save-test-results
322+ testDB2 :
323+ # Use the machine executor so we have full VM capabilities (e.g. docker running as admin)
324+ machine : true
325+ working_directory : ~/querydsl
326+ environment :
327+ # You can also set any DB2-specific environment variables here if needed
328+ DB2INST1_PASSWORD : a3sd!fDj
329+ steps :
330+ - checkout
331+ - restore_cache :
332+ keys :
333+ - querydsl-dependencies-{{ checksum "pom.xml" }}
334+ # Start the DB2 container in detached mode
335+ - run :
336+ name : " Start DB2 container"
337+ command : |
338+ # Start the DB2 container with the same settings as your docker-compose file
339+ docker run -d --privileged --name db2 \
340+ -p 50000:50000 \
341+ -e DB2INST1_PASSWORD=a3sd!fDj \
342+ -e DB2INSTANCE=db2inst1 \
343+ -e DBNAME=sample \
344+ -e LICENSE=accept \
345+ -e ARCHIVE_LOGS=false \
346+ -e AUTOCONFIG=false \
347+ ibmcom/db2:11.5.0.0
348+
349+ echo "Waiting for DB2 container to become healthy..."
350+ # Wait for the container to report a healthy status (check every 5 seconds, for up to ~240 seconds)
351+ counter=0
352+ while [ "$(docker inspect --format='{{.State.Health.Status}}' db2)" != "healthy" ] && [ $counter -lt 48 ]; do
353+ echo "Waiting... $(( counter * 5 )) seconds elapsed"
354+ sleep 5
355+ counter=$((counter + 1))
356+ done
357+
358+ if [ $counter -ge 48 ]; then
359+ echo "DB2 container did not become healthy in time."
360+ exit 1
361+ fi
362+
363+ docker ps
364+
365+ # Run your tests against DB2; adjust the Maven command according to your project
366+ - run :
367+ name : " Run DB2 tests"
368+ command : |
369+ ./mvnw -ntp -B package -Pci -Dgroups=com.querydsl.core.testutil.DB2
370+ # Clean up the DB2 container once the tests are done
371+ - run :
372+ name : " Stop and remove DB2 container"
373+ command : |
374+ docker stop db2 && docker rm db2
375+ - save-test-results
322376
323377 deploySnapshot :
324378 executor :
@@ -428,6 +482,12 @@ workflows:
428482 - ' Resolve dependencies'
429483 filters :
430484 << : *all-branches
485+ - testDB2 :
486+ name : ' Test DB2'
487+ requires :
488+ - ' Resolve dependencies'
489+ filters :
490+ << : *all-branches
431491
432492 snapshot :
433493 jobs :
0 commit comments