Skip to content

feat: Adding a connection test to postgres #3266

feat: Adding a connection test to postgres

feat: Adding a connection test to postgres #3266

Workflow file for this run

name: Destination Plugin Postgresql Workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- "plugins/destination/postgresql/**"
- ".github/workflows/dest_postgresql.yml"
push:
branches:
- main
paths:
- "plugins/destination/postgresql/**"
- ".github/workflows/dest_postgresql.yml"
jobs:
plugins-destination-postgresql:
timeout-minutes: 30
name: "plugins/destination/postgresql"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./plugins/destination/postgresql
services:
# Label used to access the service container
postgres:
image: postgres:10
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: plugins/destination/postgresql/go.mod
cache: true
cache-dependency-path: plugins/destination/postgresql/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
working-directory: plugins/destination/postgresql
args: "--config ../../.golangci.yml"
skip-pkg-cache: true
skip-build-cache: true
- name: gen
if: github.event_name == 'pull_request'
run: make gen
- name: Fail if generation updated files
if: github.event_name == 'pull_request'
run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1)
- name: Build
run: go build .
- name: Test PG
run: make test
# cockroachdb doesn't support services right now
# https://stackoverflow.com/questions/73648218/github-action-setup-secure-cockroachdb
- name: Spin up CockroachDB
run: |
docker run -d -p 26257:26257 cockroachdb/cockroach:v22.1.8 start-single-node --insecure
sudo apt update && sudo apt install wait-for-it -y
wait-for-it -h localhost -p 26257
- name: Test CockroachDB
run: CQ_DEST_PG_TEST_CONN="postgresql://root@localhost:26257/postgres?sslmode=disable" make test