Skip to content

Commit

Permalink
Merge branch 'main' into 02-05-add_base_implementation_of_catalog_sup…
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
mikealfare committed Mar 7, 2025
2 parents 37827b8 + b570762 commit 92132cf
Show file tree
Hide file tree
Showing 35 changed files with 271 additions and 243 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/_bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ on:
version:
description: "Choose the version to bump to (e.g. 1.2.3rc1, patch, release)"
type: string
default: "beta"
default: ""
outputs:
initial:
description: "The version before the bump"
value: ${{ jobs.main.outputs.initial }}
final:
description: "The version after the bump"
value: ${{ jobs.main.outputs.final }}
secrets:
FISHTOWN_BOT_PAT:
description: "Token to commit/merge changes into branches"
Expand All @@ -40,14 +47,17 @@ on:
version:
description: "Choose the version to bump to (e.g. 1.2.3rc1, patch, release)"
type: string
default: "beta"
default: ""

permissions:
contents: write

jobs:
main:
runs-on: ${{ vars.DEFAULT_RUNNER }}
outputs:
initial: ${{ steps.version.outputs.initial
final: ${{ steps.version.outputs.final
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -56,17 +66,19 @@ jobs:
with:
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
- uses: pypa/hatch@install
# bump the version or perform a no-op ("")
- id: version
run: |
echo "initial=$(hatch version)" >> $GITHUB_OUTPUT
hatch version ${{ inputs.version }}
echo "final=$(hatch version)" >> $GITHUB_OUTPUT
working-directory: ./${{ inputs.package }}
- if: inputs.package == 'dbt-athena'
run: sed -i "s/$INITIAL/$FINAL/g" dbt-athena-community/pyproject.toml
- run: sed -i "s/$INITIAL/$FINAL/g" dbt-athena-community/pyproject.toml
if: inputs.package == 'dbt-athena' && steps.version.outputs.final != steps.version.outputs.initial
env:
INITIAL: ${{ steps.version.outputs.initial }}
FINAL: ${{ steps.version.outputs.final }}
- uses: ./.github/actions/bot-commit
if: steps.version.outputs.final != steps.version.outputs.initial
with:
message: "Bump version from ${{ steps.version.outputs.initial }} to ${{ steps.version.outputs.final }}"
94 changes: 9 additions & 85 deletions .github/workflows/_generate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
description: "Choose the package getting published"
type: string
default: "dbt-adapters"
merge:
description: "Choose whether to merge the changelog branch"
type: boolean
default: true
branch:
description: "Choose the branch to use"
type: string
Expand Down Expand Up @@ -41,29 +37,14 @@ on:
- "dbt-redshift"
- "dbt-snowflake"
- "dbt-spark"
merge:
description: "Choose whether to merge the changelog branch"
type: boolean
default: false
branch:
description: "Choose the branch to use"
type: string
default: "main"
secrets:
FISHTOWN_BOT_PAT:
description: "Token to commit/merge changes into branches"
required: true
IT_TEAM_MEMBERSHIP:
description: "Token that can view org level teams"
required: true

permissions:
contents: write

defaults:
run:
shell: bash

jobs:
version:
runs-on: ${{ vars.DEFAULT_RUNNER }}
Expand Down Expand Up @@ -117,26 +98,8 @@ jobs:
echo "exists=$exists">> $GITHUB_OUTPUT
working-directory: ./${{ inputs.package }}

temp-branch:
needs: [version, changelog]
if: needs.changelog.outputs.exists == 'false'
runs-on: ${{ vars.DEFAULT_RUNNER }}
outputs:
name: ${{ steps.branch.outputs.name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- id: branch
run: |
name="prep-release/${{ inputs.package }}/$GITHUB_RUN_ID"
echo "name=$name" >> $GITHUB_OUTPUT
- run: |
git checkout -b ${{ steps.branch.outputs.name }}
git push -u origin ${{ steps.branch.outputs.name }}
dbt-membership:
needs: [version, changelog]
needs: changelog
if: needs.changelog.outputs.exists == 'false'
runs-on: ${{ vars.DEFAULT_RUNNER }}
outputs:
Expand All @@ -156,16 +119,18 @@ jobs:
- run: rm ${{ steps.temp-file.outputs.name }}

generate-changelog:
needs: [version, changelog, temp-branch, dbt-membership]
needs:
- version
- changelog
- dbt-membership
if: needs.changelog.outputs.exists == 'false'
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.temp-branch.outputs.name }}
ref: ${{ inputs.branch }}
- run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
- run: |
brew install pre-commit
brew tap miniscruff/changie https://github.com/miniscruff/changie
brew install changie
- run: |
Expand All @@ -182,49 +147,8 @@ jobs:
working-directory: ./${{ inputs.package }}
env:
CHANGIE_CORE_TEAM: ${{ needs.dbt-membership.outputs.team }}
- run: pre-commit run --all-files
- uses: pre-commit/[email protected]
continue-on-error: true
- run: |
git config user.name "Github Build Bot"
git config user.email "[email protected]"
git pull
git add .
git commit -m "generate changelog"
git push
merge-changes:
needs: [temp-branch, generate-changelog]
if: ${{ needs.temp-branch.outputs.name != '' && inputs.merge }}
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bot-commit
with:
ref: ${{ needs.temp-branch.outputs.name }}
- uses: everlytic/[email protected]
with:
source_ref: ${{ needs.temp-branch.outputs.name }}
target_branch: ${{ inputs.branch }}
github_token: ${{ secrets.FISHTOWN_BOT_PAT }}
commit_message_template: "[Automated] Merged {source_ref} into target {target_branch} during release process"
- run: git push origin -d ${{ needs.temp-branch.outputs.name }}

branch:
needs: [temp-branch, merge-changes]
if: ${{ !failure() && !cancelled() }}
runs-on: ${{ vars.DEFAULT_RUNNER }}
# always run this job, regardless of whether changelog generation was skipped
# Get the sha that will be released. If the changelog already exists on the input sha and the version has already been bumped,
# then it is what we will release. Otherwise, we generated a changelog and did the version bump in this workflow and there is a
# new sha to use from the merge we just did. Grab that here instead.
outputs:
name: ${{ steps.branch.outputs.name }}
steps:
- id: branch
run: |
if [[ ${{ needs.temp-branch.outputs.name == '' || inputs.merge }} ]]
then
branch="${{ inputs.branch }}"
else
branch=${{ needs.temp-branch.outputs.name }}
fi
echo "name=$branch" >> $GITHUB_OUTPUT
message: "Generate changelog for ${{ needs.version.outputs.raw }}"
101 changes: 78 additions & 23 deletions .github/workflows/publish-oss.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Publish OSS"
run-name: "Publish OSS - ${{ github.actor }} - package:${{ inputs.package }} deploy-to:${{ inputs.deploy-to }} branch:${{ inputs.branch }} skip-unit-tests:${{ inputs.skip-unit-tests }} skip-integration-tests:${{ inputs.skip-integration-tests }}"
run-name: "Publish OSS - ${{ github.actor }} - package:${{ inputs.package }} deploy-to:${{ inputs.deploy-to }} branch:${{ inputs.branch }} version:${{ inputs.version }} skip-unit-tests:${{ inputs.skip-unit-tests }} skip-integration-tests:${{ inputs.skip-integration-tests }}"

on:
workflow_dispatch:
Expand Down Expand Up @@ -42,56 +42,78 @@ concurrency:
group: Publish_OSS-${{ inputs.package }}-${{ inputs.deploy-to }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
work-branch:
runs-on: ${{ vars.DEFAULT_RUNNER }}
outputs:
name: ${{ steps.branch.outputs.name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- id: branch
run: |
name="publish-oss/${{ inputs.package }}/$GITHUB_RUN_ID"
echo "name=$name" >> $GITHUB_OUTPUT
- run: |
git checkout -b ${{ steps.branch.outputs.name }}
git push -u origin ${{ steps.branch.outputs.name }}
bump-version:
if: inputs.version != ''
needs: work-branch
uses: ./.github/workflows/_bump-version.yml
with:
package: ${{ inputs.package }}
branch: ${{ inputs.branch }}
branch: ${{ needs.work-branch.outputs.name }}
version: ${{ inputs.version }}
secrets: inherit

generate-changelog:
if: always() && !failure()
needs:
- work-branch
- bump-version # bump-version may be a no-op, but the changelog should be generated for the latest version
uses: ./.github/workflows/_generate-changelog.yml
with:
package: ${{ inputs.package }}
branch: ${{ needs.work-branch.outputs.name }}
secrets: inherit

unit-tests:
if: |
always() && !failure() &&
inputs.skip-unit-tests == false &&
!contains(fromJSON('["dbt-tests-adapter"]'), inputs.package)
needs: bump-version # bump-version can be skipped and is not directly used
needs:
- work-branch
- bump-version # bump-version may be a no-op, but tests need to run with the latest version
uses: ./.github/workflows/_unit-tests.yml
with:
package: ${{ inputs.package }}
branch: ${{ inputs.branch }}
branch: ${{ needs.work-branch.outputs.name }}

integration-tests:
if: |
always() && !failure() &&
inputs.skip-integration-tests == false &&
!contains(fromJSON('["dbt-adapters", "dbt-tests-adapter"]'), inputs.package)
needs: bump-version # bump-version can be skipped and is not directly used
needs:
- work-branch
- bump-version # bump-version may be a no-op, but tests need to run with the latest version
uses: ./.github/workflows/_integration-tests.yml
with:
packages: ${{ toJSON(inputs.package) }}
branch: ${{ inputs.branch }}
secrets: inherit

generate-changelog:
if: always() && !failure()
needs: [bump-version, unit-tests, integration-tests]
uses: ./.github/workflows/_generate-changelog.yml
with:
package: ${{ inputs.package }}
merge: ${{ inputs.deploy-to == 'prod' }}
branch: ${{ inputs.branch }}
branch: ${{ needs.work-branch.outputs.name }}
secrets: inherit

publish:
if: always() && !failure()
needs: generate-changelog
needs:
- work-branch
- bump-version
- generate-changelog
- unit-tests
- integration-tests
runs-on: ${{ vars.DEFAULT_RUNNER }}
environment:
name: ${{ inputs.deploy-to }}
Expand All @@ -101,9 +123,27 @@ jobs:
# see https://github.com/marketplace/actions/pypi-publish
id-token: write
steps:

# merge changes before publishing to prod because we lock trusted publishing to main
- uses: everlytic/[email protected]
if: inputs.deploy-to == 'prod'
with:
source_ref: ${{ needs.work-branch.outputs.name }}
target_branch: ${{ inputs.branch }}
github_token: ${{ secrets.FISHTOWN_BOT_PAT }}
commit_message_template: "[Automated] Publish ${{ inputs.package }}==${{ needs.bump-version.outputs.final }}"
- uses: actions/checkout@v4
if: inputs.deploy-to == 'prod'
with:
ref: ${{ inputs.branch }}

# if we're not publishing to prod, just check out the work branch
- uses: actions/checkout@v4
if: inputs.deploy-to != 'prod'
with:
ref: ${{ needs.generate-changelog.outputs.branch-name || inputs.branch }}
ref: ${{ needs.work-branch.outputs.name }}

# build and publish using whichever branch was checked out above
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
Expand All @@ -123,6 +163,7 @@ jobs:
retry_wait_seconds: 10
max_attempts: 15 # 5 minutes: (10s timeout + 10s delay) * 15 attempts
command: wget ${{ vars.PYPI_PROJECT_URL }}/${{ inputs.package }}/${{ steps.version.outputs.version }}

# publish dbt-athena-community following dbt-athena
- if: inputs.package == 'dbt-athena'
run: hatch build && hatch run build:check-all
Expand All @@ -139,3 +180,17 @@ jobs:
retry_wait_seconds: 10
max_attempts: 15 # 5 minutes: (10s timeout + 10s delay) * 15 attempts
command: wget ${{ vars.PYPI_PROJECT_URL }}/dbt-athena-community/${{ steps.version.outputs.version }}

clean-up:
if: always()
needs:
- work-branch
- publish
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
# we should delete this regardless of whether we merged it to avoid building up stale release branches
- run: git push origin -d ${{ needs.work-branch.outputs.name }}
continue-on-error: true
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ repos:
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
Expand Down
4 changes: 2 additions & 2 deletions dbt-athena-community/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
# these versions should always match and they both should match the local version of dbt-athena
dependencies = ["dbt-athena==1.9.2a0"]
version = "1.9.2a0"
dependencies = ["dbt-athena==1.9.2"]
version = "1.9.2"
[project.urls]
Homepage = "https://github.com/dbt-labs/dbt-adapters/tree/main/dbt-athena"
Documentation = "https://docs.getdbt.com"
Expand Down
12 changes: 12 additions & 0 deletions dbt-athena/.changes/1.9.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## dbt-athena 1.9.2 - March 07, 2025

### Features

- Implement drop_glue_database macro and method ([#408](https://github.com/dbt-labs/dbt-adapters/issues/408))

### Under the Hood

- Issue a warning to dbt-athena-community users to migrate to dbt-athena ([#879](https://github.com/dbt-labs/dbt-adapters/issues/879))

### Contributors
- [@svdimchenko](https://github.com/svdimchenko) ([#408](https://github.com/dbt-labs/dbt-adapters/issues/408))
Loading

0 comments on commit 92132cf

Please sign in to comment.