From 5382b3b8e2b3b50c0fb2df2cdd8d5a753d403cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Mon, 28 Oct 2024 21:04:15 -0600 Subject: [PATCH] test: Start testing with all supported Postgres versions --- .github/workflows/ci_workflow.yml | 30 ++++++++++++++++++++--------- .github/workflows/constraints.txt | 3 ++- README.md | 4 ++++ docker-compose.yml | 2 +- tox.ini | 32 ++++++++++++++++++------------- 5 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 83c1b08a..bfd3e511 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -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: @@ -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 }}' @@ -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 @@ -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 diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 8e44691c..996fd854 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -1 +1,2 @@ -poetry==1.8.4 +meltano==3.6.0b2 +tox==4.23.2 diff --git a/README.md b/README.md index 176e3620..389fc14a 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/docker-compose.yml b/docker-compose.yml index f2d453c4..1d4e1dae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/tox.ini b/tox.ini index a7bfcb8d..f984b775 100644 --- a/tox.ini +++ b/tox.ini @@ -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 .