Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: "Choose the Python version to test against"
type: string
default: "3.9"
hatch-env:
description: "The hatch environment to run tests on"
type: string
default: "default"
workflow_dispatch:
inputs:
packages:
Expand All @@ -46,6 +50,10 @@ on:
description: "Choose the Python version to test against"
type: choice
options: ["3.9", "3.10", "3.11", "3.12"]
hatch-env:
description: "The hatch environment to run tests on"
type: string
default: "default"

permissions:
id-token: write
Expand Down Expand Up @@ -89,12 +97,13 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.ASSUMABLE_ROLE_NAME }}
aws-region: ${{ vars.DBT_TEST_ATHENA_REGION_NAME }}
- run: hatch run integration-tests
- run: hatch run ${{ inputs.hatch-env }}:integration-tests

integration-tests-bigquery:
if: contains(fromJSON(inputs.packages), 'dbt-bigquery')
Expand Down Expand Up @@ -123,8 +132,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: hatch run integration-tests tests/functional -m "not flaky" --ddtrace
- run: hatch run ${{ inputs.hatch-env }}:integration-tests

integration-tests-bigquery-flaky:
# we only run this for one python version to avoid running in parallel
Expand Down Expand Up @@ -160,8 +170,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: hatch run integration-tests tests/functional -m flaky -n1 --ddtrace
- run: hatch run ${{ inputs.hatch-env }}:integration-tests-flaky

integration-tests-postgres:
if: contains(fromJSON(inputs.packages), 'dbt-postgres')
Expand Down Expand Up @@ -198,6 +209,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- run: psql -f ./scripts/setup_test_database.sql
env:
PGHOST: ${{ vars.POSTGRES_TEST_HOST }}
Expand All @@ -206,7 +218,7 @@ jobs:
PGPASSWORD: postgres
PGDATABASE: postgres
- uses: pypa/hatch@install
- run: hatch run integration-tests tests/functional --ddtrace
- run: hatch run ${{ inputs.hatch-env }}:integration-tests

integration-tests-postgres-psycopg2-check:
if: contains(fromJSON(inputs.packages), 'dbt-postgres')
Expand Down Expand Up @@ -279,6 +291,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- name: Create AWS IAM profiles
run: |
Expand All @@ -296,7 +309,7 @@ jobs:
aws configure --profile $AWS_ROLE_PROFILE set role_arn $AWS_ROLE_ARN
aws configure --profile $AWS_ROLE_PROFILE set region $AWS_REGION
aws configure --profile $AWS_ROLE_PROFILE set output json
- run: hatch run integration-tests tests/functional --ddtrace
- run: hatch run ${{ inputs.hatch-env }}:integration-tests

integration-tests-snowflake:
if: contains(fromJSON(inputs.packages), 'dbt-snowflake')
Expand Down Expand Up @@ -329,8 +342,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: hatch run integration-tests tests/functional --ddtrace
- run: hatch run ${{ inputs.hatch-env }}:integration-tests

integration-tests-spark:
if: contains(fromJSON(inputs.packages), 'dbt-spark')
Expand Down Expand Up @@ -364,6 +378,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: hatch run pip install -r dagger/requirements.txt
- run: hatch run integration-tests --profile ${{ matrix.profile }}
- run: hatch run ${{ inputs.hatch-env }}:integration-tests --profile ${{ matrix.profile }}
11 changes: 10 additions & 1 deletion .github/workflows/_unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: "Choose the Python version to test against"
type: string
default: 3.9
hatch-env:
description: "The hatch environment to run tests on"
type: string
default: "default"
workflow_dispatch:
inputs:
package:
Expand Down Expand Up @@ -54,6 +58,10 @@ on:
description: "Choose the Python version to test against"
type: choice
options: ["3.9", "3.10", "3.11", "3.12"]
hatch-env:
description: "The hatch environment to run tests on"
type: string
default: "default"

permissions:
contents: read
Expand All @@ -73,8 +81,9 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: brew install unixodbc
if: inputs.package == 'dbt-spark' && runner.os == 'macOS'
- run: hatch run unit-tests
- run: hatch run ${{ inputs.hatch-env }}:unit-tests
working-directory: ./${{ inputs.package }}
1 change: 1 addition & 0 deletions .github/workflows/_verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: echo "HATCH_PYTHON=${{ inputs.python-version }}" >> $GITHUB_ENV
- uses: pypa/hatch@install
- run: hatch build && hatch run build:check-all
working-directory: ./${{ inputs.package }}
2 changes: 2 additions & 0 deletions .github/workflows/publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ jobs:
with:
package: ${{ inputs.package }}
branch: ${{ inputs.branch }}
hatch-env: "ci"

integration-tests:
if: inputs.skip-integration-tests == false
uses: ./.github/workflows/_integration-tests.yml
with:
packages: ${{ toJSON(inputs.package) }}
branch: ${{ inputs.branch }}
hatch-env: "ci"
secrets: inherit

publish-internal:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-oss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
with:
package: ${{ inputs.package }}
branch: ${{ needs.work-branch.outputs.name }}
hatch-env: "cd"

integration-tests:
if: |
Expand All @@ -104,6 +105,7 @@ jobs:
with:
packages: ${{ toJSON(inputs.package) }}
branch: ${{ needs.work-branch.outputs.name }}
hatch-env: "cd"
secrets: inherit

publish:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
hatch-env: "ci"

integration-tests:
uses: ./.github/workflows/_integration-tests.yml
Expand All @@ -103,6 +104,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
hatch-env: "ci"
secrets: inherit

# This job does nothing and is only used for branch protection
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/scheduled-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
hatch-env: "ci"

integration-tests:
uses: ./.github/workflows/_integration-tests.yml
Expand All @@ -62,6 +63,7 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
hatch-env: "ci"
secrets: inherit

notification:
Expand Down
23 changes: 23 additions & 0 deletions dbt-adapters/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sources = ["src"]
[envs.default]
dependencies = [
"dbt_common @ git+https://github.com/dbt-labs/dbt-common.git",
"ddtrace==2.3.0",
'pre-commit==3.7.0',
"pytest",
"pytest-dotenv",
Expand Down Expand Up @@ -47,3 +48,25 @@ check-sdist = [
"pip freeze | grep dbt-adapters",
]
protobuf = "protoc -I=./dbt/adapters/events --python_out=./dbt/adapters/events ./dbt/adapters/events/adapter_types.proto"

[envs.ci]
dependencies = [
"dbt_common @ git+https://github.com/dbt-labs/dbt-common.git",
"ddtrace==2.3.0",
"pytest",
"pytest-dotenv",
"pytest-xdist",
]
[envs.ci.scripts]
unit-tests = "python -m pytest tests/unit --ddtrace"

[envs.cd]
pre-install-commands = []
dependencies = [
"ddtrace==2.3.0",
"pytest",
"pytest-dotenv",
"pytest-xdist",
]
[envs.cd.scripts]
unit-tests = "python -m pytest tests/unit --ddtrace"
39 changes: 36 additions & 3 deletions dbt-athena-community/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ pre-install-commands = [
"pip install -e ../dbt-athena",
]
dependencies = [
"ddtrace==2.3.0",
"isort~=5.13",
"moto~=5.0.13",
"pre-commit~=3.5",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-cov~=5.0",
"pytest-dotenv~=0.5",
"pytest-xdist~=3.6",
]
Expand All @@ -23,8 +23,8 @@ setup = [
"pre-commit install",
]
code-quality = "pre-commit run --all-files"
unit-tests = "pytest --cov=dbt --cov-report=html:htmlcov {args:../dbt-athena/tests/unit}"
integration-tests = "python -m pytest -n auto {args:../dbt-athena/tests/functional}"
unit-tests = "python -m pytest {args:../dbt-athena/tests/unit}"
integration-tests = "python -m pytest {args:../dbt-athena/tests/functional}"
all-tests = ["unit-tests", "integration-tests"]

[envs.build]
Expand All @@ -51,3 +51,36 @@ check-sdist = [
"pip freeze | grep dbt-athena-community",
"pip freeze | grep dbt-athena",
]

[envs.ci]
pre-install-commands = [
"pip install -e ../dbt-adapters",
"pip install -e ../dbt-tests-adapter",
"pip install -e ../dbt-athena",
]
dependencies = [
"ddtrace==2.3.0",
"isort~=5.13",
"moto~=5.0.13",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-xdist~=3.6",
]
[envs.ci.scripts]
unit-tests = "python -m pytest ../dbt-athena/tests/unit --ddtrace"
integration-tests = "python -m pytest ../dbt-athena/tests/functional --ddtrace"

[envs.cd]
pre-install-commands = []
dependencies = [
"dbt-tests-adapter>=1.11.0,<2.0",
"ddtrace==2.3.0",
"isort~=5.13",
"moto~=5.0.13",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-xdist~=3.6",
]
[envs.cd.scripts]
unit-tests = "python -m pytest -n auto ../dbt-athena/tests/unit --ddtrace"
integration-tests = "python -m pytest -n auto ../dbt-athena/tests/functional --ddtrace"
38 changes: 35 additions & 3 deletions dbt-athena/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ pre-install-commands = [
dependencies = [
"dbt-common @ git+https://github.com/dbt-labs/dbt-common.git",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core",
"ddtrace==2.3.0",
"moto~=5.0.13",
"pre-commit==3.7.0",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-cov~=5.0",
"pytest-dotenv~=0.5",
"pytest-xdist~=3.6",
]
Expand All @@ -27,8 +27,8 @@ setup = [
"cp -n test.env.example test.env",
]
code-quality = "pre-commit run --all-files"
unit-tests = "pytest --cov=dbt --cov-report=html:htmlcov {args:tests/unit}"
integration-tests = "python -m pytest -n auto {args:tests/functional}"
unit-tests = "python -m pytest {args:tests/unit}"
integration-tests = "python -m pytest {args:tests/functional}"
all-tests = ["unit-tests", "integration-tests"]

[envs.build]
Expand All @@ -53,3 +53,35 @@ check-sdist = [
"find ./dist/dbt_athena-*.gz -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/",
"pip freeze | grep dbt-athena",
]

[envs.ci]
pre-install-commands = [
"pip install -e ../dbt-adapters",
"pip install -e ../dbt-tests-adapter",
]
dependencies = [
"dbt-common @ git+https://github.com/dbt-labs/dbt-common.git",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core",
"ddtrace==2.3.0",
"moto~=5.0.13",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-xdist~=3.6",
]
[envs.ci.scripts]
unit-tests = "python -m pytest tests/unit --ddtrace"
integration-tests = "python -m pytest tests/functional --ddtrace"

[envs.cd]
pre-install-commands = []
dependencies = [
"dbt-tests-adapter>=1.11.0,<2.0",
"ddtrace==2.3.0",
"moto~=5.0.13",
"pyparsing~=3.1.4",
"pytest~=8.3",
"pytest-xdist~=3.6",
]
[envs.cd.scripts]
unit-tests = "python -m pytest tests/unit --ddtrace"
integration-tests = "python -m pytest tests/functional --ddtrace"
Loading