Skip to content

Commit

Permalink
Merge branch 'main' into mp/fix_is_iceberg_warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Mar 7, 2025
2 parents 86eab7f + b570762 commit f175b82
Show file tree
Hide file tree
Showing 66 changed files with 801 additions and 303 deletions.
23 changes: 23 additions & 0 deletions .github/actions/bot-commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Bot commit"
description: "Commit to a local branch using the build bot"

inputs:
message:
description: "The commit message"
required: true

runs:
using: composite
steps:
- run: |
git config user.name "$USERNAME"
git config user.email "$EMAIL"
git pull
git add .
git commit -m "$MESSAGE"
git push
shell: bash
env:
USERNAME: "Github Build Bot"
EMAIL: "[email protected]"
MESSAGE: "[Automated] ${{ inputs.message }}"
84 changes: 84 additions & 0 deletions .github/workflows/_bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Bump version"

on:
workflow_call:
inputs:
package:
description: "Choose the package to bump"
type: string
required: true
branch:
description: "Choose the branch to use"
type: string
default: "main"
version:
description: "Choose the version to bump to (e.g. 1.2.3rc1, patch, release)"
type: string
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"
required: true
workflow_dispatch:
inputs:
package:
description: "Choose the package to bump"
type: choice
options:
- "dbt-adapters"
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-snowflake"
- "dbt-spark"
branch:
description: "Choose the branch to use"
type: string
default: "main"
version:
description: "Choose the version to bump to (e.g. 1.2.3rc1, patch, release)"
type: string
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:
ref: ${{ inputs.branch }}
- uses: actions/setup-python@v5
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 }}
- 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 }}"
3 changes: 2 additions & 1 deletion .github/workflows/_changelog-entry-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Changelog entry check"
name: "# Changelog entry check"
run-name: "Changelog entry check - ${{ github.actor }} - package:${{ inputs.package }} pull-request:${{ inputs.pull-request }}"

# this cannot be tested via workflow_dispatch
# dorny/paths-filter inspects the current trigger to determine how to compare branches
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_code-quality.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Code quality"
name: "# Code quality"
run-name: "Code quality - ${{ github.actor }} - branch:${{ inputs.branch }} repository:${{ inputs.repository }}"

on:
workflow_call:
Expand Down
101 changes: 12 additions & 89 deletions .github/workflows/_generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Changelog generation"
name: "# Changelog generation"
run-name: "Changelog generation - ${{ github.actor }} - package:${{ inputs.package }} merge:${{ inputs.merge }} branch:${{ inputs.branch }}"

on:
workflow_call:
Expand All @@ -7,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 All @@ -33,36 +30,21 @@ on:
type: choice
options:
- "dbt-adapters"
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "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 @@ -116,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 @@ -155,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 @@ -181,51 +147,8 @@ jobs:
working-directory: ./${{ inputs.package }}
env:
CHANGIE_CORE_TEAM: ${{ needs.dbt-membership.outputs.team }}
- run: |
pre-commit run trailing-whitespace --files __version__.py CHANGELOG.md .changes/*
pre-commit run end-of-file-fixer --files __version__.py CHANGELOG.md .changes/*
- 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 }}"
5 changes: 3 additions & 2 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Integration tests"
name: "# Integration tests"
run-name: "Integration tests - ${{ github.actor }} - package:${{ inputs.package }} branch:${{ inputs.branch }} repository:${{ inputs.repository }} os:${{ inputs.os }} python-version:${{ inputs.python-version }}"

on:
workflow_call:
Expand Down Expand Up @@ -53,7 +54,7 @@ permissions:
env:
DBT_INVOCATION_ENV: ${{ vars.DBT_INVOCATION_ENV }}
DD_CIVISIBILITY_AGENTLESS_ENABLED: ${{ vars.DD_CIVISIBILITY_AGENTLESS_ENABLED }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
DD_SITE: ${{ vars.DD_SITE }}
DD_ENV: ${{ vars.DD_ENV }}
DD_SERVICE: ${{ github.event.repository.name }} # this can change per run because of forks
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Publish internally"
name: "# Publish internal"
run-name: "Publish internal - ${{ github.actor }} - package:${{ inputs.package }} branch:${{ inputs.branch }}"

on:
workflow_call:
Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:
publish:
runs-on: ${{ vars.DEFAULT_RUNNER }}
environment:
name: "prod"
name: "cloud-prod"
steps:
- uses: actions/checkout@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Publish to PyPI"
name: "# Publish PyPI"
run-name: "Publish PyPI - ${{ github.actor }} - package:${{ inputs.package }} deploy-to:${{ inputs.deploy-to }} branch:${{ inputs.branch }}"

on:
workflow_call:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Unit tests"
name: "# Unit tests"
run-name: "Unit tests - ${{ github.actor }} - package:${{ inputs.package }} branch:${{ inputs.branch }} repository:${{ inputs.repository }} os:${{ inputs.os }} python-version:${{ inputs.python-version }}"

on:
workflow_call:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/_verify-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: "Verify build"
name: "# Verify build"
run-name: "Verify build - ${{ github.actor }} - package:${{ inputs.package }} branch:${{ inputs.branch }} repository:${{ inputs.repository }} os:${{ inputs.os }} python-version:${{ inputs.python-version }}"

on:
workflow_call:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Issue triage"
run-name: "Issue triage - #${{ github.event.issue.number }}: ${{ github.event.issue.title }} - ${{ github.actor }}"
run-name: "Issue triage - ${{ github.actor }} - #${{ github.event.issue.number }}: ${{ github.event.issue.title }}"

on: issue_comment

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-internal.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Publish to internal"
run-name: "Publish to internal - ${{ inputs.package }} - ${{ github.actor }}"
name: "Publish internal"
run-name: "Publish internal - ${{ github.actor }} - package:${{ inputs.package }} branch:${{ inputs.branch }} skip-unit-tests:${{ inputs.skip-unit-tests }} skip-integration-tests:${{ inputs.skip-integration-tests }}"

on:
workflow_dispatch:
Expand Down
Loading

0 comments on commit f175b82

Please sign in to comment.