Skip to content

Commit

Permalink
update structure for the monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Nov 16, 2024
1 parent ae48e67 commit 223dbd1
Show file tree
Hide file tree
Showing 280 changed files with 588 additions and 1,204 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/_code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Code quality"

on:
workflow_dispatch:
inputs:
branch:
description: "Choose the branch to check"
type: string
default: "main"
repository:
description: "Choose the repository to check, when using a fork"
type: string
default: "dbt-labs/dbt-postgres"

permissions:
contents: read

env:
package: dbt-postgres

jobs:
code-quality:
uses: dbt-labs/dbt-adapters/.workflows/_code-quality.yml@monorepo-prep
with:
package: ${{ env.package }}
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
141 changes: 141 additions & 0 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: "Integration tests"

on:
workflow_call:
inputs:
branch:
description: "Choose the branch to test"
type: string
default: "main"
repository:
description: "Choose the repository to test, when using a fork"
type: string
default: "dbt-labs/dbt-athena"
os:
description: "Choose the OS to test against"
type: string
default: ${{ vars.DEFAULT_RUNNER }}
python-version:
description: "Choose the Python version to test against"
type: string
default: ${{ vars.DEFAULT_PYTHON_VERSION }}
dbt-core-branch:
description: "Choose the branch of dbt-core to use"
type: string
default: "main"
dbt-common-branch:
description: "Choose the branch of dbt-common to use"
type: string
default: "main"
workflow_dispatch:
inputs:
branch:
description: "Choose the branch to test"
type: string
default: "main"
repository:
description: "Choose the repository to test, when using a fork"
type: string
default: "dbt-labs/dbt-athena"
os:
description: "Choose the OS to test against"
type: string
default: ${{ vars.DEFAULT_RUNNER }}
python-version:
description: "Choose the Python version to test against"
type: choice
options: ["3.9", "3.10", "3.11", "3.12"]
dbt-core-branch:
description: "Choose the branch of dbt-core to use"
type: string
default: "main"
dbt-common-branch:
description: "Choose the branch of dbt-common to use"
type: string
default: "main"

permissions: read-all

defaults:
run:
shell: bash

jobs:
integration:
name: Integration Tests
runs-on: ${{ inputs.os }}
env:
POSTGRES_TEST_HOST: localhost
POSTGRES_TEST_PORT: 5432
POSTGRES_TEST_USER: root
POSTGRES_TEST_PASS: password
POSTGRES_TEST_DATABASE: dbt
POSTGRES_TEST_THREADS: 4
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: ${{ env.POSTGRES_TEST_PASS }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: pypa/hatch@install
- run: |
./.github/scripts/update_dev_dependency_branches.sh \
${{ inputs.dbt-core-branch }} \
${{ inputs.dbt-common-branch }}
cat pyproject.toml
- run: psql -f ./scripts/setup_test_database.sql
env:
PGHOST: ${{ env.POSTGRES_TEST_HOST }}
PGPORT: ${{ env.POSTGRES_TEST_PORT }}
PGUSER: ${{ env.POSTGRES_TEST_USER }}
PGPASSWORD: ${{ env.POSTGRES_TEST_PASS }}
PGDATABASE: ${{ env.POSTGRES_TEST_DATABASE }}
- run: hatch run integration-tests
working-directory: ./dbt-postgres

psycopg2-check:
name: "Test psycopg2 build version"
runs-on: ${{ inputs.os }}
strategy:
matrix:
include:
# no override
- expected: psycopg2-binary
# invalid override
- input: rubber-baby-buggy-bumpers
expected: psycopg2-binary
# we have not implemented the hook yet, so this doesn't work
- input: psycopg2
expected: psycopg2-binary
# verify that the workaround documented in the `README.md` continues to work
- workaround: true
expected: psycopg2
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: brew install postgresql
if: ${{ runner == 'macos-14' }}
- run: .github/scripts/psycopg2-check.sh
env:
DBT_PSYCOPG2_NAME: ${{ matrix.input }}
PSYCOPG2_WORKAROUND: ${{ matrix.workaround }}
PSYCOPG2_EXPECTED_NAME: ${{ matrix.expected }}
25 changes: 25 additions & 0 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Publish Internally"

on:
workflow_dispatch:
inputs:
deploy-to:
description: "Choose whether to publish to test or prod"
type: string
default: "test"
branch:
description: "Choose the branch to publish"
type: string
default: "main"

defaults:
run:
shell: bash

jobs:
publish-internal:
uses: dbt-labs/dbt-adapters/.github/workflows/_publish-internal.yml@monorepo-prep
with:
package: "dbt-postgres"
deploy-to: ${{ inputs.deploy-to }}
branch: ${{ inputs.branch }}
28 changes: 28 additions & 0 deletions .github/workflows/_publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Publish to PyPI"

on:
workflow_dispatch:
inputs:
deploy-to:
description: "Choose whether to publish to test or prod"
type: environment
default: "test"
branch:
description: "Choose the branch to publish"
type: string
default: "main"

permissions:
contents: read

defaults:
run:
shell: bash

jobs:
publish:
uses: dbt-labs/dbt-adapters/.github/workflows/_publish-pypi.yml@monorepo-prep
with:
package: "dbt-postgres"
deploy-to: ${{ inputs.deploy-to }}
branch: ${{ inputs.branch }}
34 changes: 34 additions & 0 deletions .github/workflows/_unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Unit tests"

on:
workflow_dispatch:
inputs:
branch:
description: "Choose the branch to test"
type: string
default: "main"
repository:
description: "Choose the repository to test, when using a fork"
type: string
default: "dbt-labs/dbt-postgres"
os:
description: "Choose the OS to test against"
type: string
default: ${{ vars.DEFAULT_RUNNER }}
python-version:
description: "Choose the Python version to test against"
type: choice
options: ["3.9", "3.10", "3.11", "3.12"]

permissions:
contents: read

jobs:
unit-tests:
uses: dbt-labs/dbt-adapters/.github/workflows/_unit-tests.yml@monorepo-prep
with:
package: "dbt-postgres"
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
os: ${{ inputs.os }}
python-version: ${{ inputs.python-version }}
29 changes: 0 additions & 29 deletions .github/workflows/changelog-entry-check.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/code-quality.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/docs-issue.yml

This file was deleted.

Loading

0 comments on commit 223dbd1

Please sign in to comment.