Skip to content

Commit

Permalink
test: Start testing with all supported Postgres versions
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Oct 29, 2024
1 parent 528bc3b commit 5382b3b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 24 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ jobs:
- "3.11"
- "3.10"
- "3.9"
postgres-version:
- "17"
include:
- python-version: "3.13"
postgres-version: "12"
- python-version: "3.13"
postgres-version: "13"
- python-version: "3.13"
postgres-version: "14"
- python-version: "3.13"
postgres-version: "15"
- python-version: "3.13"
postgres-version: "16"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -43,6 +56,8 @@ jobs:
chmod 600 ssl/pkey.key
chmod 644 ssl/public_pkey.key
- name: Set up Postgres container
env:
POSTGRES_VERSION: ${{ matrix.postgres-version }}
run: |
docker compose -f docker-compose.yml up -d
- name: Set up Python '${{ matrix.python-version }}'
Expand All @@ -54,18 +69,13 @@ jobs:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
run: |
python -m pip install --upgrade pip
pipx install poetry
pipx inject poetry poetry-dynamic-versioning
- name: Install dependencies
run: |
poetry env use python${{ matrix.python-version }}
poetry install
pipx install tox
- name: Run pytest
run: |
poetry run pytest --capture=no
tox -e $(echo py${{ matrix.python-version }} | tr -d .)
- name: Run lint
run: |
poetry run tox -e lint
tox -e lint
integration:
runs-on: ubuntu-latest
Expand All @@ -88,9 +98,11 @@ jobs:
with:
python-version: 3.x
- name: Install dependencies
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
run: |
python -m pip install --upgrade pip
pipx install meltano
meltano install
meltano --version
- name: smoke-test-tap
run: meltano run tap-smoke-test target-postgres
3 changes: 2 additions & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
poetry==1.8.4
meltano==3.6.0b2
tox==4.23.2
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Built with the [Meltano SDK](https://sdk.meltano.com) for Singer Taps and Target
* `target-schema`
* `hard-delete`

## Supported Python and PostgreSQL Versions

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.

## Settings

| Setting | Required | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
version: "2.1"
services:
postgres:
image: docker.io/postgres:latest
image: docker.io/postgres:${POSTGRES_VERSION:-latest}
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
environment:
POSTGRES_USER: postgres
Expand Down
32 changes: 19 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,37 @@
[tox]
envlist = py312
isolated_build = true
min_version = 4

[testenv]
allowlist_externals = poetry

[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
# To execute, run `tox -e py313`
envlist = py3{9,10,11,12,13}
deps =
pytest
commands =
poetry install -v
poetry run pytest
pytest

[testenv:format]
# Attempt to auto-resolve lint errors before they are raised.
# To execute, run `tox -e format`
deps =
ruff
commands =
poetry install -v
poetry run ruff check target_postgres/
poetry run ruff format target_postgres/
ruff check target_postgres/
ruff format target_postgres/

[testenv:lint]
# Raise an error if lint and style standards are not met.
# To execute, run `tox -e lint`
deps =
mypy
ruff
types-paramiko
types-simplejson
types-sqlalchemy
types-jsonschema
commands =
poetry install -v
poetry run ruff check --diff target_postgres/
poetry run ruff format --check target_postgres/
poetry run mypy .
ruff check --diff target_postgres/
ruff format --check target_postgres/
mypy .

0 comments on commit 5382b3b

Please sign in to comment.