From 55ea56bf8717500343372eefa135b8bcb416711a Mon Sep 17 00:00:00 2001 From: Julien Dubois Date: Mon, 7 Sep 2026 10:09:38 +0200 Subject: [PATCH] Add CI job running the tests against a real PostgreSQL service The existing `build` job runs the suite against in-memory H2, so the org.postgresql:r2dbc-postgresql driver the sample actually ships with is never exercised in CI. A driver-level regression would go unnoticed. Adds a `build-postgres` job that reruns the same tests against a postgres:16 service container, overriding only the connection settings via environment variables (OS env outranks application.properties in Spring Boot's property order, so no code or test changes are needed). The `build` job is left untouched so its check name is unchanged and any branch protection rules keep working. Verified locally against a postgres:16 container matching the service block: 5/5 tests pass and schema.sql creates the `todo` table on PostgreSQL. Confirmed the override actually takes effect by pointing the URL at a dead port, which fails all 5 tests rather than silently falling back to H2. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1427cea2-8234-45b7-8b01-c6ad27a39450 --- .github/workflows/junit-tests.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/junit-tests.yml b/.github/workflows/junit-tests.yml index a9346da..22b9e28 100644 --- a/.github/workflows/junit-tests.yml +++ b/.github/workflows/junit-tests.yml @@ -24,3 +24,41 @@ jobs: cache: maven - name: Build with Maven run: mvn test + + # The `build` job above runs the suite against in-memory H2, which never + # exercises the PostgreSQL driver this sample actually ships with. This job + # reruns the same tests against a real PostgreSQL server so that regressions + # in the org.postgresql:r2dbc-postgresql path are caught. + build-postgres: + + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:16 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: demo + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres -d demo" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Set up Java + uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0 + with: + java-version: 17 + distribution: temurin + cache: maven + - name: Build with Maven + run: mvn test + env: + SPRING_R2DBC_URL: r2dbc:postgresql://localhost:5432/demo + SPRING_R2DBC_USERNAME: postgres + SPRING_R2DBC_PASSWORD: postgres