From 3a6c1c704c7686e23289d40c8b361fc83a992375 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 15:37:40 -0800 Subject: [PATCH 01/32] use target_branch instead of just main --- .github/workflows/release_prep_hatch.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index c32e0a2f..b3ade118 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -449,11 +449,11 @@ jobs: - name: "Checkout Repo ${{ github.repository }}" uses: actions/checkout@v3 - - name: "Merge Changes Into main" + - name: "Merge Changes Into ${{ inputs.target_branch }}" uses: everlytic/branch-merge@1.1.5 with: source_ref: ${{ needs.create-temp-branch.outputs.branch_name }} - target_branch: "main" + target_branch: ${{ inputs.target_branch }} github_token: ${{ secrets.FISHTOWN_BOT_PAT }} commit_message_template: "[Automated] Merged {source_ref} into target {target_branch} during release process" @@ -495,7 +495,7 @@ jobs: then branch=${{ needs.create-temp-branch.outputs.branch_name }} else - branch="main" + branch="${{ inputs.target_branch }}" fi echo "target_branch=$branch" >> $GITHUB_OUTPUT - name: "[Notification] Resolve Branch To Checkout" From b3253ba8a9e30b5195accd040e10d8b494297d44 Mon Sep 17 00:00:00 2001 From: Github Build Bot Date: Thu, 22 Feb 2024 23:39:50 +0000 Subject: [PATCH 02/32] Bumping version to 0.1.0a7 and generate changelog --- .changes/0.1.0-a7.md | 24 ++++++++++++++++++ .../Docs-20240109-131629.yaml | 0 .../Docs-20240109-131736.yaml | 0 .../Docs-20240109-131858.yaml | 0 .../Docs-20240109-131917.yaml | 0 .../Features-20240212-123544.yaml | 0 .../Fixes-20240215-141545.yaml | 0 .../Fixes-20240216-135420.yaml | 0 .../Under the Hood-20240109-131958.yaml | 0 .../Under the Hood-20240112-230236.yaml | 0 .../Under the Hood-20240123-121220.yaml | 0 .../Under the Hood-20240220-164223.yaml | 0 CHANGELOG.md | 25 ++++++++++++++++++- 13 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .changes/0.1.0-a7.md rename .changes/{unreleased => 0.1.0}/Docs-20240109-131629.yaml (100%) rename .changes/{unreleased => 0.1.0}/Docs-20240109-131736.yaml (100%) rename .changes/{unreleased => 0.1.0}/Docs-20240109-131858.yaml (100%) rename .changes/{unreleased => 0.1.0}/Docs-20240109-131917.yaml (100%) rename .changes/{unreleased => 0.1.0}/Features-20240212-123544.yaml (100%) rename .changes/{unreleased => 0.1.0}/Fixes-20240215-141545.yaml (100%) rename .changes/{unreleased => 0.1.0}/Fixes-20240216-135420.yaml (100%) rename .changes/{unreleased => 0.1.0}/Under the Hood-20240109-131958.yaml (100%) rename .changes/{unreleased => 0.1.0}/Under the Hood-20240112-230236.yaml (100%) rename .changes/{unreleased => 0.1.0}/Under the Hood-20240123-121220.yaml (100%) rename .changes/{unreleased => 0.1.0}/Under the Hood-20240220-164223.yaml (100%) diff --git a/.changes/0.1.0-a7.md b/.changes/0.1.0-a7.md new file mode 100644 index 00000000..98d72993 --- /dev/null +++ b/.changes/0.1.0-a7.md @@ -0,0 +1,24 @@ +## dbt-adapter 0.1.0-a7 - February 22, 2024 + +### Features + +* Update RelationConfig to capture all fields used by adapters + +### Fixes + +* Ignore adapter-level support warnings for 'custom' constraints +* Make all adapter zone tests importable by removing "Test" prefix + +### Docs + +* Configure `changie` +* Setup ADR tracking framework +* Create issue templates +* Create PR template + +### Under the Hood + +* Configure `dependabot` +* Implement unit testing in CI +* Allow version to be specified in either __version__.py or __about__.py +* Remove __init__.py file from dbt.tests diff --git a/.changes/unreleased/Docs-20240109-131629.yaml b/.changes/0.1.0/Docs-20240109-131629.yaml similarity index 100% rename from .changes/unreleased/Docs-20240109-131629.yaml rename to .changes/0.1.0/Docs-20240109-131629.yaml diff --git a/.changes/unreleased/Docs-20240109-131736.yaml b/.changes/0.1.0/Docs-20240109-131736.yaml similarity index 100% rename from .changes/unreleased/Docs-20240109-131736.yaml rename to .changes/0.1.0/Docs-20240109-131736.yaml diff --git a/.changes/unreleased/Docs-20240109-131858.yaml b/.changes/0.1.0/Docs-20240109-131858.yaml similarity index 100% rename from .changes/unreleased/Docs-20240109-131858.yaml rename to .changes/0.1.0/Docs-20240109-131858.yaml diff --git a/.changes/unreleased/Docs-20240109-131917.yaml b/.changes/0.1.0/Docs-20240109-131917.yaml similarity index 100% rename from .changes/unreleased/Docs-20240109-131917.yaml rename to .changes/0.1.0/Docs-20240109-131917.yaml diff --git a/.changes/unreleased/Features-20240212-123544.yaml b/.changes/0.1.0/Features-20240212-123544.yaml similarity index 100% rename from .changes/unreleased/Features-20240212-123544.yaml rename to .changes/0.1.0/Features-20240212-123544.yaml diff --git a/.changes/unreleased/Fixes-20240215-141545.yaml b/.changes/0.1.0/Fixes-20240215-141545.yaml similarity index 100% rename from .changes/unreleased/Fixes-20240215-141545.yaml rename to .changes/0.1.0/Fixes-20240215-141545.yaml diff --git a/.changes/unreleased/Fixes-20240216-135420.yaml b/.changes/0.1.0/Fixes-20240216-135420.yaml similarity index 100% rename from .changes/unreleased/Fixes-20240216-135420.yaml rename to .changes/0.1.0/Fixes-20240216-135420.yaml diff --git a/.changes/unreleased/Under the Hood-20240109-131958.yaml b/.changes/0.1.0/Under the Hood-20240109-131958.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20240109-131958.yaml rename to .changes/0.1.0/Under the Hood-20240109-131958.yaml diff --git a/.changes/unreleased/Under the Hood-20240112-230236.yaml b/.changes/0.1.0/Under the Hood-20240112-230236.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20240112-230236.yaml rename to .changes/0.1.0/Under the Hood-20240112-230236.yaml diff --git a/.changes/unreleased/Under the Hood-20240123-121220.yaml b/.changes/0.1.0/Under the Hood-20240123-121220.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20240123-121220.yaml rename to .changes/0.1.0/Under the Hood-20240123-121220.yaml diff --git a/.changes/unreleased/Under the Hood-20240220-164223.yaml b/.changes/0.1.0/Under the Hood-20240220-164223.yaml similarity index 100% rename from .changes/unreleased/Under the Hood-20240220-164223.yaml rename to .changes/0.1.0/Under the Hood-20240220-164223.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ca9d33a..85ed1dfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,5 +5,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## dbt-adapter 0.1.0-a7 - February 22, 2024 + +### Features + +* Update RelationConfig to capture all fields used by adapters + +### Fixes + +* Ignore adapter-level support warnings for 'custom' constraints +* Make all adapter zone tests importable by removing "Test" prefix + +### Docs + +* Configure `changie` +* Setup ADR tracking framework +* Create issue templates +* Create PR template + +### Under the Hood + +* Configure `dependabot` +* Implement unit testing in CI +* Allow version to be specified in either __version__.py or __about__.py +* Remove __init__.py file from dbt.tests -No releases yet, this file will be updated when generating your first release. From 168fb30e411261b6ceeb9b937521dc11104bce43 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 15:52:07 -0800 Subject: [PATCH 03/32] specify artifact_name --- .github/workflows/release.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index baa32604..a6bb6f15 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -133,12 +133,10 @@ jobs: with: working-dir: "./dbt-tests-adapter/" - # this step is only needed for the release process - name: "Upload Build Artifact" - if: ${{ github.event_name == 'workflow_call' }} uses: actions/upload-artifact@v3 with: - name: ${{ steps.version.outputs.version_number }} + name: ${{ steps.version.outputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} path: | ${{ inputs.changelog_path }} ./dist/ @@ -149,14 +147,14 @@ jobs: if: ${{ !failure() && !cancelled() }} needs: [build-and-test] - - uses: dbt-labs/dbt-release/.github/workflows/github-release.yml@main + uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@bumpVersion with: version_number: ${{ inputs.version_number }} changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} test_run: ${{ inputs.deploy-to == 'test' && true || false }} sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} + artifact_name: ${{ steps.version.outputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} pypi-release: name: Publish to PyPI From 1a728a90de3c803335c5f6c862894cf9769ff873 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 15:54:03 -0800 Subject: [PATCH 04/32] specify artifact_name --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a6bb6f15..6280214e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -136,7 +136,7 @@ jobs: - name: "Upload Build Artifact" uses: actions/upload-artifact@v3 with: - name: ${{ steps.version.outputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} path: | ${{ inputs.changelog_path }} ./dist/ @@ -154,7 +154,7 @@ jobs: changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} test_run: ${{ inputs.deploy-to == 'test' && true || false }} sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} - artifact_name: ${{ steps.version.outputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + artifact_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} pypi-release: name: Publish to PyPI From d691e03b7120fb7a7c35c0b2e87301650a96f421 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 15:56:30 -0800 Subject: [PATCH 05/32] specify artifact_name --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6280214e..109df27f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,7 +147,7 @@ jobs: if: ${{ !failure() && !cancelled() }} needs: [build-and-test] - uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@bumpVersion + uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion with: version_number: ${{ inputs.version_number }} @@ -168,6 +168,6 @@ jobs: uses: ./.github/actions/publish-pypi with: repository-url: ${{ vars.PYPI_REPOSITORY_URL }} - artifacts-dir: ${{ inputs.version_number }} + artifacts-dir: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From e151d836717d986f50a4dc994a1deead81c98508 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 15:57:14 -0800 Subject: [PATCH 06/32] add github-release.yml --- .github/workflows/github-release.yml | 252 +++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 .github/workflows/github-release.yml diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 00000000..6f8def12 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,252 @@ +# **what?** +# Create a new release on GitHub and include any artifacts in the `/dist` directory of the GitHUb artifacts store. +# +# Inputs: +# sha: The commit to attach to this release +# version_number: The release version number (i.e. 1.0.0b1, 1.2.3rc2, 1.0.0) +# changelog_path: Path to the changelog file for release notes +# test_run: Test run (Publish release as draft) +# +# **why?** +# Reusable and consistent GitHub release process. +# +# **when?** +# Call after a successful build. Build artifacts should be ready to release and live in a dist/ directory. +# +# This workflow expects the artifacts to already be built and living in the artifact store of the workflow. +# +# Validation Checks +# +# 1. If no release already exists for this commit and version, create the tag and release it to GitHub. +# 2. If a release already exists for this commit, skip creating the release but finish with a success. +# 3. If a release exists for this commit under a different tag, fail. +# 4. If the commit is already associated with a different release, fail. + +name: GitHub Release + +on: + workflow_call: + inputs: + sha: + description: The commit to attach to this release + required: true + type: string + version_number: + description: The release version number (i.e. 1.0.0b1) + required: true + type: string + changelog_path: + description: Path to the changelog file for release notes + required: true + type: string + test_run: + description: Test run (Publish release as draft) + required: true + type: boolean + artifact_name: + description: artifact name to download + required: true + type: string + outputs: + tag: + description: The path to the changelog for this version + value: ${{ jobs.check-release-exists.outputs.tag }} + +permissions: + contents: write + +env: + REPO_LINK: ${{ github.server_url }}/${{ github.repository }} + NOTIFICATION_PREFIX: "[GitHub Release]" + +jobs: + log-inputs: + runs-on: ubuntu-latest + steps: + - name: "[DEBUG] Print Variables" + run: | + echo The last commit sha in the release: ${{ inputs.sha }} + echo The release version number: ${{ inputs.version_number }} + echo Expected Changelog path: ${{ inputs.changelog_path }} + echo Test run: ${{ inputs.test_run }} + echo Repo link: ${{ env.REPO_LINK }} + echo Notification prefix: ${{ env.NOTIFICATION_PREFIX }} + + check-release-exists: + runs-on: ubuntu-latest + outputs: + exists: ${{ steps.release_check.outputs.exists }} + draft_exists: ${{ steps.release_check.outputs.draft_exists }} + tag: ${{ steps.set_tag.outputs.tag }} + + steps: + - name: "Generate Release Tag" + id: set_tag + run: echo "tag=v${{ inputs.version_number }}" >> $GITHUB_OUTPUT + + # When the GitHub CLI doesn't find a release for the given tag, it will exit 1 with a + # message of "release not found". In our case, it's not an actual error, just a + # confirmation that the release does not already exists so we can go ahead and create it. + # The `|| true` makes it so the step does not exit with a non-zero exit code + # Also check if the release already exists is draft state. If it does, and we are not + # testing then we can publish that draft as is. If it's in draft and we are testing, skip the + # release. + - name: "Check If Release Exists For Tag ${{ steps.set_tag.outputs.tag }}" + id: release_check + run: | + output=$((gh release view ${{ steps.set_tag.outputs.tag }} --json isDraft,targetCommitish --repo ${{ env.REPO_LINK }}) 2>&1) || true + if [[ "$output" == "release not found" ]] + then + title="Release for tag ${{ steps.set_tag.outputs.tag }} does not exist." + message="Check passed." + echo "exists=false" >> $GITHUB_OUTPUT + echo "draft_exists=false" >> $GITHUB_OUTPUT + echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + exit 0 + fi + commit=$(jq -r '.targetCommitish' <<< "$output") + if [[ $commit != ${{ inputs.sha }} ]] + then + title="Release for tag ${{ steps.set_tag.outputs.tag }} already exists for commit $commit!" + message="Cannot create a new release for commit ${{ inputs.sha }}. Exiting." + echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + exit 1 + fi + isDraft=$(jq -r '.isDraft' <<< "$output") + if [[ $isDraft == true ]] && [[ ${{ inputs.test_run }} == false ]] + then + title="Release tag ${{ steps.set_tag.outputs.tag }} already associated with the draft release." + message="Release workflow will publish the associated release." + echo "exists=false" >> $GITHUB_OUTPUT + echo "draft_exists=true" >> $GITHUB_OUTPUT + echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + exit 0 + fi + title="Release for tag ${{ steps.set_tag.outputs.tag }} already exists." + message="Skip GitHub Release Publishing." + echo "exists=true" >> $GITHUB_OUTPUT + echo "draft_exists=false" >> $GITHUB_OUTPUT + echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ env.REPO_LINK }} + + - name: "[DEBUG] Log Job Outputs" + run: | + echo exists: ${{ steps.release_check.outputs.exists }} + echo draft_exists: ${{ steps.release_check.outputs.draft_exists }} + echo tag: ${{ steps.set_tag.outputs.tag }} + + skip-github-release: + runs-on: ubuntu-latest + needs: [check-release-exists] + if: needs.check-release-exists.outputs.exists == 'true' + + steps: + - name: "Tag Exists, Skip GitHub Release Job" + run: | + echo title="A tag already exists for ${{ needs.check-release-exists.outputs.tag }} and commit." + echo message="Skipping GitHub release." + echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + + audit-release-different-commit: + runs-on: ubuntu-latest + needs: [check-release-exists] + if: needs.check-release-exists.outputs.exists == 'false' + + steps: + - name: "Check If Release Already Exists For Commit" + uses: cardinalby/git-get-release-action@1.2.4 + id: check_release_commit + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commitSha: ${{ inputs.sha }} + doNotFailIfNotFound: true # returns blank outputs when not found instead of error + searchLimit: 15 # Since we only care about recent releases, speed up the process + + - name: "[DEBUG] Print Release Details" + run: | + echo steps.check_release_commit.outputs.id: ${{ steps.check_release_commit.outputs.id }} + echo steps.check_release_commit.outputs.tag_name: ${{ steps.check_release_commit.outputs.tag_name }} + echo steps.check_release_commit.outputs.target_commitish: ${{ steps.check_release_commit.outputs.target_commitish }} + echo steps.check_release_commit.outputs.prerelease: ${{ steps.check_release_commit.outputs.prerelease }} + + # Since we already know a release for this tag does not exist, if we find anything it's for the wrong tag, exit + - name: "Check If The Tag Matches The Version Number" + if: steps.check_release_commit.outputs.id != '' + run: | + title="Tag ${{ steps.check_release_commit.outputs.tag_name }} already exists for this commit!" + message="Cannot create a new tag for ${{ needs.check-release-exists.outputs.tag }} for the same commit" + echo "::error title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + exit 1 + + publish-draft-release: + runs-on: ubuntu-latest + needs: [check-release-exists, audit-release-different-commit] + if: >- + needs.check-release-exists.outputs.draft_exists == 'true' && + inputs.test_run == false + + steps: + - name: "Publish Draft Release - ${{ needs.check-release-exists.outputs.tag }}" + run: | + gh release edit $TAG --draft=false --repo ${{ env.REPO_LINK }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ needs.check-release-exists.outputs.tag }} + + create-github-release: + runs-on: ubuntu-latest + needs: [check-release-exists, audit-release-different-commit] + if: needs.check-release-exists.outputs.draft_exists == 'false' + + steps: + - name: "Download Artifact ${{ inputs.version_number }}" + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.artifact_name }} + path: . + + - name: "[DEBUG] Display Structure Of All Downloaded Files" + run: ls -R + + - name: "Set Release Type" + id: release_type + run: | + if ${{ contains(inputs.version_number, 'rc') || contains(inputs.version_number, 'b') }} + then + echo Release will be set as pre-release + echo "prerelease=--prerelease" >> $GITHUB_OUTPUT + else + echo This is not a prerelease + fi + + - name: "Set As Draft Release" + id: draft + run: | + if [[ ${{ inputs.test_run }} == true ]] + then + echo Release will be published as draft + echo "draft=--draft" >> $GITHUB_OUTPUT + else + echo This is not a draft release + fi + + - name: "GitHub Release Workflow Annotation" + run: | + title="Release ${{ needs.check-release-exists.outputs.tag }}" + message="Configuration: ${{ steps.release_type.outputs.prerelease }} ${{ steps.draft.outputs.draft }}" + echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + + - name: "Create New GitHub Release - ${{ needs.check-release-exists.outputs.tag }}" + run: | + gh release create $TAG ./dist/* --title "$TITLE" --notes-file $RELEASE_NOTES --target $COMMIT $PRERELEASE $DRAFT --repo ${{ env.REPO_LINK }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ needs.check-release-exists.outputs.tag }} + TITLE: ${{ github.event.repository.name }} ${{ needs.check-release-exists.outputs.tag }} + RELEASE_NOTES: ${{ inputs.changelog_path }} + COMMIT: ${{ inputs.sha }} + PRERELEASE: ${{ steps.release_type.outputs.prerelease }} + DRAFT: ${{ steps.draft.outputs.draft }} \ No newline at end of file From 84e45eb3493a1f56f2971c98c86e4b85afcbd2d8 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:14:40 -0800 Subject: [PATCH 07/32] remove unnecessary extra artifact build/upload --- .github/actions/build-hatch/action.yml | 5 +++-- .github/workflows/release.yml | 12 +++--------- .github/workflows/release_prep_hatch.yml | 4 ++-- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/actions/build-hatch/action.yml b/.github/actions/build-hatch/action.yml index 9c635951..45facbcb 100644 --- a/.github/actions/build-hatch/action.yml +++ b/.github/actions/build-hatch/action.yml @@ -11,7 +11,7 @@ inputs: working-dir: description: Where to run commands from, supports namespace packaging default: "./" - artifacts-dir: + artifacts-name: description: Where to upload the artifacts default: "dist" @@ -32,5 +32,6 @@ runs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ${{ inputs.artifacts-dir}} + name: ${{ inputs.artifacts-name}} path: ${{ inputs.working-dir }}dist/ + retention-days: 3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 109df27f..3f437e6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -126,21 +126,15 @@ jobs: - name: Build `dbt-adapters` if: ${{ inputs.package == 'dbt-adapters' }} uses: ./.github/actions/build-hatch + with: + artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - name: Build `dbt-tests-adapter` if: ${{ inputs.package == 'dbt-tests-adapter' }} uses: ./.github/actions/build-hatch with: working-dir: "./dbt-tests-adapter/" - - - name: "Upload Build Artifact" - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - path: | - ${{ inputs.changelog_path }} - ./dist/ - retention-days: 3 + artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} github-release: name: GitHub Release diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index b3ade118..3b3d6d8c 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -344,13 +344,13 @@ jobs: - name: "Remove Trailing Whitespace Via Pre-commit" continue-on-error: true run: | - pre-commit run trailing-whitespace --files dbt_common/__about__.py CHANGELOG.md .changes/* + pre-commit run trailing-whitespace --files dbt/adapters/__about__.py CHANGELOG.md .changes/* git status # this step will fail on newline errors but also correct them - name: "Removing Extra Newlines Via Pre-commit" continue-on-error: true run: | - pre-commit run end-of-file-fixer --files dbt_common/__about__.py CHANGELOG.md .changes/* + pre-commit run end-of-file-fixer --files dbt/adapters/__about__.py CHANGELOG.md .changes/* git status - name: "Commit & Push Changes" run: | From 66cfcb4e03cc3b882941ef4eb14c0c1b2c327195 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:14:48 -0800 Subject: [PATCH 08/32] remove unnecessary extra artifact build/upload --- .pre-commit-config.yaml | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..3d80b955 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,63 @@ +# For more on configuring pre-commit hooks (see https://pre-commit.com/) + +# Force all unspecified python hooks to run python 3.8 +default_language_version: + python: python3 + +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + args: [--unsafe] + - id: check-json + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + additional_dependencies: ['click~=8.1'] + args: + - "--line-length=99" + - "--target-version=py38" + - id: black + alias: black-check + stages: [manual] + additional_dependencies: ['click~=8.1'] + args: + - "--line-length=99" + - "--target-version=py38" + - "--check" + - "--diff" +- repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + - id: flake8 + alias: flake8-check + stages: [manual] +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.1.1 + hooks: + - id: mypy + # N.B.: Mypy is... a bit fragile. + # + # By using `language: system` we run this hook in the local + # environment instead of a pre-commit isolated one. This is needed + # to ensure mypy correctly parses the project. + + # It may cause trouble in that it adds environmental variables out + # of our control to the mix. Unfortunately, there's nothing we can + # do about per pre-commit's author. + # See https://github.com/pre-commit/pre-commit/issues/730 for details. + args: [--show-error-codes, --ignore-missing-imports, --explicit-package-bases] + files: ^dbt/adapters/.* + language: system + - id: mypy + alias: mypy-check + stages: [manual] + args: [--show-error-codes, --pretty, --ignore-missing-imports, --explicit-package-bases] + files: ^dbt/adapters + language: system From f5aa78f48fb9b15f29fb3ff8b5aeb39eb772740e Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:29:53 -0800 Subject: [PATCH 09/32] remove duplicate build steps --- .github/workflows/release.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f437e6a..3928231c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,19 +110,6 @@ jobs: - name: Setup `hatch` uses: ./.github/actions/setup-hatch - - name: Build `dbt-adapters` - if: ${{ inputs.package == 'dbt-adapters' }} - uses: ./.github/actions/build-hatch - - - name: Build `dbt-tests-adapter` - if: ${{ inputs.package == 'dbt-tests-adapter' }} - uses: ./.github/actions/build-hatch - with: - working-dir: "./dbt-tests-adapter/" - - - name: Setup `hatch` - uses: ./.github/actions/setup-hatch - - name: Build `dbt-adapters` if: ${{ inputs.package == 'dbt-adapters' }} uses: ./.github/actions/build-hatch From 3a65535133a32239b97bcc442b9d80dde5ae3c2a Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:35:35 -0800 Subject: [PATCH 10/32] set download path in github-release.yml --- .github/workflows/github-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 6f8def12..30c6587a 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -202,11 +202,11 @@ jobs: if: needs.check-release-exists.outputs.draft_exists == 'false' steps: - - name: "Download Artifact ${{ inputs.version_number }}" + - name: "Download Artifact ${{ inputs.artifact_name }}" uses: actions/download-artifact@v3 with: name: ${{ inputs.artifact_name }} - path: . + path: ./dist/ - name: "[DEBUG] Display Structure Of All Downloaded Files" run: ls -R From 7e79d38a6685b7d07e9b216d0a20892baa732ffa Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:44:17 -0800 Subject: [PATCH 11/32] add resolve_commit_sha --- .github/workflows/release_prep_hatch.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index 3b3d6d8c..afa9bf07 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -511,6 +511,18 @@ jobs: - name: "[Debug] Log Branch" run: git status + - name: "Resolve Commit SHA For Release" + id: resolve_commit_sha + run: | + commit_sha="" + if [[ ${{ needs.audit-changelog.outputs.exists }} == false ]] || [[ ${{ needs.audit-version-in-code.outputs.up_to_date }} == false ]] + then + commit_sha=$(git rev-parse HEAD) + else + commit_sha=${{ inputs.sha }} + fi + echo "release_sha=$commit_sha" >> $GITHUB_OUTPUT + - name: "Remove Temp Branch - ${{ needs.create-temp-branch.outputs.branch_name }}" if: ${{ inputs.deploy_to == 'prod' && inputs.nightly_release == 'false' && needs.create-temp-branch.outputs.branch_name != '' }} run: | From a099c5c3d74f23e3e81d15f1e0f610f4c44310c2 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:52:14 -0800 Subject: [PATCH 12/32] always resolve commit sha --- .github/workflows/release_prep_hatch.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index afa9bf07..a67f58b0 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -514,14 +514,7 @@ jobs: - name: "Resolve Commit SHA For Release" id: resolve_commit_sha run: | - commit_sha="" - if [[ ${{ needs.audit-changelog.outputs.exists }} == false ]] || [[ ${{ needs.audit-version-in-code.outputs.up_to_date }} == false ]] - then - commit_sha=$(git rev-parse HEAD) - else - commit_sha=${{ inputs.sha }} - fi - echo "release_sha=$commit_sha" >> $GITHUB_OUTPUT + echo "release_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: "Remove Temp Branch - ${{ needs.create-temp-branch.outputs.branch_name }}" if: ${{ inputs.deploy_to == 'prod' && inputs.nightly_release == 'false' && needs.create-temp-branch.outputs.branch_name != '' }} From e1c1c5de0eb8278b7951f2429e0248fee4713fee Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 16:59:12 -0800 Subject: [PATCH 13/32] always resolve commit sha --- .github/workflows/release_prep_hatch.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index a67f58b0..e9e613bd 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -65,6 +65,9 @@ on: changelog_path: description: The path to the changelog for this version value: ${{ jobs.audit-changelog.outputs.changelog_path }} + final_sha: + description: The sha that will actually be released + value: ${{ jobs.determine-release-branch.outputs.final_sha }} secrets: FISHTOWN_BOT_PAT: description: "Token to commit/merge changes into branches" From 6ab541c8bdd3235fd4ad8c076ddc047cad93eb86 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 17:05:47 -0800 Subject: [PATCH 14/32] get sha and changelog path --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3928231c..25b59d44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,7 +127,7 @@ jobs: name: GitHub Release if: ${{ !failure() && !cancelled() }} - needs: [build-and-test] + needs: [build-and-test, log-outputs-bump-version-generate-changelog] uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion with: From d2965be6d9abb097cf0446f60835666e341eab72 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 19:13:28 -0800 Subject: [PATCH 15/32] fix formatting --- .github/workflows/release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25b59d44..0b155c50 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,7 +75,6 @@ jobs: bump-version-generate-changelog: name: Bump package version, Generate changelog uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@bumpVersion - with: version_number: ${{ inputs.version_number }} deploy_to: ${{ inputs.deploy-to }} @@ -124,12 +123,11 @@ jobs: artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} github-release: - name: GitHub Release + name: "GitHub Release" if: ${{ !failure() && !cancelled() }} needs: [build-and-test, log-outputs-bump-version-generate-changelog] uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion - with: version_number: ${{ inputs.version_number }} changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} @@ -138,7 +136,7 @@ jobs: artifact_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} pypi-release: - name: Publish to PyPI + name: "Publish to PyPI" runs-on: ubuntu-latest needs: [github-release] environment: From 67fae59664e558ca67a8047588b5316ae6aad6db Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 19:44:48 -0800 Subject: [PATCH 16/32] fix formatting --- .github/workflows/release.yml | 8 +++----- .github/workflows/release_prep_hatch.yml | 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b155c50..e924d77c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,16 +71,14 @@ defaults: shell: bash jobs: - bump-version-generate-changelog: - name: Bump package version, Generate changelog + name: "Bump package version, Generate changelog" uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@bumpVersion with: version_number: ${{ inputs.version_number }} deploy_to: ${{ inputs.deploy-to }} nightly_release: ${{ inputs.nightly_release }} target_branch: ${{ inputs.target_branch }} - secrets: inherit log-outputs-bump-version-generate-changelog: @@ -126,13 +124,13 @@ jobs: name: "GitHub Release" if: ${{ !failure() && !cancelled() }} - needs: [build-and-test, log-outputs-bump-version-generate-changelog] + needs: [build-and-test, bump-version-generate-changelog] uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion with: + sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} version_number: ${{ inputs.version_number }} changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} test_run: ${{ inputs.deploy-to == 'test' && true || false }} - sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} artifact_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} pypi-release: diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index e9e613bd..b23ded37 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -204,6 +204,7 @@ jobs: - name: "[DEBUG] Print Outputs" run: | echo up_to_date: ${{ steps.version-check.outputs.up_to_date }} + skip-generate-changelog: runs-on: ubuntu-latest needs: [audit-changelog] @@ -216,6 +217,7 @@ jobs: title="Skip changelog generation" message="A changelog file already exists at ${{ needs.audit-changelog.outputs.changelog_path }}, skipping generating changelog" echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + skip-version-bump: runs-on: ubuntu-latest needs: [audit-version-in-code] @@ -228,6 +230,7 @@ jobs: title="Skip version bump" message="The version has already been bumped to ${{ inputs.version_number }}, skipping version bump" echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message" + create-temp-branch: runs-on: ubuntu-latest needs: [audit-changelog, audit-version-in-code] From 4dee1a0db4700b2bf0ebfaac914dfc0e48a3ee30 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 22 Feb 2024 19:47:33 -0800 Subject: [PATCH 17/32] Revert "Bumping version to 0.1.0a7 and generate changelog" This reverts commit b3253ba8a9e30b5195accd040e10d8b494297d44. --- .changes/0.1.0-a7.md | 24 ------------------ .../Docs-20240109-131629.yaml | 0 .../Docs-20240109-131736.yaml | 0 .../Docs-20240109-131858.yaml | 0 .../Docs-20240109-131917.yaml | 0 .../Features-20240212-123544.yaml | 0 .../Fixes-20240215-141545.yaml | 0 .../Fixes-20240216-135420.yaml | 0 .../Under the Hood-20240109-131958.yaml | 0 .../Under the Hood-20240112-230236.yaml | 0 .../Under the Hood-20240123-121220.yaml | 0 .../Under the Hood-20240220-164223.yaml | 0 CHANGELOG.md | 25 +------------------ 13 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 .changes/0.1.0-a7.md rename .changes/{0.1.0 => unreleased}/Docs-20240109-131629.yaml (100%) rename .changes/{0.1.0 => unreleased}/Docs-20240109-131736.yaml (100%) rename .changes/{0.1.0 => unreleased}/Docs-20240109-131858.yaml (100%) rename .changes/{0.1.0 => unreleased}/Docs-20240109-131917.yaml (100%) rename .changes/{0.1.0 => unreleased}/Features-20240212-123544.yaml (100%) rename .changes/{0.1.0 => unreleased}/Fixes-20240215-141545.yaml (100%) rename .changes/{0.1.0 => unreleased}/Fixes-20240216-135420.yaml (100%) rename .changes/{0.1.0 => unreleased}/Under the Hood-20240109-131958.yaml (100%) rename .changes/{0.1.0 => unreleased}/Under the Hood-20240112-230236.yaml (100%) rename .changes/{0.1.0 => unreleased}/Under the Hood-20240123-121220.yaml (100%) rename .changes/{0.1.0 => unreleased}/Under the Hood-20240220-164223.yaml (100%) diff --git a/.changes/0.1.0-a7.md b/.changes/0.1.0-a7.md deleted file mode 100644 index 98d72993..00000000 --- a/.changes/0.1.0-a7.md +++ /dev/null @@ -1,24 +0,0 @@ -## dbt-adapter 0.1.0-a7 - February 22, 2024 - -### Features - -* Update RelationConfig to capture all fields used by adapters - -### Fixes - -* Ignore adapter-level support warnings for 'custom' constraints -* Make all adapter zone tests importable by removing "Test" prefix - -### Docs - -* Configure `changie` -* Setup ADR tracking framework -* Create issue templates -* Create PR template - -### Under the Hood - -* Configure `dependabot` -* Implement unit testing in CI -* Allow version to be specified in either __version__.py or __about__.py -* Remove __init__.py file from dbt.tests diff --git a/.changes/0.1.0/Docs-20240109-131629.yaml b/.changes/unreleased/Docs-20240109-131629.yaml similarity index 100% rename from .changes/0.1.0/Docs-20240109-131629.yaml rename to .changes/unreleased/Docs-20240109-131629.yaml diff --git a/.changes/0.1.0/Docs-20240109-131736.yaml b/.changes/unreleased/Docs-20240109-131736.yaml similarity index 100% rename from .changes/0.1.0/Docs-20240109-131736.yaml rename to .changes/unreleased/Docs-20240109-131736.yaml diff --git a/.changes/0.1.0/Docs-20240109-131858.yaml b/.changes/unreleased/Docs-20240109-131858.yaml similarity index 100% rename from .changes/0.1.0/Docs-20240109-131858.yaml rename to .changes/unreleased/Docs-20240109-131858.yaml diff --git a/.changes/0.1.0/Docs-20240109-131917.yaml b/.changes/unreleased/Docs-20240109-131917.yaml similarity index 100% rename from .changes/0.1.0/Docs-20240109-131917.yaml rename to .changes/unreleased/Docs-20240109-131917.yaml diff --git a/.changes/0.1.0/Features-20240212-123544.yaml b/.changes/unreleased/Features-20240212-123544.yaml similarity index 100% rename from .changes/0.1.0/Features-20240212-123544.yaml rename to .changes/unreleased/Features-20240212-123544.yaml diff --git a/.changes/0.1.0/Fixes-20240215-141545.yaml b/.changes/unreleased/Fixes-20240215-141545.yaml similarity index 100% rename from .changes/0.1.0/Fixes-20240215-141545.yaml rename to .changes/unreleased/Fixes-20240215-141545.yaml diff --git a/.changes/0.1.0/Fixes-20240216-135420.yaml b/.changes/unreleased/Fixes-20240216-135420.yaml similarity index 100% rename from .changes/0.1.0/Fixes-20240216-135420.yaml rename to .changes/unreleased/Fixes-20240216-135420.yaml diff --git a/.changes/0.1.0/Under the Hood-20240109-131958.yaml b/.changes/unreleased/Under the Hood-20240109-131958.yaml similarity index 100% rename from .changes/0.1.0/Under the Hood-20240109-131958.yaml rename to .changes/unreleased/Under the Hood-20240109-131958.yaml diff --git a/.changes/0.1.0/Under the Hood-20240112-230236.yaml b/.changes/unreleased/Under the Hood-20240112-230236.yaml similarity index 100% rename from .changes/0.1.0/Under the Hood-20240112-230236.yaml rename to .changes/unreleased/Under the Hood-20240112-230236.yaml diff --git a/.changes/0.1.0/Under the Hood-20240123-121220.yaml b/.changes/unreleased/Under the Hood-20240123-121220.yaml similarity index 100% rename from .changes/0.1.0/Under the Hood-20240123-121220.yaml rename to .changes/unreleased/Under the Hood-20240123-121220.yaml diff --git a/.changes/0.1.0/Under the Hood-20240220-164223.yaml b/.changes/unreleased/Under the Hood-20240220-164223.yaml similarity index 100% rename from .changes/0.1.0/Under the Hood-20240220-164223.yaml rename to .changes/unreleased/Under the Hood-20240220-164223.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 85ed1dfd..5ca9d33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,28 +5,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). -## dbt-adapter 0.1.0-a7 - February 22, 2024 - -### Features - -* Update RelationConfig to capture all fields used by adapters - -### Fixes - -* Ignore adapter-level support warnings for 'custom' constraints -* Make all adapter zone tests importable by removing "Test" prefix - -### Docs - -* Configure `changie` -* Setup ADR tracking framework -* Create issue templates -* Create PR template - -### Under the Hood - -* Configure `dependabot` -* Implement unit testing in CI -* Allow version to be specified in either __version__.py or __about__.py -* Remove __init__.py file from dbt.tests +No releases yet, this file will be updated when generating your first release. From 7b8a93dab6134d8ca6ad3c8b2918b866c3ebb36d Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 23 Feb 2024 09:50:11 -0800 Subject: [PATCH 18/32] add changelog to archive --- .github/actions/build-hatch/action.yml | 7 ++++++- .github/workflows/github-release.yml | 2 +- .github/workflows/release.yml | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-hatch/action.yml b/.github/actions/build-hatch/action.yml index 45facbcb..2ef368f3 100644 --- a/.github/actions/build-hatch/action.yml +++ b/.github/actions/build-hatch/action.yml @@ -14,6 +14,9 @@ inputs: artifacts-name: description: Where to upload the artifacts default: "dist" + changelog-path: + description: Path to changelog file + required: true runs: using: composite @@ -33,5 +36,7 @@ runs: uses: actions/upload-artifact@v3 with: name: ${{ inputs.artifacts-name}} - path: ${{ inputs.working-dir }}dist/ + path: | + ${{ inputs.changelog-path }} + ${{ inputs.working-dir }}dist/ retention-days: 3 diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 30c6587a..2faaf814 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -206,7 +206,7 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ inputs.artifact_name }} - path: ./dist/ + path: . - name: "[DEBUG] Display Structure Of All Downloaded Files" run: ls -R diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e924d77c..7c0c8c7e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -111,12 +111,14 @@ jobs: if: ${{ inputs.package == 'dbt-adapters' }} uses: ./.github/actions/build-hatch with: + changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - name: Build `dbt-tests-adapter` if: ${{ inputs.package == 'dbt-tests-adapter' }} uses: ./.github/actions/build-hatch with: + changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} working-dir: "./dbt-tests-adapter/" artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From 5d48702f795e05c563ea32168351bc4867cd8dfa Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 23 Feb 2024 09:58:02 -0800 Subject: [PATCH 19/32] add changelog to archive --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c0c8c7e..02522829 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,7 +94,7 @@ jobs: build-and-test: name: "Build and Test" - needs: [log-outputs-bump-version-generate-changelog] + needs: [log-outputs-bump-version-generate-changelog, bump-version-generate-changelog] runs-on: ubuntu-latest permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing From 030d67918c02033069e6922b9793b2354ddaf85b Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 10:38:53 -0800 Subject: [PATCH 20/32] specify action version --- .github/actions/build-hatch/action.yml | 2 +- .github/workflows/release.yml | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-hatch/action.yml b/.github/actions/build-hatch/action.yml index 2ef368f3..b4af4dd4 100644 --- a/.github/actions/build-hatch/action.yml +++ b/.github/actions/build-hatch/action.yml @@ -13,7 +13,7 @@ inputs: default: "./" artifacts-name: description: Where to upload the artifacts - default: "dist" + required: true changelog-path: description: Path to changelog file required: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02522829..c4c6bcea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,19 +104,19 @@ jobs: with: ref: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} - - name: Setup `hatch` - uses: ./.github/actions/setup-hatch + - name: "Setup `hatch`" + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch - - name: Build `dbt-adapters` + - name: "Build `dbt-adapters`" if: ${{ inputs.package == 'dbt-adapters' }} - uses: ./.github/actions/build-hatch + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@bumpVersion with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - - name: Build `dbt-tests-adapter` + - name: "Build `dbt-tests-adapter`" if: ${{ inputs.package == 'dbt-tests-adapter' }} - uses: ./.github/actions/build-hatch + uses: ./.github/actions/build-hatch@bumpVersion with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} working-dir: "./dbt-tests-adapter/" @@ -125,7 +125,6 @@ jobs: github-release: name: "GitHub Release" if: ${{ !failure() && !cancelled() }} - needs: [build-and-test, bump-version-generate-changelog] uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion with: From 59520dbc38fe480d47d7b530e5349e4a01567986 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 12:50:11 -0800 Subject: [PATCH 21/32] specify action version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4c6bcea..633d7368 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,7 +116,7 @@ jobs: - name: "Build `dbt-tests-adapter`" if: ${{ inputs.package == 'dbt-tests-adapter' }} - uses: ./.github/actions/build-hatch@bumpVersion + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@bumpVersion with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} working-dir: "./dbt-tests-adapter/" From 29cf930095ffd7ab846ba1acda5bab46feac72ce Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 13:08:37 -0800 Subject: [PATCH 22/32] specify action version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 633d7368..c02e0165 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,7 +105,7 @@ jobs: ref: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} - name: "Setup `hatch`" - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@bumpVersion - name: "Build `dbt-adapters`" if: ${{ inputs.package == 'dbt-adapters' }} From 04dde042ccb5759128bae2b7eec3fb3bccfcd84f Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 13:22:47 -0800 Subject: [PATCH 23/32] have gha release use sha --- .github/workflows/github-release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 2faaf814..278b3f03 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -202,6 +202,11 @@ jobs: if: needs.check-release-exists.outputs.draft_exists == 'false' steps: + - name: "Check out repository" + uses: actions/checkout@v4 + with: + ref: ${{ inputs.sha }} + - name: "Download Artifact ${{ inputs.artifact_name }}" uses: actions/download-artifact@v3 with: From d1fd19d557bf287e061aacb468cb49ae87f64516 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 13:32:13 -0800 Subject: [PATCH 24/32] log expected files in workflow --- .github/workflows/github-release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 278b3f03..2dacf4e0 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -213,8 +213,10 @@ jobs: name: ${{ inputs.artifact_name }} path: . - - name: "[DEBUG] Display Structure Of All Downloaded Files" - run: ls -R + - name: "[DEBUG] Display Structure Of Expected Files" + run: | + ls -R .changes + ls -l dist - name: "Set Release Type" id: release_type From ebc693c7cc4c5e24de0b25d5bbd06e30cb9228e4 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 13:53:43 -0800 Subject: [PATCH 25/32] fix deploy_to logic --- .github/workflows/release_prep_hatch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index b23ded37..38c399d9 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -440,7 +440,7 @@ jobs: needs: [run-unit-tests, run-integration-tests, create-temp-branch, audit-version-in-code, audit-changelog] if: | !failure() && !cancelled() && - inputs.deploy_to == 'test' && + inputs.deploy_to == 'prod' && ( needs.audit-changelog.outputs.exists == 'false' || needs.audit-version-in-code.outputs.up_to_date == 'false' From 08e416f2a9ffcad5b97c05b3ed7991f02360da7e Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 14:52:42 -0800 Subject: [PATCH 26/32] add pypi checkout --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c02e0165..d72d1bd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -142,6 +142,9 @@ jobs: name: ${{ inputs.deploy-to }} url: ${{ vars.PYPI_PROJECT_URL }} steps: + - name: "Check out repository" + uses: actions/checkout@v4 + - name: "Publish to PyPI" uses: ./.github/actions/publish-pypi with: From 9257252bdc63fd9978bd0cb93f2be29b13dab3fe Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 26 Feb 2024 16:30:44 -0800 Subject: [PATCH 27/32] fix pypi input name --- .github/actions/publish-pypi/action.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/publish-pypi/action.yml b/.github/actions/publish-pypi/action.yml index c97beceb..fe3cafd3 100644 --- a/.github/actions/publish-pypi/action.yml +++ b/.github/actions/publish-pypi/action.yml @@ -2,7 +2,7 @@ name: Publish - PyPI description: Publish artifacts saved during build step to PyPI inputs: - artifacts-dir-name: + artifacts-dir: description: Where to download the artifacts from required: true repository-url: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d72d1bd1..9264d04d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -146,7 +146,7 @@ jobs: uses: actions/checkout@v4 - name: "Publish to PyPI" - uses: ./.github/actions/publish-pypi + uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@bumpVersion with: repository-url: ${{ vars.PYPI_REPOSITORY_URL }} artifacts-dir: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From 6942e2d16893da5c58f147de007d90d304a44fd7 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 27 Feb 2024 10:23:56 -0800 Subject: [PATCH 28/32] add id-token permission --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9264d04d..5cf51d0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,7 @@ on: # this is the permission that allows creating a new release permissions: contents: write + id-token: write # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: From 19c00880e355f3e96644fdd80a478f33899dcab2 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 27 Feb 2024 10:45:57 -0800 Subject: [PATCH 29/32] standardize on artifacts-name --- .github/actions/publish-pypi/action.yml | 4 ++-- .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/publish-pypi/action.yml b/.github/actions/publish-pypi/action.yml index fe3cafd3..cfbff0db 100644 --- a/.github/actions/publish-pypi/action.yml +++ b/.github/actions/publish-pypi/action.yml @@ -2,7 +2,7 @@ name: Publish - PyPI description: Publish artifacts saved during build step to PyPI inputs: - artifacts-dir: + artifacts-name: description: Where to download the artifacts from required: true repository-url: @@ -16,7 +16,7 @@ runs: - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ inputs.artifacts-dir }} + name: ${{ inputs.artifacts-name }} path: . - name: Publish artifacts to PyPI diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5cf51d0e..9e7906bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -150,6 +150,6 @@ jobs: uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@bumpVersion with: repository-url: ${{ vars.PYPI_REPOSITORY_URL }} - artifacts-dir: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From edcdb2ec2272434fb7f5dbe98fc35baf4bfb60aa Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 27 Feb 2024 14:36:34 -0800 Subject: [PATCH 30/32] change to archive name --- .github/actions/build-hatch/action.yml | 4 ++-- .github/actions/publish-pypi/action.yml | 4 ++-- .github/workflows/github-release.yml | 6 +++--- .github/workflows/release.yml | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/build-hatch/action.yml b/.github/actions/build-hatch/action.yml index b4af4dd4..764dc9dc 100644 --- a/.github/actions/build-hatch/action.yml +++ b/.github/actions/build-hatch/action.yml @@ -11,7 +11,7 @@ inputs: working-dir: description: Where to run commands from, supports namespace packaging default: "./" - artifacts-name: + archive-name: description: Where to upload the artifacts required: true changelog-path: @@ -35,7 +35,7 @@ runs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ${{ inputs.artifacts-name}} + name: ${{ inputs.archive-name}} path: | ${{ inputs.changelog-path }} ${{ inputs.working-dir }}dist/ diff --git a/.github/actions/publish-pypi/action.yml b/.github/actions/publish-pypi/action.yml index cfbff0db..c1346823 100644 --- a/.github/actions/publish-pypi/action.yml +++ b/.github/actions/publish-pypi/action.yml @@ -2,7 +2,7 @@ name: Publish - PyPI description: Publish artifacts saved during build step to PyPI inputs: - artifacts-name: + archive-name: description: Where to download the artifacts from required: true repository-url: @@ -16,7 +16,7 @@ runs: - name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ inputs.artifacts-name }} + name: ${{ inputs.archive-name }} path: . - name: Publish artifacts to PyPI diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 2dacf4e0..3d5f6f07 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -43,7 +43,7 @@ on: description: Test run (Publish release as draft) required: true type: boolean - artifact_name: + archive_name: description: artifact name to download required: true type: string @@ -207,10 +207,10 @@ jobs: with: ref: ${{ inputs.sha }} - - name: "Download Artifact ${{ inputs.artifact_name }}" + - name: "Download Artifact ${{ inputs.archive_name }}" uses: actions/download-artifact@v3 with: - name: ${{ inputs.artifact_name }} + name: ${{ inputs.archive_name }} path: . - name: "[DEBUG] Display Structure Of Expected Files" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e7906bc..7e83b43f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -113,7 +113,7 @@ jobs: uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@bumpVersion with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} - artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - name: "Build `dbt-tests-adapter`" if: ${{ inputs.package == 'dbt-tests-adapter' }} @@ -121,7 +121,7 @@ jobs: with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} working-dir: "./dbt-tests-adapter/" - artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} github-release: name: "GitHub Release" @@ -133,7 +133,7 @@ jobs: version_number: ${{ inputs.version_number }} changelog_path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} test_run: ${{ inputs.deploy-to == 'test' && true || false }} - artifact_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + archive_name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} pypi-release: name: "Publish to PyPI" @@ -150,6 +150,6 @@ jobs: uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@bumpVersion with: repository-url: ${{ vars.PYPI_REPOSITORY_URL }} - artifacts-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} + archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From 3ca7622e5b08b3387558d364050dc84bf03a609d Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 27 Feb 2024 15:06:43 -0800 Subject: [PATCH 31/32] update dev branch refs to main --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e83b43f..f650309a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,7 @@ defaults: jobs: bump-version-generate-changelog: name: "Bump package version, Generate changelog" - uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@bumpVersion + uses: dbt-labs/dbt-adapters/.github/workflows/release_prep_hatch.yml@main with: version_number: ${{ inputs.version_number }} deploy_to: ${{ inputs.deploy-to }} @@ -106,18 +106,18 @@ jobs: ref: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} - name: "Setup `hatch`" - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@bumpVersion + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main - name: "Build `dbt-adapters`" if: ${{ inputs.package == 'dbt-adapters' }} - uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@bumpVersion + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@main with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} - name: "Build `dbt-tests-adapter`" if: ${{ inputs.package == 'dbt-tests-adapter' }} - uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@bumpVersion + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@main with: changelog-path: ${{ needs.bump-version-generate-changelog.outputs.changelog_path }} working-dir: "./dbt-tests-adapter/" @@ -127,7 +127,7 @@ jobs: name: "GitHub Release" if: ${{ !failure() && !cancelled() }} needs: [build-and-test, bump-version-generate-changelog] - uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@bumpVersion + uses: dbt-labs/dbt-adapters/.github/workflows/github-release.yml@main with: sha: ${{ needs.bump-version-generate-changelog.outputs.final_sha }} version_number: ${{ inputs.version_number }} @@ -147,7 +147,7 @@ jobs: uses: actions/checkout@v4 - name: "Publish to PyPI" - uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@bumpVersion + uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@main with: repository-url: ${{ vars.PYPI_REPOSITORY_URL }} archive-name: ${{ inputs.version_number }}-${{ inputs.package }}-${{ inputs.deploy-to }} From 6adf31cc9d6a53705679cc9d68834fbb13983818 Mon Sep 17 00:00:00 2001 From: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:07:16 -0800 Subject: [PATCH 32/32] Update .github/workflows/github-release.yml Co-authored-by: Emily Rockman --- .github/workflows/github-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 3d5f6f07..edd25172 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -1,5 +1,5 @@ # **what?** -# Create a new release on GitHub and include any artifacts in the `/dist` directory of the GitHUb artifacts store. +# Create a new release on GitHub and include any artifacts in the `/dist` directory of the GitHub artifacts store. # # Inputs: # sha: The commit to attach to this release