Skip to content

Commit

Permalink
Create subflow per dbt version testing (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsimsek authored Dec 17, 2024
1 parent 580769f commit 9750709
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 33 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/tests-dbt-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Test DBT Version

on:
workflow_call:
inputs:
dbt-version:
required: true
type: string

jobs:
test-dbt-version:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
dbt-version: ${{ inputs.dbt-version }}
- name: Build & Install DBT ${{ inputs.dbt-version }}
run: |
pip install -q coverage pylint
pip install -q dbt-core==${{ inputs.dbt-version }}.* dbt-duckdb==${{ inputs.dbt-version }}.* --force-reinstall --upgrade
# FIX for protobuf issue: https://github.com/dbt-labs/dbt-core/issues/9759
pip install -q "apache-airflow" "protobuf>=4.25.3,<5.0.0" "opentelemetry-proto<1.28.0" --prefer-binary
pip install -q .[test] --prefer-binary
python --version
python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')"
python -m compileall -f opendbt
python -m pylint opendbt
- name: Run Tests
run: |
python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')"
python -m coverage run --source=./tests/ -m unittest discover -s tests/
python -m coverage report -m ./opendbt/*.py
52 changes: 19 additions & 33 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,31 @@ on:
push:
branches: [ main ]
paths-ignore:
- '.github/**'
- '.idea/**'
- '.run/**'
pull_request:
branches: [ main ]
paths-ignore:
- '.github/**'
- '.idea/**'
- '.run/**'

jobs:
build:

runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
dbt-version: [ "1.6", "1.7", "1.8", "1.9" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
dbt-version: ${{ matrix.dbt-version }}
- name: Build & Install
run: |
pip install -q coverage pylint
pip install -q dbt-core==${{ matrix.dbt-version }}.* dbt-duckdb==${{ matrix.dbt-version }}.* --force-reinstall --upgrade
# FIX for protobuf issue: https://github.com/dbt-labs/dbt-core/issues/9759
pip install -q "apache-airflow" "protobuf>=4.25.3,<5.0.0" "opentelemetry-proto<1.28.0" --prefer-binary
pip install -q .[test] --prefer-binary
python --version
python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')"
python -m compileall -f opendbt
python -m pylint opendbt
- name: Run Tests
run: |
python -c "from dbt.version import get_installed_version as get_dbt_version;print(f'dbt version={get_dbt_version()}')"
python -m coverage run --source=./tests/ -m unittest discover -s tests/
python -m coverage report -m ./opendbt/*.py
test-dbt-1-6:
uses: ./.github/workflows/tests-dbt-version.yml
with:
dbt-version: "1.6"
test-dbt-1-7:
uses: ./.github/workflows/tests-dbt-version.yml
with:
dbt-version: "1.7"
needs: test-dbt-1-6
test-dbt-1-8:
uses: ./.github/workflows/tests-dbt-version.yml
with:
dbt-version: "1.8"
needs: test-dbt-1-7
test-dbt-1-9:
uses: ./.github/workflows/tests-dbt-version.yml
with:
dbt-version: "1.9"
needs: test-dbt-1-8

0 comments on commit 9750709

Please sign in to comment.