Skip to content

Commit

Permalink
ADAP-1121: Move dbt-redshift into a namespace subpackage (#971)
Browse files Browse the repository at this point in the history
* move all project files into a namespace directory, use src convention for functional code
* update workflows for the namespace directory
* update hatch.toml to point to src directory
* move functional code into src directory
* fix pytest config options
  • Loading branch information
mikealfare authored Jan 7, 2025
1 parent b3030ff commit 7f9e40d
Show file tree
Hide file tree
Showing 142 changed files with 29 additions and 11 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/changelog-existence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ permissions:

jobs:
changelog:
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
uses: dbt-labs/dbt-adapters/.github/workflows/_changelog-entry-check.yml@main
with:
changelog_comment: 'Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the [dbt-redshift contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md
).'
skip_label: 'Skip Changelog'
pull-request: ${{ github.event.pull_request.number }}
secrets: inherit # this is only acceptable because we own the action we're calling
8 changes: 6 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ jobs:
- name: Update Adapters and Core branches (update dev_requirements.txt)
if: github.event_name == 'workflow_dispatch'
run: |
./.github/scripts/update_dev_dependency_branches.sh \
scripts/update_dev_dependency_branches.sh \
${{ inputs.dbt_adapters_branch }} \
${{ inputs.dbt_core_branch }} \
${{ inputs.dbt_common_branch }}
cat hatch.toml
working-directory: ./dbt-redshift

- uses: pypa/hatch@install

Expand Down Expand Up @@ -174,6 +175,7 @@ jobs:
AWS_REGION: ${{ vars.REDSHIFT_TEST_REGION }}

- run: hatch run integration-tests tests/functional -m "not flaky"
working-directory: ./dbt-redshift
env:
REDSHIFT_TEST_DBNAME: ${{ secrets.REDSHIFT_TEST_DBNAME }}
REDSHIFT_TEST_PASS: ${{ secrets.REDSHIFT_TEST_PASS }}
Expand Down Expand Up @@ -251,11 +253,12 @@ jobs:
- name: Update Adapters and Core branches (update dev_requirements.txt)
if: github.event_name == 'workflow_dispatch'
run: |
./.github/scripts/update_dev_dependency_branches.sh \
scripts/update_dev_dependency_branches.sh \
${{ inputs.dbt_adapters_branch }} \
${{ inputs.dbt_core_branch }} \
${{ inputs.dbt_common_branch }}
cat hatch.toml
working-directory: ./dbt-redshift

- name: Run tox (redshift)
env:
Expand All @@ -274,6 +277,7 @@ jobs:
DBT_TEST_USER_2: dbt_test_user_2
DBT_TEST_USER_3: dbt_test_user_3
run: hatch run integration-tests tests/functional -m flaky -n1 --ddtrace
working-directory: ./dbt-redshift

require-label-comment:
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
uses: pypa/hatch@install

- run: hatch run unit-tests
working-directory: ./dbt-redshift

build:
name: build packages
Expand All @@ -105,19 +106,23 @@ jobs:

- name: Build distributions
run: hatch build
working-directory: ./dbt-redshift

- name: Show distributions
run: ls -lh dist/
working-directory: ./dbt-redshift

- name: Check distribution descriptions
run: hatch run build:check-all
working-directory: ./dbt-redshift

- name: Check if this is an alpha version
id: check-is-alpha
run: |
export is_alpha=0
if [[ "$(ls -lh dist/)" == *"a1"* ]]; then export is_alpha=1; fi
echo "is_alpha=$is_alpha" >> $GITHUB_OUTPUT
working-directory: ./dbt-redshift

- uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:

- id: version-number-sources
run: echo "current_version=$(hatch version)" >> $GITHUB_OUTPUT
working-directory: ./dbt-redshift

- name: "Audit Version And Parse Into Parts"
id: semver
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ jobs:
archive_name=${{ github.event.repository.name }}-${{ inputs.version }}-${{ inputs.deploy-to }}
echo "name=$archive_name" >> $GITHUB_OUTPUT
- run: hatch build && hatch run build:check-all
working-directory: ./dbt-redshift
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.archive.outputs.name }}
path: dist/
retention-days: 3
working-directory: ./dbt-redshift

github-release:
name: GitHub Release
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release_prep_hatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ jobs:
is_current=true
fi
echo "is-current=$is_current" >> $GITHUB_OUTPUT
working-directory: ./dbt-redshift

- name: "[INFO] Skip version bump"
if: steps.version.outputs.is-current == 'true'
Expand All @@ -156,6 +157,7 @@ jobs:
does_exist=true
fi
echo "exists=$does_exist">> $GITHUB_OUTPUT
working-directory: ./dbt-redshift

- name: "[INFO] Skip changelog generation"
if: steps.changelog.outputs.exists == 'true'
Expand Down Expand Up @@ -255,11 +257,13 @@ jobs:
changie merge
env:
CHANGIE_CORE_TEAM: ${{ needs.core-team.outputs.team_membership }}
working-directory: ./dbt-redshift

- name: "Remove trailing whitespace and missing new lines"
# this step will fail on whitespace errors but also correct them
continue-on-error: true
run: hatch run code-quality
working-directory: ./dbt-redshift

- name: "Commit & push changes"
run: |
Expand Down Expand Up @@ -310,6 +314,7 @@ jobs:

- name: "Bump version to ${{ inputs.version }}"
run: hatch version ${{ inputs.version }}
working-directory: ./dbt-redshift

- name: "Commit & push changes"
run: |
Expand Down Expand Up @@ -355,6 +360,7 @@ jobs:

- name: "Run unit tests"
run: hatch run unit-tests
working-directory: ./dbt-redshift

integration-tests:
runs-on: ubuntu-latest
Expand All @@ -381,6 +387,7 @@ jobs:

- name: "Run integration tests"
run: hatch run integration-tests
working-directory: ./dbt-redshift

merge-release-branch:
runs-on: ubuntu-latest
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions hatch.toml → dbt-redshift/hatch.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[version]
path = "dbt/adapters/redshift/__version__.py"
path = "src/dbt/adapters/redshift/__version__.py"

[build.targets.sdist]
packages = ["dbt"]
packages = ["src/dbt"]
sources = ["src"]

[build.targets.wheel]
packages = ["dbt"]
packages = ["src/dbt"]
sources = ["src"]

[envs.default]
dependencies = [
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml → dbt-redshift/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ mypy_path = "third-party-stubs/"
[tool.pytest.ini_options]
testpaths = ["tests/functional", "tests/unit"]
env_files = ["test.env"]
addopts = "-v -n auto"
color = true
addopts = "-v --color=yes -n auto"
filterwarnings = [
"ignore:.*'soft_unicode' has been renamed to 'soft_str'*:DeprecationWarning",
"ignore:unclosed file .*:ResourceWarning",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7f9e40d

Please sign in to comment.