mirror of
https://github.com/dbt-labs/dbt-core
synced 2025-12-20 05:31:27 +00:00
Compare commits
1 Commits
gha-postgr
...
postgres-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9f893a291 |
@@ -5,6 +5,7 @@ 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'
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ 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: |
|
||||||
|
|||||||
37
.github/workflows/main.yml
vendored
37
.github/workflows/main.yml
vendored
@@ -165,6 +165,18 @@ jobs:
|
|||||||
os: [ubuntu-20.04]
|
os: [ubuntu-20.04]
|
||||||
split-group: ${{ fromJson(needs.integration-metadata.outputs.split-groups) }}
|
split-group: ${{ fromJson(needs.integration-metadata.outputs.split-groups) }}
|
||||||
include: ${{ fromJson(needs.integration-metadata.outputs.include) }}
|
include: ${{ fromJson(needs.integration-metadata.outputs.include) }}
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
env:
|
env:
|
||||||
TOXENV: integration
|
TOXENV: integration
|
||||||
DBT_INVOCATION_ENV: github-actions
|
DBT_INVOCATION_ENV: github-actions
|
||||||
@@ -186,29 +198,35 @@ 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:
|
env:
|
||||||
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
|
PGHOST: localhost
|
||||||
|
PGPORT: 5432
|
||||||
|
PGUSER: postgres
|
||||||
|
PGPASSWORD: postgres
|
||||||
|
PGDATABASE: postgres
|
||||||
|
|
||||||
- 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:
|
env:
|
||||||
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
|
PGHOST: localhost
|
||||||
|
PGPORT: 5432
|
||||||
|
PGUSER: postgres
|
||||||
|
PGPASSWORD: postgres
|
||||||
|
PGDATABASE: postgres
|
||||||
|
|
||||||
- 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:
|
env:
|
||||||
CONNECTION_STR: ${{ steps.postgres.outputs.connection-uri }}
|
PGHOST: localhost
|
||||||
|
PGPORT: 5432
|
||||||
|
PGUSER: postgres
|
||||||
|
PGPASSWORD: postgres
|
||||||
|
PGDATABASE: postgres
|
||||||
|
|
||||||
- name: Install python tools
|
- name: Install python tools
|
||||||
run: |
|
run: |
|
||||||
@@ -225,7 +243,6 @@ 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()
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ 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}"
|
||||||
@@ -17,11 +15,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 ${PG_CONNECTION_URI}
|
nc -z ${PGHOST} ${PGPORT}
|
||||||
let rc=$?
|
let rc=$?
|
||||||
done
|
done
|
||||||
if [[ $rc -ne 0 ]]; then
|
if [[ $rc -ne 0 ]]; then
|
||||||
echo "Fatal: Could not connect to $PG_CONNECTION_URI"
|
echo "Fatal: Could not connect to $PGHOST"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -32,7 +30,7 @@ if [[ -n $CIRCLECI ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for i in {1..10}; do
|
for i in {1..10}; do
|
||||||
if pg_isready --d "${PG_CONNECTION_URI}"; then
|
if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user