Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update release workflow #732

Merged
merged 83 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
9096a2e
update release workflow to use trusted publishers, to publish to test…
mikealfare Oct 1, 2024
3158dd0
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
7e9679f
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
4e8086b
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
9699452
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
c109d83
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
36c6266
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
0d173ff
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
aa9a996
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
78dda89
update workflow to allow for first publish on test pypi
mikealfare Oct 1, 2024
920772e
revert integration test matrix on python versions
mikealfare Oct 1, 2024
198eb14
remove pr trigger
mikealfare Oct 1, 2024
b5a3e31
remove conditional, add url to run name
mikealfare Oct 1, 2024
34dead9
update setup-python to v5, revert testing settings
mikealfare Oct 2, 2024
27d815b
create dbt-athena-community legacy package
mikealfare Oct 4, 2024
396d4a4
get precommit working
mikealfare Oct 8, 2024
a5982b4
update release to use hatch
mikealfare Oct 8, 2024
b16d966
update integration tests to use hatch
mikealfare Oct 8, 2024
e2793ff
update integration tests to use hatch
mikealfare Oct 8, 2024
f120366
update ci to allow dispatch runs
mikealfare Oct 8, 2024
ad28b37
fix version file path
mikealfare Oct 8, 2024
91a2d79
remove pre-commit check which is no longer relevant
mikealfare Oct 8, 2024
7d8f219
add src namespace to build targets
mikealfare Oct 8, 2024
09a341e
add src namespace to build targets
mikealfare Oct 8, 2024
4df1c0b
move boto3 stubs back as a build dependency
mikealfare Oct 8, 2024
6033045
move boto3 stubs back as a build dependency
mikealfare Oct 8, 2024
67a11fa
update plugin name
mikealfare Oct 8, 2024
b74e2ce
keep the workflow named the same for branch protection rules
mikealfare Oct 9, 2024
ce58c26
create shell package for athena-community
mikealfare Oct 9, 2024
a5061a4
remove duplicate init
mikealfare Oct 9, 2024
2b0f47f
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
df936a2
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
8437d6c
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
7fe461a
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
0f5301f
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
1b4b7ea
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
e9e6b63
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
7cf4451
remove formatting diffs for a more readable PR
mikealfare Oct 9, 2024
9dbc874
update release workflows to work with both packages
mikealfare Oct 9, 2024
7ccfb8e
update release workflows to work with both packages
mikealfare Oct 9, 2024
36ef964
update release workflows to work with both packages
mikealfare Oct 9, 2024
7ec3045
update release workflows to work with both packages
mikealfare Oct 9, 2024
9acf150
update release workflows to work with both packages
mikealfare Oct 9, 2024
993cca1
update release workflows to work with both packages
mikealfare Oct 9, 2024
812b6ce
update docs
mikealfare Oct 10, 2024
c9cc59d
update docs
mikealfare Oct 10, 2024
56d012e
remove defaulted values, keep necessary overrides
mikealfare Oct 10, 2024
2a327ec
add init file for unit tests
mikealfare Oct 10, 2024
cbf29f6
simplify the shell package for dbt-athena-community
mikealfare Oct 10, 2024
1f62c81
fix concurrency group for integration tests
mikealfare Oct 10, 2024
c5e1edd
fix functional tests workflow to work correctly with the concurrency …
mikealfare Oct 10, 2024
4c165d0
revert the name of the release workflow to test it on the feature branch
mikealfare Oct 10, 2024
f2c1eac
match formatting in other workflows
mikealfare Oct 10, 2024
dc0f097
standardize workflows
mikealfare Oct 10, 2024
961cdaf
standardize workflows
mikealfare Oct 10, 2024
99305ba
standardize workflows
mikealfare Oct 10, 2024
18e42dd
don't use the hatch install action, install manually
mikealfare Oct 10, 2024
f6b05f7
fix working dir
mikealfare Oct 10, 2024
2f55224
fix working dir
mikealfare Oct 10, 2024
3e5cad2
unit test config
mikealfare Oct 10, 2024
b625ec9
pass secrets to reusable workflow
mikealfare Oct 10, 2024
5347471
fixing permissions
mikealfare Oct 10, 2024
a85b1b3
fixing permissions
mikealfare Oct 10, 2024
6c85db5
fixing permissions
mikealfare Oct 10, 2024
e9dd6b4
account for non-parallel-izable integration test runs
mikealfare Oct 10, 2024
1120af5
allow for test to install packages from test PyPI first
mikealfare Oct 11, 2024
cc84f2c
update default values to ensure I don't publish to prod while testing…
mikealfare Oct 11, 2024
8c8df76
add push event to run the publish workflow once to register it in GH
mikealfare Oct 11, 2024
8476d7c
revert: add push event to run the publish workflow once to register i…
mikealfare Oct 11, 2024
1ab969a
revert default overrides, instead update the prod pypi url to be broken
mikealfare Oct 11, 2024
d32fc1d
fix permissions
mikealfare Oct 11, 2024
fba9c25
update dependencies for testing publishing
mikealfare Oct 11, 2024
0021714
update dependencies for testing publishing
mikealfare Oct 11, 2024
7f60b75
check that dbt-athena is published before building dbt-athena-community
mikealfare Oct 11, 2024
9f8a673
check that dbt-athena is published before building dbt-athena-community
mikealfare Oct 11, 2024
0958509
bump the version for testing
mikealfare Oct 11, 2024
2df2fb5
skip tests for now to test publishing
mikealfare Oct 11, 2024
8d9aa76
use GITHUB_OUTPUT instead of GITHUB_ENV
mikealfare Oct 11, 2024
bbd53ad
add testing back into publishing and bump to rc
mikealfare Oct 11, 2024
0b777a4
remove indirect refs req
mikealfare Oct 12, 2024
45dfbb0
drop support for python 3.8
mikealfare Oct 17, 2024
65c0df7
remove merge checks, they aren't needed with the new pr checks
mikealfare Oct 17, 2024
1b76f0f
remove label requirement for integration tests, they should always run
mikealfare Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions .github/workflows/ci.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Code quality"

on:
workflow_call:
inputs:
branch:
description: "Choose the branch to check"
type: string
default: "main"
repository:
description: "Choose the repository to check, when using a fork"
type: string
default: "dbt-labs/dbt-athena"
workflow_dispatch:
inputs:
branch:
description: "Choose the branch to check"
type: string
default: "main"
repository:
description: "Choose the repository to check, when using a fork"
type: string
default: "dbt-labs/dbt-athena"

permissions:
contents: read

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
- uses: pre-commit/[email protected]
54 changes: 0 additions & 54 deletions .github/workflows/functional-tests-workflow.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/functional-tests.yml

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "Integration tests"

on:
workflow_call:
inputs:
package:
description: "Choose the package to test"
type: string
default: "dbt-athena"
branch:
description: "Choose the branch to test"
type: string
default: "main"
repository:
description: "Choose the repository to test, when using a fork"
type: string
default: "dbt-labs/dbt-athena"
workflow_dispatch:
inputs:
package:
description: "Choose the package to test"
type: choice
options: ["dbt-athena", "dbt-athena-community"]
branch:
description: "Choose the branch to test"
type: string
default: "main"
repository:
description: "Choose the repository to test, when using a fork"
type: string
default: "dbt-labs/dbt-athena"

permissions:
id-token: write
contents: read

jobs:
integration-tests:
runs-on: ubuntu-latest
env:
DBT_TEST_ATHENA_S3_STAGING_DIR: ${{ vars.DBT_TEST_ATHENA_S3_BUCKET }}/staging/
DBT_TEST_ATHENA_S3_TMP_TABLE_DIR: ${{ vars.DBT_TEST_ATHENA_S3_BUCKET }}/tmp_tables/
DBT_TEST_ATHENA_REGION_NAME: ${{ vars.DBT_TEST_ATHENA_REGION_NAME }}
DBT_TEST_ATHENA_DATABASE: awsdatacatalog
DBT_TEST_ATHENA_SCHEMA: dbt-tests
DBT_TEST_ATHENA_WORK_GROUP: athena-dbt-tests
DBT_TEST_ATHENA_THREADS: 16
DBT_TEST_ATHENA_POLL_INTERVAL: 0.5
DBT_TEST_ATHENA_NUM_RETRIES: 3
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
- uses: pypa/hatch@install
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.ASSUMABLE_ROLE_NAME }}
aws-region: ${{ vars.DBT_TEST_ATHENA_REGION_NAME }}
- run: hatch run integration-tests
working-directory: ./${{ inputs.package }}
26 changes: 26 additions & 0 deletions .github/workflows/merge-checks.yml
mikealfare marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Merge checks"

on:
push:
branches: "main"

# only run this once per branch at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
integration-tests-dbt-athena:
uses: ./.github/workflows/integration-tests.yml
with:
branch: ${{ github.ref }}
secrets: inherit

# integration test runs can't run in parallel for now, so run them in serial
integration-tests-dbt-athena-community:
needs: integration-tests-dbt-athena
uses: ./.github/workflows/integration-tests.yml
with:
package: "dbt-athena-community"
branch: ${{ github.ref }}
secrets: inherit
71 changes: 71 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "Publish to PyPI"

on:
workflow_call:
inputs:
package:
description: "Choose the package to publish"
type: string
default: "dbt-athena"
deploy-to:
description: "Choose whether to publish to test or prod"
type: string
default: "prod"
branch:
description: "Choose the branch to publish"
type: string
default: "main"

permissions:
contents: read

defaults:
run:
shell: bash

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.deploy-to }}
url: ${{ vars.PYPI_PROJECT_URL }}/${{ inputs.package }}
permissions:
# this permission is required for trusted publishing
# see https://github.com/marketplace/actions/pypi-publish
id-token: write
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
# hatch will build using test PyPI first and fall back to prod PyPI when deploying to test
# this is done via environment variables in the test environment in GitHub
- run: hatch build && hatch run build:check-all
working-directory: ./${{ inputs.package }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: ${{ vars.PYPI_REPOSITORY_URL }}
packages-dir: ${{ inputs.package }}/dist/

verify:
runs-on: ubuntu-latest
needs: publish
# check the correct index
environment:
name: ${{ inputs.deploy-to }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- id: version
run: echo "version=$(hatch version)" >> $GITHUB_OUTPUT
working-directory: ./${{ inputs.package }}
- uses: nick-fields/retry@v3
with:
timeout_seconds: 10
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 }}
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Publish"

on:
workflow_dispatch:
inputs:
deploy-to:
description: "Choose whether to deploy to test or prod"
type: environment
default: "prod"
branch:
description: "Choose the branch to release from"
type: string
default: "main"

# don't attempt to release the same target in parallel
concurrency:
group: ${{ github.workflow }}-${{ inputs.deploy-to }}
cancel-in-progress: true

jobs:
unit-tests:
uses: ./.github/workflows/unit-tests.yml
with:
branch: ${{ inputs.branch }}

integration-tests:
uses: ./.github/workflows/integration-tests.yml
with:
branch: ${{ inputs.branch }}
repository: ${{ github.repository }}
secrets: inherit

publish-dbt-athena:
needs: [unit-tests, integration-tests]
uses: ./.github/workflows/publish-pypi.yml
with:
deploy-to: ${{ inputs.deploy-to }}
branch: ${{ inputs.branch }}

publish-dbt-athena-community:
# dbt-athena-community is hard pinned to dbt-athena to ensure they are the same
# this means we need to finish publishing dbt-athena before starting to build dbt-athena-community
needs: publish-dbt-athena
uses: ./.github/workflows/publish-pypi.yml
with:
package: "dbt-athena-community"
deploy-to: ${{ inputs.deploy-to }}
branch: ${{ inputs.branch }}
Loading
Loading