Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADAP-1115: Move to hatch and pyproject.toml #1250

Merged
merged 67 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
6df3421
move config files into pyproject.toml and hatch.toml
mikealfare Nov 17, 2024
5869413
update workflow files to use hatch.toml
mikealfare Nov 17, 2024
06b5c33
revert formatting changes in integration.yml
mikealfare Nov 17, 2024
890c42d
revert formatting changes in integration.yml
mikealfare Nov 17, 2024
a3b8287
revert formatting changes in main.yml
mikealfare Nov 17, 2024
a63cbb7
revert formatting changes in main.yml
mikealfare Nov 17, 2024
9f2f504
revert formatting changes in release.yml
mikealfare Nov 17, 2024
4819e5e
revert formatting changes in release.yml
mikealfare Nov 17, 2024
16f0f06
revert formatting changes in release.yml
mikealfare Nov 17, 2024
85114b1
changelog
mikealfare Nov 17, 2024
38198e9
add dd tracking
mikealfare Nov 18, 2024
00d88dd
remove references to postgres
mikealfare Nov 18, 2024
582afbf
simplify pyproject.toml
mikealfare Nov 18, 2024
f37457c
Merge branch 'main' into move-to-hatch
mikealfare Dec 4, 2024
2614d44
make the release prep call local
mikealfare Dec 5, 2024
c01a3b9
use hatch to get the current version
mikealfare Dec 5, 2024
7000210
minimize changes to main workflow
mikealfare Dec 7, 2024
a290aa3
Merge branch 'main' into move-to-hatch
mikealfare Dec 7, 2024
07442aa
merge main into feature branch
mikealfare Dec 7, 2024
36e6f85
add the init file in the integration tests root
mikealfare Dec 7, 2024
7484c8b
add the working directory for integration tests
mikealfare Dec 7, 2024
25f2950
add the working directory for integration tests
mikealfare Dec 7, 2024
2a0f194
remove the working directory from integration tests
mikealfare Dec 7, 2024
a42d081
remove the base init file in tests for pytest
mikealfare Dec 7, 2024
5e1ddf3
remove ddtrace for debugging
mikealfare Dec 7, 2024
12ac39c
add ddtrace back, with explicit tests/functional
mikealfare Dec 7, 2024
68165c5
remove ddtrace again
mikealfare Dec 7, 2024
87365f3
remove ddtrace again
mikealfare Dec 7, 2024
0273da4
hard pin ubuntu images to avoid network disconnects while GHA migrate…
mikealfare Dec 9, 2024
bd0c4ab
fix dbt dependency updated; remove extra python setup call
mikealfare Dec 10, 2024
0f81cbd
Merge branch 'main' into move-to-hatch
mikealfare Dec 10, 2024
c3faabc
revert os pin
mikealfare Dec 10, 2024
596876e
add dbt-tests-adapter to the dev deps update
mikealfare Dec 10, 2024
5aaa7c4
add tests root init file back
mikealfare Dec 10, 2024
8e9ef3a
move test matrix into the workflow; remove call to ddtrace
mikealfare Dec 10, 2024
85d792a
fix pytest config in pyproject.toml
mikealfare Dec 10, 2024
d67dd33
fix job name
mikealfare Dec 10, 2024
aa1b2c3
remove unused script
mikealfare Dec 10, 2024
8670b23
reduce pr noise
mikealfare Dec 10, 2024
58eb973
fix dependency pins
mikealfare Dec 11, 2024
ab5eeef
fix pytest config
mikealfare Dec 11, 2024
acd933e
pin snowflake sdk to troubleshoot ci memory issues
mikealfare Dec 11, 2024
7c2ae97
add ddtrace back; it doesn't look like that's causing the memory issue
mikealfare Dec 11, 2024
3d64a46
break out incremental tests from other tests because that's where CI …
mikealfare Dec 11, 2024
ac29ea2
break out tests into one module at a time to troubleshoot memory issu…
mikealfare Dec 11, 2024
8f0d68c
add filter for utcnow deprecation, remove filter for resource warning
mikealfare Dec 11, 2024
78469fe
add filter for utcnow deprecation, remove filter for resource warning
mikealfare Dec 11, 2024
7f72f56
add filter for utcnow deprecation, remove filter for resource warning
mikealfare Dec 11, 2024
5e76a7e
add filter for utcnow deprecation, remove other filters
mikealfare Dec 11, 2024
c82b6b6
remove pytest warning filters
mikealfare Dec 11, 2024
5755940
remove pytest warning filter for utcnow deprecation
mikealfare Dec 11, 2024
9377c5f
add test groups to troubleshoot where the memory issue on ubuntu
mikealfare Dec 11, 2024
c524822
swap args order for pytest, don't mark anything outside of functional…
mikealfare Dec 11, 2024
58d8b66
group_6 was missing
mikealfare Dec 11, 2024
b069393
remove group_2 and isolate newer tests into group_6
mikealfare Dec 11, 2024
3439bc4
remove group_3 and group_4
mikealfare Dec 11, 2024
b85682a
add group_4 back in
mikealfare Dec 11, 2024
2b66d21
move more things into group_1
mikealfare Dec 12, 2024
8b416c3
Merge branch 'main' into move-to-hatch
mikealfare Dec 16, 2024
24c57af
group tests by when they were updated for troubleshooting
mikealfare Dec 17, 2024
764dbdd
pull out python model tests for troubleshooting
mikealfare Dec 17, 2024
37d2dae
mark high memory tests and run as a separate pytest run
mikealfare Dec 18, 2024
eb06873
mark high memory tests and run as a separate pytest run
mikealfare Dec 18, 2024
40ec4b5
fix build targets
mikealfare Dec 19, 2024
c6f90e7
remove high_memory marker
mikealfare Dec 19, 2024
594de08
reduce pr noise
mikealfare Dec 19, 2024
eddad0c
Merge branch 'main' into move-to-hatch
mikealfare Dec 19, 2024
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
35 changes: 0 additions & 35 deletions .bumpversion.cfg

This file was deleted.

6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241117-184430.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Move from setup.py to pyproject.toml and to hatch as a dev tool
time: 2024-11-17T18:44:30.85288-05:00
custom:
Author: mikealfare
Issue: "1250"
95 changes: 0 additions & 95 deletions .github/scripts/integration-test-matrix.js

This file was deleted.

15 changes: 0 additions & 15 deletions .github/scripts/update_dependencies.sh

This file was deleted.

7 changes: 5 additions & 2 deletions .github/scripts/update_dev_dependency_branches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ set -e
dbt_adapters_branch=$1
dbt_core_branch=$2
dbt_common_branch=$3
target_req_file="dev-requirements.txt"
core_req_sed_pattern="s|dbt-core.git.*#egg=dbt-core|dbt-core.git@${dbt_core_branch}#egg=dbt-core|g"
target_req_file="hatch.toml"
core_req_sed_pattern="s|dbt-core.git.*#subdirectory=core|dbt-core.git@${dbt_core_branch}#subdirectory=core|g"
adapters_req_sed_pattern="s|dbt-adapters.git|dbt-adapters.git@${dbt_adapters_branch}|g"
tests_req_sed_pattern="s|dbt-adapters.git.*#subdirectory=dbt-tests-adapter|dbt-adapters.git@${dbt_adapters_branch}#subdirectory=dbt-tests-adapter|g"
common_req_sed_pattern="s|dbt-common.git|dbt-common.git@${dbt_common_branch}|g"
if [[ "$OSTYPE" == darwin* ]]; then
# mac ships with a different version of sed that requires a delimiter arg
sed -i "" "$adapters_req_sed_pattern" $target_req_file
sed -i "" "$tests_req_sed_pattern" $target_req_file
sed -i "" "$core_req_sed_pattern" $target_req_file
sed -i "" "$common_req_sed_pattern" $target_req_file
else
sed -i "$adapters_req_sed_pattern" $target_req_file
sed -i "$tests_req_sed_pattern" $target_req_file
sed -i "$core_req_sed_pattern" $target_req_file
sed -i "$common_req_sed_pattern" $target_req_file
fi
105 changes: 13 additions & 92 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,85 +76,31 @@ defaults:
shell: bash

jobs:
# generate test metadata about what files changed and the testing matrix to use
test-metadata:
# run if not a PR from a forked repository or has a label to mark as safe to test
if: >-
github.event_name != 'pull_request_target' ||
github.event.pull_request.head.repo.full_name == github.repository ||
contains(github.event.pull_request.labels.*.name, 'ok to test')
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.result }}

steps:
- name: Check out the repository (non-PR)
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Check out the repository (PR)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}

- name: Check if relevant files changed
if: github.event_name == 'pull_request_target'
# https://github.com/marketplace/actions/paths-changes-filter
# For each filter, it sets output variable named by the filter to the text:
# 'true' - if any of changed files matches any of filter rules
# 'false' - if none of changed files matches any of filter rules
# also, returns:
# `changes` - JSON array with names of all filters matching any of the changed files
uses: dorny/paths-filter@v3
id: get-changes
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
snowflake:
- '.github/**/*.yml'
- '.github/**/*.sh'
- 'dbt/**'
- 'tests/**'
- 'dev-requirements.txt'
- '*.py'
- name: Generate integration test matrix
id: generate-matrix
uses: actions/github-script@v7
env:
CHANGES: ${{ steps.get-changes.outputs.changes }}
with:
script: |
const script = require('./.github/scripts/integration-test-matrix.js')
const matrix = script({ context })
console.log(matrix)
return matrix
test:
name: ${{ matrix.adapter }} / python ${{ matrix.python-version }} / ${{ matrix.os }}
name: ${{ matrix.os }} / python ${{ matrix.python-version }}

# run if not a PR from a forked repository or has a label to mark as safe to test
# also checks that the matrix generated is not empty
if: >-
needs.test-metadata.outputs.matrix &&
fromJSON( needs.test-metadata.outputs.matrix ).include[0] &&
(
github.event_name != 'pull_request_target' ||
github.event.pull_request.head.repo.full_name == github.repository ||
contains(github.event.pull_request.labels.*.name, 'ok to test')
)
runs-on: ${{ matrix.os }}
needs: test-metadata

strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.test-metadata.outputs.matrix) }}
matrix:
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
include:
- os: macos-14
python-version: "3.9"
- os: windows-2022
python-version: "3.9"

env:
TOXENV: integration-${{ matrix.adapter }}
PYTEST_ADDOPTS: "-v --color=yes -n4 --csv integration_results.csv"
DBT_INVOCATION_ENV: github-actions
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
Expand Down Expand Up @@ -190,24 +136,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Update Adapters and Core branches (update dev_requirements.txt)
- name: Update Adapters and Core branches (update hatch.toml)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
./.github/scripts/update_dev_dependency_branches.sh \
${{ inputs.dbt_adapters_branch }} \
${{ inputs.dbt_core_branch }} \
${{ inputs.dbt_common_branch }}
cat dev-requirements.txt
cat hatch.toml

- name: Install python dependencies
run: |
python -m pip install --user --upgrade pip
python -m pip install tox
python -m pip --version
tox --version
uses: pypa/hatch@install

- name: Run tox (snowflake)
if: matrix.adapter == 'snowflake'
- run: hatch run integration-tests tests/functional --ddtrace
env:
SNOWFLAKE_TEST_ACCOUNT: ${{ secrets.SNOWFLAKE_TEST_ACCOUNT }}
SNOWFLAKE_TEST_PASSWORD: ${{ secrets.SNOWFLAKE_TEST_PASSWORD }}
Expand All @@ -226,26 +167,6 @@ jobs:
DBT_TEST_USER_1: dbt_test_role_1
DBT_TEST_USER_2: dbt_test_role_2
DBT_TEST_USER_3: dbt_test_role_3
run: tox -- --ddtrace

- name: Get current date
if: always()
id: date
run: echo "date=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT #no colons allowed for artifacts

- uses: actions/upload-artifact@v4
if: always()
with:
name: logs_${{ matrix.python-version }}_${{ matrix.os }}_${{ matrix.adapter }}-${{ steps.date.outputs.date }}
path: ./logs
overwrite: true

- uses: actions/upload-artifact@v4
if: always()
with:
name: integration_results_${{ matrix.python-version }}_${{ matrix.os }}_${{ matrix.adapter }}-${{ steps.date.outputs.date }}.csv
path: integration_results.csv
overwrite: true

require-label-comment:
runs-on: ubuntu-latest
Expand Down
Loading
Loading