Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmeneghello authored Nov 5, 2024
2 parents 6f76da9 + b550f86 commit 6617a7c
Show file tree
Hide file tree
Showing 13 changed files with 406 additions and 344 deletions.
1 change: 1 addition & 0 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pip==24.3.1
poetry==1.8.4
tox==4.23.2
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,4 @@ jobs:
overwrite: true
file_glob: true
- name: Deploy to PyPI
uses: pypa/gh-action-pypi-publish@v1.10.3
with:
attestations: true
uses: pypa/gh-action-pypi-publish@v1.11.0
47 changes: 32 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Test tap-postgres

env:
FORCE_COLOR: 1

on:
pull_request:
branches: [main]
Expand Down Expand Up @@ -37,18 +40,32 @@ concurrency:

jobs:
tests:
name: Python ${{ matrix.python-version }} / Postgres ${{ matrix.postgres-version }}
runs-on: ubuntu-latest
env:
PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt
strategy:
fail-fast: false
matrix:
python-version:
- "3.13"
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
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:
- name: Checkout code
Expand All @@ -62,13 +79,19 @@ jobs:
chmod 600 ssl/pkey.key
- name: Build Postgres container
env:
POSTGRES_VERSION: ${{ matrix.postgres-version }}
run: |
docker build . --tag meltano/log_based
docker build . --build-arg POSTGRES_VERSION=${POSTGRES_VERSION} --tag meltano/log_based
- name: Compose Postgres container
env:
POSTGRES_VERSION: ${{ matrix.postgres-version }}
run: |
docker compose -f docker-compose.yml up -d --wait --wait-timeout=30
- uses: isbang/compose-action@v2.0.2
env:
POSTGRES_VERSION: ${{ matrix.postgres-version }}

# Leaving comments as this makes testing the openssh docker image easier and should save someone some time later
# - name: Test SSH File Permissiosn
Expand All @@ -78,27 +101,21 @@ jobs:
# docker exec openssh-server ps aux


- run: docker ps

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Upgrade pip
run: |
pip install pip
pip --version
- name: Install Poetry
run: |
pip install poetry
poetry --version
- name: Install dependencies
- name: Install Tox
run: |
poetry env use python${{ matrix.python-version }}
poetry install
python -m pip install --upgrade pip
pipx install tox
- name: Run pytest
run: |
poetry run pytest
tox -e $(echo py${{ matrix.python-version }} | tr -d .)
- name: Run lint
run: |
poetry run tox -e lint
tox -e lint
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,30 @@ dmypy.json

# Pyre type checker
.pyre/

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.7.2
hooks:
- id: ruff
args: [--fix]
Expand Down
27 changes: 16 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
FROM postgres:16
ARG POSTGRES_VERSION=17
FROM postgres:${POSTGRES_VERSION}

RUN apt-get update
RUN apt-mark hold locales
RUN apt-get install curl ca-certificates -y
RUN install -d /usr/share/postgresql-common/pgdg
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
RUN apt-get update
RUN apt-get install postgresql-server-dev-16 -y
RUN sh -c 'export PATH=/usr/lib/postgresql/16/bin:$PATH'
RUN apt-get install postgresql-16-wal2json -y
ARG POSTGRES_VERSION=17

# Install prerequisites and configure PostgreSQL for wal2json
RUN apt-get update && apt-mark hold locales && \
apt-get install -y curl ca-certificates && \
install -d /usr/share/postgresql-common/pgdg && \
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc && \
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

RUN echo "Setting up PostgreSQL ${POSTGRES_VERSION} with wal2json" && \
apt-get update && \
apt-get install -y postgresql-server-dev-${POSTGRES_VERSION} && \
export PATH=/usr/lib/postgresql/${POSTGRES_VERSION}/bin:$PATH && \
apt-get install -y postgresql-${POSTGRES_VERSION}-wal2json
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Built with the [Meltano Singer SDK](https://sdk.meltano.com).
* `stream-maps`
* `schema-flattening`

## Supported Python and PostgreSQL Versions

This tap is tested with all actively supported [Python](https://devguide.python.org/versions/#supported-versions) and [PostgreSQL](https://www.postgresql.org/support/versioning/) 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
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- inner

postgres_no_ssl:
image: postgres:latest
image: postgres:${POSTGRES_VERSION:-latest}
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -30,7 +30,7 @@ services:
- "5432:5432"

postgresdb:
image: postgres:13.0
image: postgres:${POSTGRES_VERSION:-latest}
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand All @@ -40,7 +40,7 @@ services:
ipv4_address: 10.5.0.5

postgres_ssl:
image: postgres:16
image: 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
Loading

0 comments on commit 6617a7c

Please sign in to comment.