Skip to content

Commit 5a7ccab

Browse files
committed
Merge remote-tracking branch 'origin/setup-hatch' into setup-hatch
# Conflicts: # .github/workflows/backport.yml # .github/workflows/bot-changelog.yml # .github/workflows/cut-release-branch.yml # .github/workflows/docs-issues.yml # .github/workflows/release.yml # .github/workflows/scheduled-test-releases.yml # .github/workflows/triage-labels.yml
2 parents 2944b5e + 2ab9ff5 commit 5a7ccab

File tree

8 files changed

+552
-0
lines changed

8 files changed

+552
-0
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# **what?**
2+
# Verifies python build on all code commited to the repository. This workflow
3+
# should not require any secrets since it runs for PRs from forked repos. By
4+
# default, secrets are not passed to workflows running from a forked repos.
5+
6+
# **why?**
7+
# Ensure code for dbt meets a certain quality standard.
8+
9+
# **when?**
10+
# This will run for all PRs, when code is pushed to main, and when manually triggered.
11+
name: "Build release"
12+
13+
on:
14+
workflow_call:
15+
inputs:
16+
branch:
17+
description: "The branch/tag to run integration tests on"
18+
type: string
19+
default: "main"
20+
archive-name:
21+
description: "The name to use for the upload archive, leave blank for no upload"
22+
type: string
23+
default: ""
24+
workflow_dispatch:
25+
inputs:
26+
branch:
27+
description: "The branch/tag to run integration tests on"
28+
type: string
29+
default: "main"
30+
archive-name:
31+
description: "The name to use for the upload archive, leave blank for no upload"
32+
type: string
33+
default: ""
34+
35+
permissions: read-all
36+
37+
concurrency:
38+
group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.archive-name }}"
39+
cancel-in-progress: true
40+
41+
jobs:
42+
build:
43+
name: "Build a release"
44+
runs-on: ubuntu-latest
45+
permissions:
46+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
47+
steps:
48+
- name: "Check out ${{ github.repository }}@${{ inputs.branch }}"
49+
uses: actions/checkout@v4
50+
with:
51+
ref: ${{ inputs.branch }}
52+
53+
- name: "Setup environment"
54+
uses: dbt-labs/dbt-adapters/.github/actions/setup-environment@update-workflows
55+
with:
56+
python-version: ${{ vars.DBT_TEST_PYTHON_VERSION }}
57+
58+
- name: "Build ${{ github.event.repository.name }}"
59+
uses: dbt-labs/dbt-adapters/.github/actions/build-artifacts@update-workflows
60+
with:
61+
archive-name: ${{ inputs.archive-name }}

.github/workflows/changelog-check.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# **what?**
2+
# Checks that a file has been committed under the /.changes directory
3+
# as a new CHANGELOG entry. Cannot check for a specific filename as
4+
# it is dynamically generated by change type and timestamp.
5+
# This workflow should not require any secrets since it runs for PRs
6+
# from forked repos.
7+
# By default, secrets are not passed to workflows running from
8+
# a forked repo.
9+
#
10+
# **why?**
11+
# Ensure code changes are reflected in the CHANGELOG.
12+
#
13+
# **when?**
14+
# This will run for all PRs going into main and *.latest. It will run when:
15+
# - the PR is opened or reopened
16+
# - labels are updated on the PR
17+
# - new code is pushed to the branch
18+
# The action will get skipped if the 'Skip Changelog' label is present.
19+
name: Check Changelog Entry
20+
21+
on:
22+
pull_request:
23+
types:
24+
- opened
25+
- reopened
26+
- labeled
27+
- unlabeled
28+
- synchronize
29+
workflow_dispatch:
30+
31+
defaults:
32+
run:
33+
shell: bash
34+
35+
permissions:
36+
contents: read
37+
pull-requests: write
38+
39+
jobs:
40+
changelog:
41+
uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main
42+
with:
43+
changelog_comment: "Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the [dbt-redshift contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md)."
44+
skip_label: "Skip Changelog"
45+
# this is only acceptable because we own the action we're calling
46+
secrets: inherit

.github/workflows/clean-repo.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# **what?**
2+
# Cleanup branches left over from automation and testing.
3+
# Also cleanup draft releases from release testing.
4+
#
5+
# **why?**
6+
# The automations are leaving behind branches and releases that clutter the repository.
7+
# Sometimes we need them to debug processes so we don't want them immediately deleted.
8+
# Running on Saturday to avoid running at the same time as an actual release
9+
# to prevent breaking a release mid-release.
10+
#
11+
# **when?**
12+
# - every Saturday at noon UTC
13+
# - manually
14+
name: "Clean repo"
15+
16+
on:
17+
schedule:
18+
- cron: '0 12 * * SAT' # noon UTC on Saturday - details in `why` above
19+
workflow_dispatch:
20+
21+
permissions:
22+
contents: write
23+
24+
jobs:
25+
cleanup-repo:
26+
uses: dbt-labs/actions/.github/workflows/repository-cleanup.yml@main
27+
secrets: inherit

.github/workflows/code-quality.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# **what?**
2+
# Run code quality checks, e.g. `black`, `flake8`, `mypy`, via `pre-commit`
3+
#
4+
# **why?**
5+
# Ensure code quality meets dbt Labs standards
6+
#
7+
# **when?**
8+
# - runs on all PRs into protected branches
9+
# - runs indirectly during releases and release tests
10+
# - can be manually run
11+
name: "Code quality"
12+
13+
on:
14+
pull_request:
15+
push:
16+
branches:
17+
- "main"
18+
- "*.latest"
19+
workflow_call:
20+
inputs:
21+
branch:
22+
description: "The branch/tag to run code quality on"
23+
type: string
24+
default: "main"
25+
dbt-adapters-branch:
26+
description: "The branch/tag of `dbt-adapters` to use"
27+
type: string
28+
default: "main"
29+
dbt-common-branch:
30+
description: "The branch/tag of `dbt-common` to use"
31+
type: string
32+
default: "main"
33+
workflow_dispatch:
34+
inputs:
35+
branch:
36+
description: "The branch/tag to run code quality on"
37+
type: string
38+
default: "main"
39+
dbt-adapters-branch:
40+
description: "The branch/tag of `dbt-adapters` to use"
41+
type: string
42+
default: "main"
43+
dbt-common-branch:
44+
description: "The branch/tag of `dbt-common` to use"
45+
type: string
46+
default: "main"
47+
48+
permissions: read-all
49+
50+
concurrency:
51+
group: "${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}"
52+
cancel-in-progress: true
53+
54+
jobs:
55+
code-quality:
56+
name: "Code quality"
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: "Check out ${{ github.repository }}@${{ inputs.branch }} (non-PR)"
60+
if: github.event_name != 'pull_request_target'
61+
uses: actions/checkout@v4
62+
with:
63+
ref: ${{ inputs.branch }}
64+
persist-credentials: false
65+
66+
- name: "Check out ${{ github.repository }}@${{ inputs.branch }} (PR)"
67+
if: github.event_name == 'pull_request_target'
68+
uses: actions/checkout@v4
69+
with:
70+
ref: ${{ github.event.pull_request.head.sha }}
71+
72+
- name: "Setup environment"
73+
uses: dbt-labs/dbt-adapters/.github/actions/setup-environment@update-workflows
74+
with:
75+
python-version: ${{ vars.DBT_TEST_PYTHON_VERSION }}
76+
77+
- name: "Update development branches"
78+
if: ${{ contains(github.event_name, 'workflow_') }}
79+
uses: ./.github/actions/update-dev-branches
80+
with:
81+
dbt-adapters-branch: ${{ inputs.dbt-adapters-branch }}
82+
dbt-common-branch: ${{ inputs.dbt-common-branch }}
83+
84+
- name: "Run code quality"
85+
shell: bash
86+
run: hatch run code-quality
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: "Integration tests"
2+
3+
on:
4+
pull_request_target:
5+
push:
6+
branches:
7+
- "main"
8+
- "*.latest"
9+
workflow_call:
10+
inputs:
11+
branch:
12+
description: "The branch/tag to run integration tests on"
13+
type: string
14+
default: "main"
15+
dbt-adapters-branch:
16+
description: "The branch/tag of `dbt-adapters` to use"
17+
type: string
18+
default: "main"
19+
dbt-common-branch:
20+
description: "The branch/tag of `dbt-common` to use"
21+
type: string
22+
default: "main"
23+
dbt-core-branch:
24+
description: "The branch/tag of `dbt-core` to use"
25+
type: string
26+
default: "main"
27+
workflow_dispatch:
28+
inputs:
29+
branch:
30+
description: "The branch/tag to run integration tests on"
31+
type: string
32+
default: "main"
33+
dbt-adapters-branch:
34+
description: "The branch/tag of `dbt-adapters` to use"
35+
type: string
36+
default: "main"
37+
dbt-common-branch:
38+
description: "The branch/tag of `dbt-common` to use"
39+
type: string
40+
default: "main"
41+
dbt-core-branch:
42+
description: "The branch/tag of `dbt-core` to use"
43+
type: string
44+
default: "main"
45+
46+
permissions: read-all
47+
48+
concurrency:
49+
group: "${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}"
50+
cancel-in-progress: true
51+
52+
jobs:
53+
require-approval-on-forks:
54+
# if it's a pull request from a fork that has not been approved yet, don't run tests
55+
if: >-
56+
github.event_name == 'pull_request_target' &&
57+
github.event.pull_request.head.repo.full_name != github.repository &&
58+
!contains(github.event.pull_request.labels.*.name, 'ok to test')
59+
runs-on: ubuntu-latest
60+
permissions:
61+
pull-requests: write
62+
steps:
63+
- name: "Author requires permission to run tests"
64+
uses: unsplash/comment-on-pr@master
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
msg: |
69+
"Thanks for your contribution! "\
70+
"Since this is a fork, integration tests need to be approved prior to running. "\
71+
"@dbt-labs/core will review this PR and approve running integration tests."
72+
check_for_duplicate_msg: true
73+
74+
integration-tests:
75+
name: "Integration tests"
76+
needs: require-approval-on-forks
77+
runs-on: ubuntu-latest
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
os: [ubuntu-latest]
82+
python-version: ${{ fromJSON(vars.DBT_TEST_PYTHON_ALL_VERSIONS) }}
83+
include:
84+
- os: macos-latest
85+
python-version: ${{ vars.DBT_TEST_PYTHON_VERSION }}
86+
- os: windows-latest
87+
python-version: ${{ vars.DBT_TEST_PYTHON_VERSION }}
88+
env:
89+
REDSHIFT_TEST_HOST: ${{ secrets.REDSHIFT_TEST_HOST }}
90+
REDSHIFT_TEST_PORT: ${{ vars.REDSHIFT_TEST_PORT }}
91+
REDSHIFT_TEST_DBNAME: ${{ vars.REDSHIFT_TEST_DBNAME }}
92+
REDSHIFT_TEST_USER: ${{ vars.REDSHIFT_TEST_USER }}
93+
REDSHIFT_TEST_PASS: ${{ secrets.REDSHIFT_TEST_PASS }}
94+
DBT_TEST_USER_1: ${{ vars.REDSHIFT_TEST_USER_1 }}
95+
DBT_TEST_USER_2: ${{ vars.REDSHIFT_TEST_USER_2 }}
96+
DBT_TEST_USER_3: ${{ vars.REDSHIFT_TEST_USER_3 }}
97+
DBT_INVOCATION_ENV: ${{ vars.DBT_INVOCATION_ENV }}
98+
DD_CIVISIBILITY_AGENTLESS_ENABLED: true
99+
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
100+
DD_SITE: ${{ vars.DD_SITE }}
101+
DD_ENV: ${{ vars.DD_ENV }}
102+
DD_SERVICE: ${{ github.event.repository.name }}
103+
steps:
104+
- name: "Check out ${{ github.repository }}@${{ inputs.branch }} (non-PR)"
105+
if: github.event_name != 'pull_request_target'
106+
uses: actions/checkout@v4
107+
with:
108+
ref: ${{ inputs.branch }}
109+
persist-credentials: false
110+
111+
- name: "Check out ${{ github.repository }}@${{ inputs.branch }} (PR)"
112+
if: github.event_name == 'pull_request_target'
113+
uses: actions/checkout@v4
114+
with:
115+
ref: ${{ github.event.pull_request.head.sha }}
116+
117+
- name: "Setup environment"
118+
uses: dbt-labs/dbt-adapters/.github/actions/setup-environment@update-workflows
119+
with:
120+
python-version: ${{ matrix.python-version }}
121+
122+
- name: "Update development branches"
123+
if: ${{ contains(github.event_name, 'workflow_') }}
124+
uses: ./.github/actions/update-dev-branches
125+
with:
126+
dbt-adapters-branch: ${{ inputs.dbt-adapters-branch }}
127+
dbt-common-branch: ${{ inputs.dbt-common-branch }}
128+
dbt-core-branch: ${{ inputs.dbt-core-branch }}
129+
130+
- name: "Run integration tests"
131+
shell: bash
132+
run: hatch run integration-tests:all
133+
134+
aggregate-results:
135+
name: "Successful integration tests"
136+
needs: integration-tests
137+
if: ${{ !failure() && !cancelled() }}
138+
runs-on: ubuntu-latest
139+
steps:
140+
- name: "Integration tests completed successfully"
141+
shell: bash
142+
run: |
143+
title="Integration tests"
144+
message="Integration tests completed successfully!"
145+
echo "::notice title=${{ env.NOTIFICATION_PREFIX }}: $title::$message"

0 commit comments

Comments
 (0)