Skip to content

Commit d4dc7e8

Browse files
committed
Test against oldest supported versions - closes #1131
1 parent 2b7191c commit d4dc7e8

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Run pytest tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-versions:
7+
description: 'Supported python versions'
8+
default: '["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]'
9+
required: false
10+
type: string
11+
postgresql:
12+
description: 'PostgreSQL version'
13+
default: 13
14+
type: number
15+
os:
16+
description: 'Operating system to run tests on'
17+
default: 'ubuntu-latest'
18+
required: false
19+
type: string
20+
secrets:
21+
codecov_token:
22+
description: 'Codecov token'
23+
required: false
24+
25+
jobs:
26+
postgres:
27+
runs-on: ${{ inputs.os }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
python-version: ${{ fromJSON(inputs.python-versions) }}
32+
env:
33+
OS: ${{ inputs.os }}
34+
PYTHON: ${{ matrix.python-version }}
35+
POSTGRES: ${{ inputs.postgresql }}
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Set up Pipenv on python ${{ matrix.python-version }}
39+
uses: fizyk/actions-reuse/.github/actions/pipenv-setup@v3.1.0
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
cache: false
43+
- uses: ankane/setup-postgres@v1
44+
with:
45+
postgres-version: ${{ inputs.postgresql }}
46+
- name: Check installed locales
47+
run: |
48+
locale -a
49+
- name: update locale for tests
50+
if: ${{ inputs.os == 'ubuntu-latest' }}
51+
run: |
52+
sudo locale-gen de_DE.UTF-8
53+
- name: install libpq
54+
if: ${{ contains(inputs.python-versions, 'pypy') }}
55+
run: sudo apt install libpq5
56+
- name: Install oldest supported versions
57+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
58+
with:
59+
command: pip install -r oldest-requirements.txt
60+
- name: Run tests without xdist
61+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
62+
with:
63+
command: py.test -svv -p no:xdist --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml
64+
- name: Run xdist test
65+
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v3.1.0
66+
with:
67+
command: py.test -n auto --dist loadgroup --max-worker-restart 0 --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml:coverage-xdist.xml
68+
- uses: actions/upload-artifact@v4
69+
if: failure()
70+
with:
71+
name: postgresql-${{ matrix.python-version }}-${{ inputs.postgresql }}
72+
path: /tmp/pytest-of-runner/**
73+
- name: Upload coverage to Codecov
74+
uses: codecov/codecov-action@v5.4.2
75+
with:
76+
token: ${{ secrets.codecov_token }}
77+
flags: unittests
78+
env_vars: OS,PYTHON
79+
fail_ci_if_error: false

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
branches: [ main ]
88

99
jobs:
10+
postgresql_oldest:
11+
uses: ./.github/workflows/oldest-postgres.yml
1012
postgresql_17:
1113
uses: ./.github/workflows/single-postgres.yml
1214
with:

oldest-requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pytest == 6.2
2+
port-for == 0.7.3
3+
mirakuru == 2.6.0
4+
psycopg == 3.0.0

0 commit comments

Comments
 (0)