fix: Log based testing, upgrade to postgres16 for testing #616
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test tap-postgres | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: {} | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
PIP_CONSTRAINT: .github/workflows/constraints.txt | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Fix Permissions | |
run: | | |
chmod 777 -R ./ssh_tunnel/ssh-server-config | |
chmod 600 ssl/server.key | |
sudo chown 999:999 ssl/server.key | |
chmod 600 ssl/pkey.key | |
- name: Set up Postgres container | |
run: | | |
docker compose -f docker-compose.yml up -d | |
- name: Set up log based replication | |
run: | | |
docker exec tap-postgres-postgres_log_based-1 apt-get update | |
docker exec tap-postgres-postgres_log_based-1 apt-get upgrade -y | |
docker exec tap-postgres-postgres_log_based-1 apt-get install curl ca-certificates -y | |
docker exec tap-postgres-postgres_log_based-1 install -d /usr/share/postgresql-common/pgdg | |
docker exec tap-postgres-postgres_log_based-1 curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
docker exec tap-postgres-postgres_log_based-1 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' | |
docker exec tap-postgres-postgres_log_based-1 apt-get update | |
docker exec tap-postgres-postgres_log_based-1 apt-get install postgresql-server-dev-15 -y | |
docker exec tap-postgres-postgres_log_based-1 apt-get install postgresql-15-wal2json -y | |
docker exec tap-postgres-postgres_log_based-1 psql -U postgres -d postgres -c "SELECT * FROM pg_create_logical_replication_slot('tappostgres', 'wal2json');" | |
- uses: isbang/[email protected] | |
# Leaving comments as this makes testing the openssh docker image easier and should save someone some time later | |
# - name: Test SSH File Permissiosn | |
# run: | | |
# docker exec openssh-server ls -lsa /config/ssh_host_keys | |
# docker exec openssh-server cat /config/logs/openssh/current | |
# docker exec openssh-server ps aux | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: | | |
pip install pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install poetry | |
poetry --version | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Run pytest | |
run: | | |
poetry run pytest | |
- name: Run lint | |
run: | | |
poetry run tox -e lint |