diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 3e715e1318..65c45b38e5 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -73,17 +73,7 @@ jobs: strategy: fail-fast: false matrix: - dbt-version: - [ - '1.3.0', - '1.4.0', - '1.5.0', - '1.6.0', - '1.7.0', - '1.8.0', - '1.9.0', - '1.10.0', - ] + dbt-version: ['1.3', '1.4', '1.5', '1.6', '1.7', '1.8', '1.9', '1.10'] steps: - uses: actions/checkout@v5 - name: Set up Python @@ -96,18 +86,7 @@ jobs: run: | uv venv .venv source .venv/bin/activate - sed -i 's/"pydantic>=2.0.0"/"pydantic"/g' pyproject.toml - if [[ "${{ matrix.dbt-version }}" == "1.10.0" ]]; then - # For 1.10.0: only add version to dbt-core, remove versions from all adapter packages - sed -i -E 's/"(dbt-core)[^"]*"/"\1~=${{ matrix.dbt-version }}"/g' pyproject.toml - # Remove version constraints from all dbt adapter packages - sed -i -E 's/"(dbt-(bigquery|duckdb|snowflake|athena-community|clickhouse|databricks|redshift|trino))[^"]*"/"\1"/g' pyproject.toml - else - # For other versions: apply version to all dbt packages - sed -i -E 's/"(dbt-[^">=<~!]+)[^"]*"/"\1~=${{ matrix.dbt-version }}"/g' pyproject.toml - fi - UV=1 make install-dev - uv pip install pydantic>=2.0.0 --reinstall + UV=1 make install-dev-dbt-${{ matrix.dbt-version }} - name: Run dbt tests # We can't run slow tests across all engines due to tests requiring DuckDB and old versions # of DuckDB require a version of DuckDB we no longer support diff --git a/Makefile b/Makefile index 04306946cd..5335da5dc6 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,13 @@ else PIP := pip3 endif +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Darwin) + SED_INPLACE = sed -i '' +else + SED_INPLACE = sed -i +endif + install-dev: $(PIP) install -e ".[dev,web,slack,dlt,lsp]" ./examples/custom_materializations @@ -15,6 +22,33 @@ install-doc: install-pre-commit: pre-commit install +install-dev-dbt-%: + @version="$*"; \ + period_count=$$(echo "$$version" | tr -cd '.' | wc -c); \ + if [ "$$period_count" -eq 0 ]; then \ + version="$${version:0:1}.$${version:1}"; \ + elif [ "$$period_count" -eq 1 ]; then \ + version="$$version.0"; \ + fi; \ + echo "Installing dbt version: $$version"; \ + cp pyproject.toml pyproject.toml.backup; \ + $(SED_INPLACE) 's/"pydantic>=2.0.0"/"pydantic"/g' pyproject.toml; \ + if [ "$$version" = "1.10.0" ]; then \ + echo "Applying special handling for dbt 1.10.0"; \ + $(SED_INPLACE) -E 's/"(dbt-core)[^"]*"/"\1~='"$$version"'"/g' pyproject.toml; \ + $(SED_INPLACE) -E 's/"(dbt-(bigquery|duckdb|snowflake|athena-community|clickhouse|databricks|redshift|trino))[^"]*"/"\1"/g' pyproject.toml; \ + else \ + echo "Applying version $$version to all dbt packages"; \ + $(SED_INPLACE) -E 's/"(dbt-[^"><=~!]+)[^"]*"/"\1~='"$$version"'"/g' pyproject.toml; \ + fi; \ + $(MAKE) install-dev; \ + if [ "$$version" = "1.6.0" ]; then \ + echo "Applying pydantic override for dbt 1.6.0"; \ + $(PIP) install 'pydantic>=2.0.0' --reinstall; \ + fi; \ + mv pyproject.toml.backup pyproject.toml; \ + echo "Restored original pyproject.toml" + style: pre-commit run --all-files