Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit d1976bb

Browse files
authored
Integration workflow update to support all-in-one adapter testing (#1309)
1 parent 3839953 commit d1976bb

File tree

3 files changed

+71
-30
lines changed

3 files changed

+71
-30
lines changed

.github/scripts/update_dbt_core_branch.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash -e
2+
set -e
3+
4+
5+
dbt_adapters_branch=$1
6+
dbt_core_branch=$2
7+
dbt_common_branch=$3
8+
target_req_file="dev-requirements.txt"
9+
core_req_sed_pattern="s|dbt-core.git.*#egg=dbt-core|dbt-core.git@${dbt_core_branch}#egg=dbt-core|g"
10+
adapters_req_sed_pattern="s|dbt-adapters.git|dbt-adapters.git@${dbt_adapters_branch}|g"
11+
common_req_sed_pattern="s|dbt-common.git|dbt-common.git@${dbt_common_branch}|g"
12+
if [[ "$OSTYPE" == darwin* ]]; then
13+
# mac ships with a different version of sed that requires a delimiter arg
14+
sed -i "" "$adapters_req_sed_pattern" $target_req_file
15+
sed -i "" "$core_req_sed_pattern" $target_req_file
16+
sed -i "" "$common_req_sed_pattern" $target_req_file
17+
else
18+
sed -i "$adapters_req_sed_pattern" $target_req_file
19+
sed -i "$core_req_sed_pattern" $target_req_file
20+
sed -i "$common_req_sed_pattern" $target_req_file
21+
fi

.github/workflows/integration.yml

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
name: Adapter Integration Tests
2222

23+
run-name: "${{ (contains(github.event_name, 'workflow_') && inputs.name) || github.event_name }}: ${{ (contains(github.event_name, 'workflow_') && inputs.adapter_branch) || github.ref_name }} by @${{ github.actor }}"
24+
2325
on:
2426
# pushes to release branches
2527
push:
@@ -34,10 +36,31 @@ on:
3436
# manual trigger
3537
workflow_dispatch:
3638
inputs:
37-
dbt-core-branch:
38-
description: "branch of dbt-core to use in dev-requirements.txt"
39+
name:
40+
description: "Name to associate with run (example: 'dbt-adapters-242')"
41+
required: false
42+
type: string
43+
default: "Adapter Integration Tests"
44+
adapter_branch:
45+
description: "The branch of this adapter repository to use"
46+
type: string
47+
required: false
48+
default: "main"
49+
dbt_adapters_branch:
50+
description: "The branch of dbt-adapters to use"
51+
type: string
52+
required: false
53+
default: "main"
54+
dbt_core_branch:
55+
description: "The branch of dbt-core to use"
56+
type: string
3957
required: false
58+
default: "main"
59+
dbt_common_branch:
60+
description: "The branch of dbt-common to use"
4061
type: string
62+
required: false
63+
default: "main"
4164

4265
# explicitly turn off permissions for `GITHUB_TOKEN`
4366
permissions: read-all
@@ -67,12 +90,19 @@ jobs:
6790
run-python-tests: ${{ steps.filter.outputs.bigquery-python }}
6891

6992
steps:
70-
- name: Check out the repository (non-PR)
71-
if: github.event_name != 'pull_request_target'
93+
- name: Check out the repository (push)
94+
if: github.event_name == 'push'
7295
uses: actions/checkout@v4
7396
with:
7497
persist-credentials: false
7598

99+
- name: Check out the repository (workflow_dispatch)
100+
if: github.event_name == 'workflow_dispatch'
101+
uses: actions/checkout@v4
102+
with:
103+
persist-credentials: false
104+
ref: ${{ inputs.adapter_branch }}
105+
76106
- name: Check out the repository (PR)
77107
if: github.event_name == 'pull_request_target'
78108
uses: actions/checkout@v4
@@ -143,12 +173,19 @@ jobs:
143173

144174
steps:
145175
- name: Check out the repository
146-
if: github.event_name != 'pull_request_target'
176+
if: github.event_name != 'pull_request_target' && github.event_name != 'workflow_dispatch'
147177
uses: actions/checkout@v4
148178
with:
149179
persist-credentials: false
150180

151-
# explicity checkout the branch for the PR,
181+
- name: Check out the repository (workflow_dispatch)
182+
if: github.event_name == 'workflow_dispatch'
183+
uses: actions/checkout@v4
184+
with:
185+
persist-credentials: false
186+
ref: ${{ inputs.adapter_branch }}
187+
188+
# explicitly checkout the branch for the PR,
152189
# this is necessary for the `pull_request_target` event
153190
- name: Check out the repository (PR)
154191
if: github.event_name == 'pull_request_target'
@@ -169,11 +206,14 @@ jobs:
169206
python -m pip --version
170207
tox --version
171208
172-
- name: Update dev_requirements.txt
173-
if: inputs.dbt-core-branch != ''
209+
- name: Update Adapters and Core branches (update dev_requirements.txt)
210+
if: github.event_name == 'workflow_dispatch'
174211
run: |
175-
pip install bumpversion
176-
./.github/scripts/update_dbt_core_branch.sh ${{ inputs.dbt-core-branch }}
212+
./.github/scripts/update_dev_dependency_branches.sh \
213+
${{ inputs.dbt_adapters_branch }} \
214+
${{ inputs.dbt_core_branch }} \
215+
${{ inputs.dbt_common_branch }}
216+
cat dev-requirements.txt
177217
178218
- name: Run tox (bigquery)
179219
if: matrix.adapter == 'bigquery'

0 commit comments

Comments
 (0)