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", libpq: ""}
- - {impl: python, python: "3.9", postgres: "postgres:13", libpq: ""}
- - {impl: python, python: "3.10", postgres: "postgres:14", libpq: ""}
- - {impl: python, python: "3.11", postgres: "postgres:15", libpq: "oldest"}
+ - {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", libpq: ""}
- - {impl: c, python: "3.9", postgres: "postgres:14", libpq: ""}
- - {impl: c, python: "3.10", postgres: "postgres:13", libpq: "oldest"}
- - {impl: c, python: "3.11", postgres: "postgres:10", libpq: "newest"}
+ - {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: dns, python: "3.9", postgres: "postgres:14", libpq: ""}
- - {impl: postgis, python: "3.9", postgres: "postgis/postgis", libpq: ""}
+ - {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
- PYTEST_ADDOPTS: --color yes
+ MARKERS: ""
+
# Enable to run tests using the minimum version of dependencies.
# PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
sudo apt-get -qq -y --allow-downgrades install \
"libpq-dev=${pqver}" "libpq5=${pqver}"
- - name: Install tox
- # https://github.com/tox-dev/tox/issues/2619
- run: pip install "tox < 4"
+ - if: ${{ matrix.ext == 'dns' }}
+ run: |
+ echo "DEPS=$DEPS dnspython" >> $GITHUB_ENV
+ echo "MARKERS=$MARKERS dns" >> $GITHUB_ENV
- - name: Run tests (Python implementation)
- if: ${{ matrix.impl == 'python' }}
- run: tox -c psycopg -e ${{ matrix.python }}
+ - if: ${{ matrix.ext == 'postgis' }}
+ run: |
+ echo "DEPS=$DEPS shapely" >> $GITHUB_ENV
+ echo "MARKERS=$MARKERS postgis" >> $GITHUB_ENV
- - name: Run tests (C implementation)
- if: ${{ matrix.impl == 'c' }}
+ - 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.
- run: tox -c psycopg_c -e ${{ matrix.python }} -- -m 'not subprocess'
+ # TODO: check the same on GitHub Actions
+ run: |
+ echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
+ echo "NOT_MARKERS=$NOT_MARKERS subprocess" >> $GITHUB_ENV
- - name: Run DNS-related tests
- if: ${{ matrix.impl == 'dns' }}
- run: tox -c psycopg -e dns -- -m dns
- env:
- PSYCOPG_IMPL: python
+ - name: Install Python dependencies
+ run: pip install $DEPS
- - name: Run PostGIS-related tests
- if: ${{ matrix.impl == 'postgis' }}
- run: tox -c psycopg -e postgis -- -m postgis
- env:
- PSYCOPG_IMPL: python
+ - name: Run tests
+ run: ./tools/build/ci_test.sh
services:
postgresql:
macos: # {{{
runs-on: macos-latest
+ if: true
strategy:
fail-fast: false
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.
- PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes
+ NOT_MARKERS: "timing proxy mypy"
# PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
steps:
with:
python-version: ${{ matrix.python }}
- - name: Install tox
- run: pip install "tox < 4"
+ - 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: Run tests (Python implementation)
- if: ${{ matrix.impl == 'python' }}
- run: tox -c psycopg -e ${{ matrix.python }}
+ - name: Install Python dependencies
+ run: pip install $DEPS
- - name: Run tests (C implementation)
- if: ${{ matrix.impl == 'c' }}
- run: tox -c psycopg_c -e ${{ matrix.python }}
+ - name: Run tests
+ run: ./tools/build/ci_test.sh
# }}}
windows: # {{{
runs-on: windows-latest
+ if: true
strategy:
fail-fast: false
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.
- PYTEST_ADDOPTS: -m 'not timing and not proxy and not mypy' --color yes
+ NOT_MARKERS: "timing proxy mypy"
# PIP_CONSTRAINT: ${{ github.workspace }}/tests/constraints.txt
steps:
with:
python-version: ${{ matrix.python }}
- - name: Install tox
- run: pip install "tox < 4" wheel
-
- - name: Run tests (Python implementation)
- if: ${{ matrix.impl == 'python' }}
- run: tox -c psycopg -e ${{ 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
- pip install delvewheel
&"delvewheel" repair `
--no-mangle "libiconv-2.dll;libwinpthread-1.dll" `
@(Get-ChildItem psycopg_c\dist\*.whl)
+ &"pip" install @(Get-ChildItem wheelhouse\*.whl)
- # tox will only build the package from sdist, not from wheel, so we can't
- # use it for testing. Just test everything in the global installation.
- - name: Install and run tests (C implementation)
- if: ${{ matrix.impl == 'c' }}
+ - name: Run tests
run: |
- pip install ./psycopg/[test] ./psycopg_pool
- &"pip" install @(Get-ChildItem wheelhouse\*.whl)
- # Fix the path for the tests using ctypes
- $env:Path = "C:\Program Files\PostgreSQL\14\bin\;$env:Path"
- # We don't repeat failed tests as tox does. So allow one failure,
- # typically reserved to a flakey test.
- # We may hide a regular failure, yes, but then maybe a flakey test
- # would allow us to find it...
- pytest --allow-fail=1
+ pip install $DEPS
+ ./tools/build/ci_test.sh
+ shell: bash
# }}}
crdb: # {{{
runs-on: ubuntu-latest
+ if: true
strategy:
fail-fast: false
matrix:
include:
- - {crdb: "latest-v22.1", python: "3.10", impl: "c", libpq: "newest"}
- - {crdb: "latest-v22.2", python: "3.11", impl: "python", libpq: ""}
+ - {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"
- PYTEST_ADDOPTS: --color yes
steps:
- uses: actions/checkout@v3
| awk '{print $2}')
sudo apt-get -qq -y install "libpq-dev=${pqver}" "libpq5=${pqver}"
- - name: Install tox
- run: pip install "tox < 4"
-
- - name: Run tests (Python implementation)
- if: ${{ matrix.impl == 'python' }}
- run: tox -c psycopg -e ${{ matrix.python }}
-
- - name: Run tests (C implementation)
- if: ${{ matrix.impl == 'c' }}
+ - 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.
- run: tox -c psycopg_c -e ${{ matrix.python }} -- -m 'not subprocess'
+ # TODO: check the same on GitHub Actions
+ run: |
+ echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
+ echo "NOT_MARKERS=$NOT_MARKERS subprocess" >> $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