Skip to content

Commit 684e635

Browse files
test: Start testing with all supported Postgres versions (#473)
1 parent 528bc3b commit 684e635

File tree

5 files changed

+59
-27
lines changed

5 files changed

+59
-27
lines changed

.github/workflows/ci_workflow.yml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ on:
2020
workflow_dispatch:
2121
inputs: {}
2222

23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
env:
28+
FORCE_COLOR: 1
29+
2330
jobs:
2431
tests:
32+
name: Python ${{ matrix.python-version }} / Postgres ${{ matrix.postgres-version }}
2533
runs-on: ubuntu-latest
2634
strategy:
2735
fail-fast: false
@@ -32,6 +40,19 @@ jobs:
3240
- "3.11"
3341
- "3.10"
3442
- "3.9"
43+
postgres-version:
44+
- "17"
45+
include:
46+
- python-version: "3.13"
47+
postgres-version: "12"
48+
- python-version: "3.13"
49+
postgres-version: "13"
50+
- python-version: "3.13"
51+
postgres-version: "14"
52+
- python-version: "3.13"
53+
postgres-version: "15"
54+
- python-version: "3.13"
55+
postgres-version: "16"
3556
steps:
3657
- uses: actions/checkout@v4
3758
with:
@@ -43,8 +64,11 @@ jobs:
4364
chmod 600 ssl/pkey.key
4465
chmod 644 ssl/public_pkey.key
4566
- name: Set up Postgres container
67+
env:
68+
POSTGRES_VERSION: ${{ matrix.postgres-version }}
4669
run: |
4770
docker compose -f docker-compose.yml up -d
71+
- run: docker ps
4872
- name: Set up Python '${{ matrix.python-version }}'
4973
uses: actions/setup-python@v5
5074
with:
@@ -54,20 +78,16 @@ jobs:
5478
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
5579
run: |
5680
python -m pip install --upgrade pip
57-
pipx install poetry
58-
pipx inject poetry poetry-dynamic-versioning
59-
- name: Install dependencies
60-
run: |
61-
poetry env use python${{ matrix.python-version }}
62-
poetry install
81+
pipx install tox
6382
- name: Run pytest
6483
run: |
65-
poetry run pytest --capture=no
84+
tox -e $(echo py${{ matrix.python-version }} | tr -d .)
6685
- name: Run lint
6786
run: |
68-
poetry run tox -e lint
87+
tox -e lint
6988
7089
integration:
90+
name: Meltano integration test
7191
runs-on: ubuntu-latest
7292
services:
7393
postgres:
@@ -88,9 +108,11 @@ jobs:
88108
with:
89109
python-version: 3.x
90110
- name: Install dependencies
111+
env:
112+
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
91113
run: |
92114
python -m pip install --upgrade pip
93115
pipx install meltano
94-
meltano install
116+
meltano --version
95117
- name: smoke-test-tap
96118
run: meltano run tap-smoke-test target-postgres

.github/workflows/constraints.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
poetry==1.8.4
1+
meltano==3.6.0b2
2+
tox==4.23.2

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Built with the [Meltano SDK](https://sdk.meltano.com) for Singer Taps and Target
1818
* `target-schema`
1919
* `hard-delete`
2020

21+
## Supported Python and PostgreSQL Versions
22+
23+
This target is tested with all actively supported Python and PostgreSQL versions. At the time of writing, this includes Python 3.9 through 3.13 and PostgreSQL 12 through 17.
24+
2125
## Settings
2226

2327
| Setting | Required | Default | Description |

docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
# docker compose -f docker-compose.yml up -d
3-
version: "2.1"
43
services:
54
postgres:
6-
image: docker.io/postgres:latest
5+
image: postgres:${POSTGRES_VERSION:-latest}
76
command: postgres -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key -c ssl_ca_file=/var/lib/postgresql/ca.crt -c hba_file=/var/lib/postgresql/pg_hba.conf
87
environment:
98
POSTGRES_USER: postgres
@@ -20,7 +19,7 @@ services:
2019
ports:
2120
- "5432:5432"
2221
postgres_no_ssl: # Borrowed from https://github.com/MeltanoLabs/tap-postgres/blob/main/.github/workflows/test.yml#L13-L23
23-
image: docker.io/postgres:latest
22+
image: postgres:${POSTGRES_VERSION:-latest}
2423
environment:
2524
POSTGRES_PASSWORD: postgres
2625
ports:
@@ -43,7 +42,7 @@ services:
4342
networks:
4443
- inner
4544
postgresdb:
46-
image: postgres:13.0
45+
image: postgres:${POSTGRES_VERSION:-latest}
4746
environment:
4847
POSTGRES_USER: postgres
4948
POSTGRES_PASSWORD: postgres

tox.ini

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,37 @@
33
[tox]
44
envlist = py312
55
isolated_build = true
6+
min_version = 4
67

78
[testenv]
8-
allowlist_externals = poetry
9-
10-
[testenv:pytest]
119
# Run the python tests.
12-
# To execute, run `tox -e pytest`
10+
# To execute, run `tox -e py313`
1311
envlist = py3{9,10,11,12,13}
12+
deps =
13+
pytest
1414
commands =
15-
poetry install -v
16-
poetry run pytest
15+
pytest
1716

1817
[testenv:format]
1918
# Attempt to auto-resolve lint errors before they are raised.
2019
# To execute, run `tox -e format`
20+
deps =
21+
ruff
2122
commands =
22-
poetry install -v
23-
poetry run ruff check target_postgres/
24-
poetry run ruff format target_postgres/
23+
ruff check target_postgres/
24+
ruff format target_postgres/
2525

2626
[testenv:lint]
2727
# Raise an error if lint and style standards are not met.
2828
# To execute, run `tox -e lint`
29+
deps =
30+
mypy
31+
ruff
32+
types-paramiko
33+
types-simplejson
34+
types-sqlalchemy
35+
types-jsonschema
2936
commands =
30-
poetry install -v
31-
poetry run ruff check --diff target_postgres/
32-
poetry run ruff format --check target_postgres/
33-
poetry run mypy .
37+
ruff check --diff target_postgres/
38+
ruff format --check target_postgres/
39+
mypy .

0 commit comments

Comments
 (0)