]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
ci: configure the database to run two-phase-commit tests
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 20 Dec 2022 20:19:23 +0000 (20:19 +0000)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 22 Dec 2022 03:32:27 +0000 (03:32 +0000)
We can't use the Github Actions PostgreSQL service because it doesn't
seem possible to configure the server for stored transactions:

- the service yaml definition doesn't take args to pass to run
- we can't overwrite the entry point with a script of ours because the
  service starts before actions/checkout
- the postgres image doesn't allow to pass extra parameters to the
  server via an env var

.github/workflows/tests.yml

index 9f6a7f535ca6fc6bcb97a72d8a932317e39f34ff..cd263bdab5f22c102c624b5e316dfc4cee8c5575 100644 (file)
@@ -58,6 +58,15 @@ jobs:
         with:
           python-version: ${{ matrix.python }}
 
+      - name: Run PostgreSQL
+        # Note: this would love to be a service, but I don't see a way to pass
+        # the args to the docker run command line.
+        run: |
+          docker pull ${{ matrix.postgres }}
+          docker run --rm -d --name postgres -p 5432:5432 \
+            -e POSTGRES_PASSWORD=password ${{ matrix.postgres }} \
+            -c max_prepared_transactions=10
+
       - name: Install the newest libpq version available
         if: ${{ matrix.libpq == 'newest' }}
         run: |
@@ -108,20 +117,6 @@ jobs:
       - name: Run tests
         run: ./tools/build/ci_test.sh
 
-    services:
-      postgresql:
-        image: ${{ matrix.postgres }}
-        env:
-          POSTGRES_PASSWORD: password
-        ports:
-          - 5432:5432
-        # Set health checks to wait until postgres has started
-        options: >-
-          --health-cmd pg_isready
-          --health-interval 10s
-          --health-timeout 5s
-          --health-retries 5
-
 
   # }}}