Skip to content

Commit

Permalink
Add psycopg v3 into test matrix
Browse files Browse the repository at this point in the history
Signed-off-by: Kwong Tung Nan <[email protected]>
  • Loading branch information
kwongtn committed Jan 2, 2025
1 parent 8ccd07e commit e84df9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,56 +47,71 @@ jobs:
- 5.0.*
- 5.1.*
python-version:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
mode:
- std
- geos
psycopg:
- "psycopg2"
- "psycopg" # v3
include:
# Django 4.2 only supports python 3.8-3.12
- django-version: 4.2.*
python-version: '3.8'
python-version: "3.8"
mode: std
- django-version: 4.2.*
python-version: '3.8'
python-version: "3.8"
mode: geos
exclude:
# Django 4.2 only supports python 3.8-3.12
- django-version: 4.2.*
python-version: '3.13'
python-version: "3.13"
# Django 5.0 only supports python 3.10-3.12
- django-version: 5.0.*
python-version: '3.9'
python-version: "3.9"
- django-version: 5.0.*
python-version: '3.13'
python-version: "3.13"
# Django 5.1 only supports python 3.10+
- django-version: 5.1.*
python-version: '3.9'
python-version: "3.9"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install OS Dependencies
if: ${{ matrix.mode == 'geos' }}
uses: daaku/gh-action-apt-install@v4
with:
packages: binutils gdal-bin libproj-dev libsqlite3-mod-spatialite

- name: Install Poetry
run: pipx install poetry

- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
cache: poetry
python-version: ${{ matrix.python-version }}

- name: Install Deps
run: poetry install

- name: Install ${{ matrix.psycopg }}
run: |
poetry run pip install ${{ matrix.psycopg }}
poetry run pip install ${{ matrix.psycopg }}-binary
- name: Install Django ${{ matrix.django-version }}
run: poetry run pip install "django==${{ matrix.django-version }}"

- name: Test with pytest
run: poetry run pytest --showlocals -vvv --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
Expand Down
2 changes: 1 addition & 1 deletion strawberry_django/fields/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
try:
from django.contrib.postgres.fields import ArrayField
except (ImportError, ModuleNotFoundError): # pragma: no cover
# ArrayField will not be importable if psycopg2 is not installed
# ArrayField will not be importable if psycopg or psycopg2 is not installed
ArrayField = None

if django.VERSION >= (5, 0):
Expand Down

0 comments on commit e84df9d

Please sign in to comment.