2021-02-28 19:32:54 +03:00
|
|
|
name: Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2021-05-22 16:40:53 +03:00
|
|
|
name: Unit tests run
|
2022-07-28 16:31:16 +03:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-28 19:32:54 +03:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-05-22 16:40:53 +03:00
|
|
|
include:
|
2023-02-25 18:07:21 +03:00
|
|
|
- {python: "3.7", postgres: "10"}
|
2021-10-05 01:44:09 +03:00
|
|
|
- {python: "3.8", postgres: "12"}
|
|
|
|
- {python: "3.9", postgres: "13"}
|
|
|
|
- {python: "3.10", postgres: "14"}
|
2022-10-25 13:26:20 +03:00
|
|
|
- {python: "3.11", postgres: "15"}
|
2023-10-03 12:28:43 +03:00
|
|
|
- {python: "3.12", postgres: "16"}
|
2024-04-25 10:24:14 +03:00
|
|
|
- {python: "3.13-dev", postgres: "16"}
|
2021-05-22 16:40:53 +03:00
|
|
|
|
|
|
|
# Opposite extremes of the supported Py/PG range, other architecture
|
2023-10-03 12:28:43 +03:00
|
|
|
- {python: "3.7", postgres: "16", architecture: "x86"}
|
|
|
|
- {python: "3.8", postgres: "15", architecture: "x86"}
|
|
|
|
- {python: "3.9", postgres: "14", architecture: "x86"}
|
|
|
|
- {python: "3.10", postgres: "13", architecture: "x86"}
|
|
|
|
- {python: "3.11", postgres: "11", architecture: "x86"}
|
|
|
|
- {python: "3.12", postgres: "10", architecture: "x86"}
|
2024-04-25 10:24:14 +03:00
|
|
|
- {python: "3.13-dev", postgres: "10", architecture: "x86"}
|
2021-05-22 16:40:53 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
PSYCOPG2_TESTDB: postgres
|
|
|
|
PSYCOPG2_TESTDB_HOST: 127.0.0.1
|
|
|
|
PSYCOPG2_TESTDB_USER: postgres
|
|
|
|
PSYCOPG2_TESTDB_PASSWORD: password
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgresql:
|
|
|
|
image: postgres:${{ 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
|
2021-02-28 19:32:54 +03:00
|
|
|
|
|
|
|
steps:
|
2023-10-29 19:09:43 +03:00
|
|
|
- uses: actions/checkout@v4
|
2022-10-05 21:33:26 +03:00
|
|
|
|
2022-10-25 13:43:23 +03:00
|
|
|
# Can enable to test an unreleased libpq version.
|
|
|
|
- name: install libpq 16
|
2022-10-25 13:59:23 +03:00
|
|
|
if: false
|
2022-10-05 21:33:26 +03:00
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
rel=$(lsb_release -c -s)
|
2022-10-25 13:43:23 +03:00
|
|
|
echo "deb http://apt.postgresql.org/pub/repos/apt ${rel}-pgdg main 16" \
|
2022-10-05 21:33:26 +03:00
|
|
|
| sudo tee -a /etc/apt/sources.list.d/pgdg.list
|
|
|
|
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}"
|
|
|
|
|
2021-10-18 00:19:43 +03:00
|
|
|
- name: Install tox
|
2023-02-25 18:05:14 +03:00
|
|
|
run: pip install "tox < 4"
|
2024-01-02 02:28:30 +03:00
|
|
|
- uses: actions/setup-python@v5
|
2021-05-22 16:40:53 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python }}
|
|
|
|
- name: Run tests
|
2021-10-18 00:19:43 +03:00
|
|
|
env:
|
|
|
|
MATRIX_PYTHON: ${{ matrix.python }}
|
|
|
|
run: tox -e ${MATRIX_PYTHON%-dev}
|
2021-05-22 16:40:53 +03:00
|
|
|
timeout-minutes: 5
|