Skip to content

Commit 79160b9

Browse files
committed
ci: use reusable workflows from dbt-labs/dbt-package-testing@v2
Switch ci.yml and fusion.yml to call the shared reusable workflows (run_tox.yml and run_tox_fusion.yml) instead of inlining the matrix, checkout, and tox setup steps. Preserves existing schema names, secret mappings, and the pull_request_target fork-PR environment gate.
1 parent afecc40 commit 79160b9

2 files changed

Lines changed: 62 additions & 113 deletions

File tree

.github/workflows/ci.yml

Lines changed: 37 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,64 +19,41 @@ on:
1919
permissions:
2020
contents: read
2121

22-
env:
23-
PYTHON_VERSION: "3.11"
24-
2522
jobs:
26-
run-tests:
27-
runs-on: ubuntu-latest
28-
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'cloud-tests' || '' }}
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
adapter: [snowflake, bigquery, redshift, databricks]
33-
34-
steps:
35-
- name: "Checkout PR code"
36-
uses: actions/checkout@v4
37-
with:
38-
# For pull_request_target, we must explicitly checkout the PR head
39-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
40-
41-
- name: "Set up Python ${{ env.PYTHON_VERSION }}"
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: ${{ env.PYTHON_VERSION }}
45-
46-
- name: "Install dbt-${{ matrix.adapter }}"
47-
run: |
48-
python -m pip install --upgrade pip
49-
pip install dbt-${{ matrix.adapter }}
50-
51-
- name: "Install tox"
52-
run: |
53-
pip install tox
54-
55-
- name: "Run integration tests on ${{ matrix.adapter }}"
56-
run: |
57-
tox -e dbt_integration_${{ matrix.adapter }}
58-
env:
59-
# snowflake
60-
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
61-
SNOWFLAKE_USER: ${{ vars.SNOWFLAKE_USER }}
62-
DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_PASS }}
63-
SNOWFLAKE_ROLE: ${{ vars.SNOWFLAKE_ROLE }}
64-
SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }}
65-
SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }}
66-
SNOWFLAKE_SCHEMA: "dbt_project_evaluator_integration_tests_snowflake_${{ github.run_number }}"
67-
# bigquery
68-
BIGQUERY_PROJECT: ${{ vars.BIGQUERY_PROJECT }}
69-
BIGQUERY_KEYFILE_JSON: ${{ secrets.BIGQUERY_KEYFILE_JSON }}
70-
BIGQUERY_SCHEMA: "dpe_integration_tests_bigquery_${{ github.run_number }}"
71-
# redshift
72-
REDSHIFT_HOST: ${{ vars.REDSHIFT_HOST }}
73-
REDSHIFT_USER: ${{ vars.REDSHIFT_USER }}
74-
DBT_ENV_SECRET_REDSHIFT_PASS: ${{ secrets.REDSHIFT_PASS }}
75-
REDSHIFT_DATABASE: ${{ vars.REDSHIFT_DATABASE }}
76-
REDSHIFT_SCHEMA: "dpe_integration_tests_redshift_${{ github.run_number }}"
77-
REDSHIFT_PORT: 5439
78-
# databricks
79-
DATABRICKS_HOST: ${{ vars.DATABRICKS_HOST }}
80-
DATABRICKS_HTTP_PATH: ${{ vars.DATABRICKS_HTTP_PATH }}
81-
DBT_ENV_SECRET_DATABRICKS_TOKEN: ${{ secrets.DBT_ENV_SECRET_DATABRICKS_TOKEN }}
82-
DATABRICKS_SCHEMA: "integration_tests_databricks_${{ github.run_number }}"
23+
core-tests:
24+
uses: dbt-labs/dbt-package-testing/.github/workflows/run_tox.yml@v2
25+
with:
26+
# Adapters are read from supported_adapters.env if not specified here
27+
adapters: "snowflake,bigquery,redshift,databricks"
28+
# For pull_request_target: require environment approval for fork PRs
29+
environment: >-
30+
${{ github.event_name == 'pull_request_target'
31+
&& github.event.pull_request.head.repo.full_name != github.repository
32+
&& 'cloud-tests' || '' }}
33+
# For pull_request_target: checkout the PR head, not the base branch
34+
ref: ${{ github.event.pull_request.head.sha || '' }}
35+
# snowflake
36+
SNOWFLAKE_USER: ${{ vars.SNOWFLAKE_USER }}
37+
SNOWFLAKE_ROLE: ${{ vars.SNOWFLAKE_ROLE }}
38+
SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }}
39+
SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }}
40+
SNOWFLAKE_SCHEMA: "dbt_project_evaluator_integration_tests_snowflake_${{ github.run_number }}"
41+
# bigquery
42+
BIGQUERY_PROJECT: ${{ vars.BIGQUERY_PROJECT }}
43+
BIGQUERY_SCHEMA: "dpe_integration_tests_bigquery_${{ github.run_number }}"
44+
# redshift
45+
REDSHIFT_HOST: ${{ vars.REDSHIFT_HOST }}
46+
REDSHIFT_USER: ${{ vars.REDSHIFT_USER }}
47+
REDSHIFT_DATABASE: ${{ vars.REDSHIFT_DATABASE }}
48+
REDSHIFT_SCHEMA: "dpe_integration_tests_redshift_${{ github.run_number }}"
49+
REDSHIFT_PORT: "5439"
50+
# databricks
51+
DATABRICKS_SCHEMA: "integration_tests_databricks_${{ github.run_number }}"
52+
DATABRICKS_HOST: ${{ vars.DATABRICKS_HOST }}
53+
DATABRICKS_HTTP_PATH: ${{ vars.DATABRICKS_HTTP_PATH }}
54+
secrets:
55+
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
56+
DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_PASS }}
57+
BIGQUERY_KEYFILE_JSON: ${{ secrets.BIGQUERY_KEYFILE_JSON }}
58+
DBT_ENV_SECRET_REDSHIFT_PASS: ${{ secrets.REDSHIFT_PASS }}
59+
DBT_ENV_SECRET_DATABRICKS_TOKEN: ${{ secrets.DBT_ENV_SECRET_DATABRICKS_TOKEN }}

.github/workflows/fusion.yml

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# **what?**
2-
# Run tests using dbt Fusion against Snowflake
2+
# Run tests using dbt Fusion against supported adapters
33

44
# **why?**
55
# To ensure that dbt-project-evaluator works as expected with dbt Fusion
@@ -9,9 +9,8 @@
99
# On every PR, and every push to main and when manually triggered
1010

1111
# **note**
12-
# Currently only Snowflake is tested with Fusion. Additional adapters can be
13-
# added to the matrix as Fusion support expands. Credentials are shared with
14-
# the existing dbt-core Snowflake tests.
12+
# DuckDB runs first as a quick check that does not require cloud credentials.
13+
# Cloud adapter tests use the reusable workflow from dbt-labs/dbt-package-testing.
1514

1615
name: Fusion Integration Tests
1716

@@ -22,14 +21,15 @@ on:
2221
pull_request_target:
2322
workflow_dispatch:
2423

24+
permissions:
25+
contents: read
26+
2527
env:
2628
PYTHON_VERSION: "3.11"
2729

2830
jobs:
2931
run-duckdb-tests:
3032
runs-on: ubuntu-latest
31-
permissions:
32-
contents: read
3333

3434
steps:
3535
- name: "Checkout PR code"
@@ -60,51 +60,23 @@ jobs:
6060
run: |
6161
tox -e dbt_integration_fusion_duckdb
6262
63-
run-cloud-tests:
63+
fusion-tests:
6464
needs: run-duckdb-tests
65-
runs-on: ubuntu-latest
66-
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'cloud-tests' || '' }}
67-
strategy:
68-
fail-fast: false
69-
matrix:
70-
# Only Snowflake for now - add more adapters here as Fusion support expands
71-
adapter: [snowflake]
72-
73-
steps:
74-
- name: "Checkout PR code"
75-
uses: actions/checkout@v4
76-
with:
77-
# For pull_request_target, we must explicitly checkout the PR head
78-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
79-
80-
- name: "Set up Python ${{ env.PYTHON_VERSION }}"
81-
uses: actions/setup-python@v5
82-
with:
83-
python-version: ${{ env.PYTHON_VERSION }}
84-
85-
- name: "Install dbt Fusion"
86-
run: |
87-
curl -fsSL https://public.cdn.getdbt.com/fs/install/install.sh | sh
88-
echo "$HOME/.local/bin" >> $GITHUB_PATH
89-
90-
- name: "Verify Fusion installation"
91-
run: |
92-
dbt --version
93-
94-
- name: "Install tox"
95-
run: |
96-
python -m pip install --upgrade pip
97-
pip install tox
98-
99-
- name: "Run Fusion integration tests on ${{ matrix.adapter }}"
100-
run: |
101-
tox -e dbt_integration_fusion_${{ matrix.adapter }}
102-
env:
103-
# snowflake
104-
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
105-
SNOWFLAKE_USER: ${{ vars.SNOWFLAKE_USER }}
106-
DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_PASS }}
107-
SNOWFLAKE_ROLE: ${{ vars.SNOWFLAKE_ROLE }}
108-
SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }}
109-
SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }}
110-
SNOWFLAKE_SCHEMA: "fusion_integration_tests_${{ matrix.adapter }}_${{ github.run_number }}"
65+
uses: dbt-labs/dbt-package-testing/.github/workflows/run_tox_fusion.yml@v2
66+
with:
67+
# Only Snowflake for now - add more adapters here as Fusion support expands
68+
adapters: "snowflake"
69+
environment: >-
70+
${{ github.event_name == 'pull_request_target'
71+
&& github.event.pull_request.head.repo.full_name != github.repository
72+
&& 'cloud-tests' || '' }}
73+
ref: ${{ github.event.pull_request.head.sha || '' }}
74+
# snowflake
75+
SNOWFLAKE_USER: ${{ vars.SNOWFLAKE_USER }}
76+
SNOWFLAKE_ROLE: ${{ vars.SNOWFLAKE_ROLE }}
77+
SNOWFLAKE_DATABASE: ${{ vars.SNOWFLAKE_DATABASE }}
78+
SNOWFLAKE_WAREHOUSE: ${{ vars.SNOWFLAKE_WAREHOUSE }}
79+
SNOWFLAKE_SCHEMA: "fusion_integration_tests_snowflake_${{ github.run_number }}"
80+
secrets:
81+
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
82+
DBT_ENV_SECRET_SNOWFLAKE_PASS: ${{ secrets.SNOWFLAKE_PASS }}

0 commit comments

Comments
 (0)