Compare commits

...

6 Commits

Author SHA1 Message Date
Quigley Malcolm
2e876d2c70 Update setup_db.sh to use CONNECTION_URI 2024-09-10 15:37:37 -05:00
Michelle Ark
5f357187ca pass CONNECTION_STR to downstream postgres steps 2024-09-10 15:47:44 -04:00
Michelle Ark
afd1bf2771 pass CONNECTION_STR to downstream postgres steps 2024-09-10 15:47:40 -04:00
Michelle Ark
715386ad3a windows PG_LIB_DIR; macos do not install postgres@14 2024-09-10 15:38:52 -04:00
Michelle Ark
9554d1c926 use default port/username/password 2024-09-10 15:30:05 -04:00
Michelle Ark
d6ad6a5477 use ikalnytskyi/action-setup-postgres@v6 2024-09-10 15:25:58 -04:00
4 changed files with 20 additions and 4 deletions

View File

@@ -5,7 +5,6 @@ runs:
steps: steps:
- shell: bash - shell: bash
run: | run: |
brew services start postgresql
echo "Check PostgreSQL service is running" echo "Check PostgreSQL service is running"
i=10 i=10
COMMAND='pg_isready' COMMAND='pg_isready'

View File

@@ -2,6 +2,8 @@ name: "Set up postgres (windows)"
description: "Set up postgres service on windows vm for dbt integration tests" description: "Set up postgres service on windows vm for dbt integration tests"
runs: runs:
using: "composite" using: "composite"
env:
PQ_LIB_DIR: 'C:\Program Files\PostgreSQL\16\lib'
steps: steps:
- shell: pwsh - shell: pwsh
run: | run: |

View File

@@ -186,17 +186,29 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install postgres 16
uses: ikalnytskyi/action-setup-postgres@v6
with:
postgres-version: "16"
id: postgres
- name: Set up postgres (linux) - name: Set up postgres (linux)
if: runner.os == 'Linux' if: runner.os == 'Linux'
uses: ./.github/actions/setup-postgres-linux uses: ./.github/actions/setup-postgres-linux
env:
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
- name: Set up postgres (macos) - name: Set up postgres (macos)
if: runner.os == 'macOS' if: runner.os == 'macOS'
uses: ./.github/actions/setup-postgres-macos uses: ./.github/actions/setup-postgres-macos
env:
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
- name: Set up postgres (windows) - name: Set up postgres (windows)
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: ./.github/actions/setup-postgres-windows uses: ./.github/actions/setup-postgres-windows
env:
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
- name: Install python tools - name: Install python tools
run: | run: |
@@ -213,6 +225,7 @@ jobs:
command: tox -- --ddtrace command: tox -- --ddtrace
env: env:
PYTEST_ADDOPTS: ${{ format('--splits {0} --group {1}', env.PYTHON_INTEGRATION_TEST_WORKERS, matrix.split-group) }} PYTEST_ADDOPTS: ${{ format('--splits {0} --group {1}', env.PYTHON_INTEGRATION_TEST_WORKERS, matrix.split-group) }}
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
- name: Get current date - name: Get current date
if: always() if: always()

View File

@@ -5,6 +5,8 @@ env | grep '^PG'
# If you want to run this script for your own postgresql (run with # If you want to run this script for your own postgresql (run with
# docker-compose) it will look like this: # docker-compose) it will look like this:
# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ # PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \
PG_CONNECTION_URI="${CONNECTION_URI}"
export PG_CONNECTION_URI
PGUSER="${PGUSER:-postgres}" PGUSER="${PGUSER:-postgres}"
export PGUSER export PGUSER
PGPORT="${PGPORT:-5432}" PGPORT="${PGPORT:-5432}"
@@ -15,11 +17,11 @@ function connect_circle() {
# try to handle circleci/docker oddness # try to handle circleci/docker oddness
let rc=1 let rc=1
while [[ $rc -eq 1 ]]; do while [[ $rc -eq 1 ]]; do
nc -z ${PGHOST} ${PGPORT} nc -z ${PG_CONNECTION_URI}
let rc=$? let rc=$?
done done
if [[ $rc -ne 0 ]]; then if [[ $rc -ne 0 ]]; then
echo "Fatal: Could not connect to $PGHOST" echo "Fatal: Could not connect to $PG_CONNECTION_URI"
exit 1 exit 1
fi fi
} }
@@ -30,7 +32,7 @@ if [[ -n $CIRCLECI ]]; then
fi fi
for i in {1..10}; do for i in {1..10}; do
if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then if pg_isready --d "${PG_CONNECTION_URI}"; then
break break
fi fi