summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:41:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:41:08 +0000
commit506ed8899b3a97e512be3fd6d44d5b11463bf9bf (patch)
tree808913770c5e6935d3714058c2a066c57b4632ec /.github/workflows
parentInitial commit. (diff)
downloadpsycopg3-506ed8899b3a97e512be3fd6d44d5b11463bf9bf.tar.xz
psycopg3-506ed8899b3a97e512be3fd6d44d5b11463bf9bf.zip
Adding upstream version 3.1.7.upstream/3.1.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/docs.yml22
-rw-r--r--.github/workflows/lint.yml48
-rw-r--r--.github/workflows/packages-pool.yml66
-rw-r--r--.github/workflows/packages.yml256
-rw-r--r--.github/workflows/tests.yml314
5 files changed, 706 insertions, 0 deletions
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..1dd1e94
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,22 @@
+name: Build documentation
+
+on:
+ push:
+ branches:
+ # This should match the DOC3_BRANCH value in the psycopg-website Makefile
+ - master
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref_name }}
+ cancel-in-progress: true
+
+jobs:
+ docs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Trigger docs build
+ uses: peter-evans/repository-dispatch@v1
+ with:
+ repository: psycopg/psycopg-website
+ event-type: psycopg3-commit
+ token: ${{ secrets.ACCESS_TOKEN }}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..4527551
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,48 @@
+name: Lint
+
+on:
+ push:
+ # This should disable running the workflow on tags, according to the
+ # on.<push|pull_request>.<branches|tags> GitHub Actions docs.
+ branches:
+ - "*"
+ pull_request:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref_name }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.10"
+
+ - name: install packages to tests
+ run: pip install ./psycopg[dev,test] codespell
+
+ - name: Run black
+ run: black --check --diff .
+
+ - name: Run flake8
+ run: flake8
+
+ - name: Run mypy
+ run: mypy
+
+ - name: Check spelling
+ run: codespell
+
+ - name: Install requirements to generate docs
+ run: sudo apt-get install -y libgeos-dev
+
+ - name: Install Python packages to generate docs
+ run: pip install ./psycopg[docs] ./psycopg_pool
+
+ - name: Check documentation
+ run: sphinx-build -W -T -b html docs docs/_build/html
diff --git a/.github/workflows/packages-pool.yml b/.github/workflows/packages-pool.yml
new file mode 100644
index 0000000..e9624e7
--- /dev/null
+++ b/.github/workflows/packages-pool.yml
@@ -0,0 +1,66 @@
+name: Build pool packages
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '28 6 * * sun'
+
+jobs:
+
+ sdist:
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {package: psycopg_pool, format: sdist, impl: python}
+ - {package: psycopg_pool, format: wheel, impl: python}
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: 3.9
+
+ - name: Create the sdist packages
+ run: |-
+ python ${{ matrix.package }}/setup.py sdist -d `pwd`/dist/
+ if: ${{ matrix.format == 'sdist' }}
+
+ - name: Create the wheel packages
+ run: |-
+ pip install wheel
+ python ${{ matrix.package }}/setup.py bdist_wheel -d `pwd`/dist/
+ if: ${{ matrix.format == 'wheel' }}
+
+ - name: Install the Python pool package and test requirements
+ run: |-
+ pip install dist/*
+ pip install ./psycopg[test]
+
+ - name: Test the sdist package
+ run: pytest -m 'not slow and not flakey' --color yes
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
+ PGPASSWORD: password
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./dist/*
+
+ services:
+ postgresql:
+ image: postgres:14
+ 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
diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml
new file mode 100644
index 0000000..18a2817
--- /dev/null
+++ b/.github/workflows/packages.yml
@@ -0,0 +1,256 @@
+name: Build packages
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '28 7 * * sun'
+
+jobs:
+
+ sdist: # {{{
+ runs-on: ubuntu-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {package: psycopg, format: sdist, impl: python}
+ - {package: psycopg, format: wheel, impl: python}
+ - {package: psycopg_c, format: sdist, impl: c}
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: 3.9
+
+ - name: Create the sdist packages
+ run: |-
+ python ${{ matrix.package }}/setup.py sdist -d `pwd`/dist/
+ if: ${{ matrix.format == 'sdist' }}
+
+ - name: Create the wheel packages
+ run: |-
+ pip install wheel
+ python ${{ matrix.package }}/setup.py bdist_wheel -d `pwd`/dist/
+ if: ${{ matrix.format == 'wheel' }}
+
+ - name: Install the Python package and test requirements
+ run: |-
+ pip install `ls dist/*`[test]
+ pip install ./psycopg_pool
+ if: ${{ matrix.package == 'psycopg' }}
+
+ - name: Install the C package and test requirements
+ run: |-
+ pip install dist/*
+ pip install ./psycopg[test]
+ pip install ./psycopg_pool
+ if: ${{ matrix.package == 'psycopg_c' }}
+
+ - name: Test the sdist package
+ run: pytest -m 'not slow and not flakey' --color yes
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
+ PGPASSWORD: password
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./dist/*
+
+ services:
+ postgresql:
+ image: postgres:14
+ 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
+
+
+ # }}}
+
+ linux: # {{{
+ runs-on: ubuntu-latest
+ if: true
+
+ env:
+ LIBPQ_VERSION: "15.1"
+ OPENSSL_VERSION: "1.1.1s"
+
+ strategy:
+ fail-fast: false
+ matrix:
+ arch: [x86_64, i686, ppc64le, aarch64]
+ pyver: [cp37, cp38, cp39, cp310, cp311]
+ platform: [manylinux, musllinux]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Set up QEMU for multi-arch build
+ # Check https://github.com/docker/setup-qemu-action for newer versions.
+ uses: docker/setup-qemu-action@v2
+ with:
+ # Note: 6.2.0 is buggy: make sure to avoid it.
+ # See https://github.com/pypa/cibuildwheel/issues/1250
+ image: tonistiigi/binfmt:qemu-v7.0.0
+
+ - name: Cache libpq build
+ uses: actions/cache@v3
+ with:
+ path: /tmp/libpq.build
+ key: libpq-${{ env.LIBPQ_VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}-2
+
+ - name: Create the binary package source tree
+ run: python3 ./tools/build/copy_to_binary.py
+
+ - name: Build wheels
+ uses: pypa/cibuildwheel@v2.9.0
+ with:
+ package-dir: psycopg_binary
+ env:
+ CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
+ CIBW_MANYLINUX_I686_IMAGE: manylinux2014
+ CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
+ CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014
+ CIBW_BUILD: ${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}}
+ CIBW_ARCHS_LINUX: auto aarch64 ppc64le
+ CIBW_BEFORE_ALL_LINUX: ./tools/build/wheel_linux_before_all.sh
+ CIBW_REPAIR_WHEEL_COMMAND: >-
+ ./tools/build/strip_wheel.sh {wheel}
+ && auditwheel repair -w {dest_dir} {wheel}
+ CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
+ CIBW_TEST_COMMAND: >-
+ pytest {project}/tests -m 'not slow and not flakey' --color yes
+ CIBW_ENVIRONMENT_PASS_LINUX: LIBPQ_VERSION OPENSSL_VERSION
+ CIBW_ENVIRONMENT: >-
+ PSYCOPG_IMPL=binary
+ PSYCOPG_TEST_DSN='host=172.17.0.1 user=postgres'
+ PGPASSWORD=password
+ LIBPQ_BUILD_PREFIX=/host/tmp/libpq.build
+ PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH"
+ LD_LIBRARY_PATH="$LIBPQ_BUILD_PREFIX/lib"
+ PSYCOPG_TEST_WANT_LIBPQ_BUILD=${{ env.LIBPQ_VERSION }}
+ PSYCOPG_TEST_WANT_LIBPQ_IMPORT=${{ env.LIBPQ_VERSION }}
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./wheelhouse/*.whl
+
+ services:
+ postgresql:
+ image: postgres:14
+ 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
+
+
+ # }}}
+
+ macos: # {{{
+ runs-on: macos-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ # These archs require an Apple M1 runner: [arm64, universal2]
+ arch: [x86_64]
+ pyver: [cp37, cp38, cp39, cp310, cp311]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Create the binary package source tree
+ run: python3 ./tools/build/copy_to_binary.py
+
+ - name: Build wheels
+ uses: pypa/cibuildwheel@v2.9.0
+ with:
+ package-dir: psycopg_binary
+ env:
+ CIBW_BUILD: ${{matrix.pyver}}-macosx_${{matrix.arch}}
+ CIBW_ARCHS_MACOS: x86_64
+ CIBW_BEFORE_ALL_MACOS: ./tools/build/wheel_macos_before_all.sh
+ CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
+ CIBW_TEST_COMMAND: >-
+ pytest {project}/tests -m 'not slow and not flakey' --color yes
+ CIBW_ENVIRONMENT: >-
+ PSYCOPG_IMPL=binary
+ PSYCOPG_TEST_DSN='dbname=postgres'
+ PSYCOPG_TEST_WANT_LIBPQ_BUILD=">= 14"
+ PSYCOPG_TEST_WANT_LIBPQ_IMPORT=">= 14"
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./wheelhouse/*.whl
+
+
+ # }}}
+
+ windows: # {{{
+ runs-on: windows-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ # Might want to add win32, untested at the moment.
+ arch: [win_amd64]
+ pyver: [cp37, cp38, cp39, cp310, cp311]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Start PostgreSQL service for test
+ run: |
+ $PgSvc = Get-Service "postgresql*"
+ Set-Service $PgSvc.Name -StartupType manual
+ $PgSvc.Start()
+
+ - name: Create the binary package source tree
+ run: python3 ./tools/build/copy_to_binary.py
+
+ - name: Build wheels
+ uses: pypa/cibuildwheel@v2.9.0
+ with:
+ package-dir: psycopg_binary
+ env:
+ CIBW_BUILD: ${{matrix.pyver}}-${{matrix.arch}}
+ CIBW_ARCHS_WINDOWS: AMD64 x86
+ CIBW_BEFORE_BUILD_WINDOWS: '.\tools\build\wheel_win32_before_build.bat'
+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >-
+ delvewheel repair -w {dest_dir}
+ --no-mangle "libiconv-2.dll;libwinpthread-1.dll" {wheel}
+ CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
+ CIBW_TEST_COMMAND: >-
+ pytest {project}/tests -m "not slow and not flakey" --color yes
+ CIBW_ENVIRONMENT_WINDOWS: >-
+ PSYCOPG_IMPL=binary
+ PATH="C:\\Program Files\\PostgreSQL\\14\\bin;$PATH"
+ PSYCOPG_TEST_DSN="host=127.0.0.1 user=postgres"
+ PSYCOPG_TEST_WANT_LIBPQ_BUILD=">= 14"
+ PSYCOPG_TEST_WANT_LIBPQ_IMPORT=">= 14"
+
+ - uses: actions/upload-artifact@v3
+ with:
+ path: ./wheelhouse/*.whl
+
+
+ # }}}
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..9f6a7f5
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,314 @@
+name: Tests
+
+on:
+ push:
+ # This should disable running the workflow on tags, according to the
+ # on.<push|pull_request>.<branches|tags> GitHub Actions docs.
+ branches:
+ - "*"
+ pull_request:
+ schedule:
+ - cron: '48 6 * * *'
+
+concurrency:
+ # Cancel older requests of the same workflow in the same branch.
+ group: ${{ github.workflow }}-${{ github.ref_name }}
+ cancel-in-progress: true
+
+jobs:
+
+ linux: # {{{
+ runs-on: ubuntu-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ # Test different combinations of Python, Postgres, libpq.
+ - {impl: python, python: "3.7", postgres: "postgres:10", libpq: newest}
+ - {impl: python, python: "3.8", postgres: "postgres:12"}
+ - {impl: python, python: "3.9", postgres: "postgres:13"}
+ - {impl: python, python: "3.10", postgres: "postgres:14"}
+ - {impl: python, python: "3.11", postgres: "postgres:15", libpq: oldest}
+
+ - {impl: c, python: "3.7", postgres: "postgres:15", libpq: newest}
+ - {impl: c, python: "3.8", postgres: "postgres:13"}
+ - {impl: c, python: "3.9", postgres: "postgres:14"}
+ - {impl: c, python: "3.10", postgres: "postgres:13", libpq: oldest}
+ - {impl: c, python: "3.11", postgres: "postgres:10", libpq: newest}
+
+ - {impl: python, python: "3.9", ext: dns, postgres: "postgres:14"}
+ - {impl: python, python: "3.9", ext: postgis, postgres: "postgis/postgis"}
+
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ DEPS: ./psycopg[test] ./psycopg_pool
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
+ PGPASSWORD: password
+ MARKERS: ""
+
+ # Enable to run tests using the minimum version of dependencies.
+ # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python }}
+
+ - name: Install the newest libpq version available
+ if: ${{ matrix.libpq == 'newest' }}
+ run: |
+ set -x
+
+ curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
+ | gpg --dearmor \
+ | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg > /dev/null
+
+ # NOTE: in order to test with a preview release, add its number to
+ # the deb entry. For instance, to test on preview Postgres 16, use:
+ # "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main 16"
+ rel=$(lsb_release -c -s)
+ echo "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main" \
+ | sudo tee -a /etc/apt/sources.list.d/pgdg.list > /dev/null
+ sudo apt-get -qq update
+
+ pqver=$(apt-cache show libpq5 | grep ^Version: | head -1 \
+ | awk '{print $2}')
+ sudo apt-get -qq -y install "libpq-dev=${pqver}" "libpq5=${pqver}"
+
+ - name: Install the oldest libpq version available
+ if: ${{ matrix.libpq == 'oldest' }}
+ run: |
+ set -x
+ pqver=$(apt-cache show libpq5 | grep ^Version: | tail -1 \
+ | awk '{print $2}')
+ sudo apt-get -qq -y --allow-downgrades install \
+ "libpq-dev=${pqver}" "libpq5=${pqver}"
+
+ - if: ${{ matrix.ext == 'dns' }}
+ run: |
+ echo "DEPS=$DEPS dnspython" >> $GITHUB_ENV
+ echo "MARKERS=$MARKERS dns" >> $GITHUB_ENV
+
+ - if: ${{ matrix.ext == 'postgis' }}
+ run: |
+ echo "DEPS=$DEPS shapely" >> $GITHUB_ENV
+ echo "MARKERS=$MARKERS postgis" >> $GITHUB_ENV
+
+ - if: ${{ matrix.impl == 'c' }}
+ run: |
+ echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
+
+ - name: Install Python dependencies
+ run: pip install $DEPS
+
+ - 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
+
+
+ # }}}
+
+ macos: # {{{
+ runs-on: macos-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {impl: python, python: "3.7"}
+ - {impl: python, python: "3.8"}
+ - {impl: python, python: "3.9"}
+ - {impl: python, python: "3.10"}
+ - {impl: python, python: "3.11"}
+ - {impl: c, python: "3.7"}
+ - {impl: c, python: "3.8"}
+ - {impl: c, python: "3.9"}
+ - {impl: c, python: "3.10"}
+ - {impl: c, python: "3.11"}
+
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ DEPS: ./psycopg[test] ./psycopg_pool
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 user=runner dbname=postgres"
+ # MacOS on GitHub Actions seems particularly slow.
+ # Don't run timing-based tests as they regularly fail.
+ # pproxy-based tests fail too, with the proxy not coming up in 2s.
+ NOT_MARKERS: "timing proxy mypy"
+ # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install PostgreSQL on the runner
+ run: brew install postgresql@14
+
+ - name: Start PostgreSQL service for test
+ run: brew services start postgresql
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python }}
+
+ - if: ${{ matrix.impl == 'c' }}
+ # skip tests failing on importing psycopg_c.pq on subprocess
+ # they only fail on Travis, work ok locally under tox too.
+ # TODO: check the same on GitHub Actions
+ run: |
+ echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
+
+ - name: Install Python dependencies
+ run: pip install $DEPS
+
+ - name: Run tests
+ run: ./tools/build/ci_test.sh
+
+
+ # }}}
+
+ windows: # {{{
+ runs-on: windows-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {impl: python, python: "3.7"}
+ - {impl: python, python: "3.8"}
+ - {impl: python, python: "3.9"}
+ - {impl: python, python: "3.10"}
+ - {impl: python, python: "3.11"}
+ - {impl: c, python: "3.7"}
+ - {impl: c, python: "3.8"}
+ - {impl: c, python: "3.9"}
+ - {impl: c, python: "3.10"}
+ - {impl: c, python: "3.11"}
+
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ DEPS: ./psycopg[test] ./psycopg_pool
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 dbname=postgres"
+ # On windows pproxy doesn't seem very happy. Also a few timing test fail.
+ NOT_MARKERS: "timing proxy mypy"
+ # PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Start PostgreSQL service for test
+ run: |
+ $PgSvc = Get-Service "postgresql*"
+ Set-Service $PgSvc.Name -StartupType manual
+ $PgSvc.Start()
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python }}
+
+ # Build a wheel package of the C extensions.
+ # If the wheel is not delocated, import fails with some dll not found
+ # (but it won't tell which one).
+ - name: Build the C wheel
+ if: ${{ matrix.impl == 'c' }}
+ run: |
+ pip install delvewheel wheel
+ $env:Path = "C:\Program Files\PostgreSQL\14\bin\;$env:Path"
+ python ./psycopg_c/setup.py bdist_wheel
+ &"delvewheel" repair `
+ --no-mangle "libiconv-2.dll;libwinpthread-1.dll" `
+ @(Get-ChildItem psycopg_c\dist\*.whl)
+ &"pip" install @(Get-ChildItem wheelhouse\*.whl)
+
+ - name: Run tests
+ run: |
+ pip install $DEPS
+ ./tools/build/ci_test.sh
+ shell: bash
+
+
+ # }}}
+
+ crdb: # {{{
+ runs-on: ubuntu-latest
+ if: true
+
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - {impl: c, crdb: "latest-v22.1", python: "3.10", libpq: newest}
+ - {impl: python, crdb: "latest-v22.2", python: "3.11"}
+ env:
+ PSYCOPG_IMPL: ${{ matrix.impl }}
+ DEPS: ./psycopg[test] ./psycopg_pool
+ PSYCOPG_TEST_DSN: "host=127.0.0.1 port=26257 user=root dbname=defaultdb"
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: ${{ matrix.python }}
+
+ - name: Run CockroachDB
+ # 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 cockroachdb/cockroach:${{ matrix.crdb }}
+ docker run --rm -d --name crdb -p 26257:26257 \
+ cockroachdb/cockroach:${{ matrix.crdb }} start-single-node --insecure
+
+ - name: Install the newest libpq version available
+ if: ${{ matrix.libpq == 'newest' }}
+ run: |
+ set -x
+
+ curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
+ | gpg --dearmor \
+ | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg > /dev/null
+
+ # NOTE: in order to test with a preview release, add its number to
+ # the deb entry. For instance, to test on preview Postgres 16, use:
+ # "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main 16"
+ rel=$(lsb_release -c -s)
+ echo "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main" \
+ | sudo tee -a /etc/apt/sources.list.d/pgdg.list > /dev/null
+ sudo apt-get -qq update
+
+ pqver=$(apt-cache show libpq5 | grep ^Version: | head -1 \
+ | awk '{print $2}')
+ sudo apt-get -qq -y install "libpq-dev=${pqver}" "libpq5=${pqver}"
+
+ - if: ${{ matrix.impl == 'c' }}
+ run: |
+ echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
+
+ - name: Install Python dependencies
+ run: pip install $DEPS
+
+ - name: Run tests
+ run: ./tools/build/ci_test.sh
+
+ - name: Stop CockroachDB
+ run: docker kill crdb
+
+
+ # }}}