diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index c1562263..1a2cbba7 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -83,11 +83,16 @@ jobs: poetry-version: ${{ env.POETRY_VERSION }} python-version: ${{ matrix.python-version }} + - name: Run pytest (Windows) + if: matrix.operating-system == 'windows-latest' + run: make test-windows + - name: Run pytest (unit tests) + if: matrix.operating-system != 'windows-latest' run: make test-unit | tee pytest-coverage.txt && exit ${PIPESTATUS[0]} - name: Pytest coverage comment - if: matrix.python-version == '3.11' && matrix.operating-system == 'ubuntu-latest' + if: matrix.python-version == '3.11' && matrix.operating-system != 'windows-latest' uses: MishaKav/pytest-coverage-comment@main with: pytest-coverage-path: ./pytest-coverage.txt @@ -96,16 +101,25 @@ jobs: junitxml-path: ./coverage.xml - name: Run pytest (integration tests) + if: matrix.operating-system != 'windows-latest' run: make test-integration - - name: Regenerate dbt artifacts + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system == 'windows-latest' run: | + $env:Path += ';C:\Users\runneradmin\.local\bin' poetry run dbt deps poetry run dbt build poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml - - name: Run `dbt-bouncer` on generated artifacts - run: poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system != 'windows-latest' + run: | + poetry run dbt deps + poetry run dbt build + poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml e2e-tests: needs: [pre-commit] diff --git a/.github/workflows/merge_pipeline.yml b/.github/workflows/merge_pipeline.yml index 24c325cf..d9d0677b 100644 --- a/.github/workflows/merge_pipeline.yml +++ b/.github/workflows/merge_pipeline.yml @@ -123,7 +123,7 @@ - name: Run `dbt-bouncer` run: python ./dist/dbt-bouncer.pex --config-file dbt-bouncer-example.yml - pypi-tests: + pip-tests: runs-on: ${{ matrix.operating-system }} strategy: fail-fast: false @@ -141,13 +141,6 @@ - name: Checkout uses: actions/checkout@v4 - - name: Determine python version - id: python-version - run: | - export PYTHON_VERSION=$(cat .python-version) - echo "PYTHON_VERSION: $PYTHON_VERSION" - echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_OUTPUT - - name: Setup Python uses: ./.github/actions/setup_python_env with: @@ -160,11 +153,19 @@ - name: Run `dbt-bouncer` run: dbt-bouncer --config-file dbt-bouncer-example.yml - - name: Regenerate dbt artifacts + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system == 'windows-latest' run: | + $env:Path += ';C:\Users\runneradmin\.local\bin' poetry run dbt deps poetry run dbt build poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml - - name: Run `dbt-bouncer` on generated artifacts - run: poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system != 'windows-latest' + run: | + poetry run dbt deps + poetry run dbt build + poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml diff --git a/.github/workflows/post_release_pipeline.yml b/.github/workflows/post_release_pipeline.yml index 97311275..e875a946 100644 --- a/.github/workflows/post_release_pipeline.yml +++ b/.github/workflows/post_release_pipeline.yml @@ -96,13 +96,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Determine python version - id: python-version - run: | - export PYTHON_VERSION=$(cat .python-version) - echo "PYTHON_VERSION: $PYTHON_VERSION" - echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_OUTPUT - - name: Setup Python uses: ./.github/actions/setup_python_env with: @@ -110,16 +103,29 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install `dbt-bouncer` + if: matrix.operating-system == 'windows-latest' + run: pip install dbt-bouncer=='("${{ github.ref }}" -Split "/")[2]' + + - name: Install `dbt-bouncer` + if: matrix.operating-system != 'windows-latest' run: pip install dbt-bouncer==$(echo "${{ github.ref }}" | cut -d "/" -f3) - name: Run `dbt-bouncer` run: dbt-bouncer --config-file dbt-bouncer-example.yml - - name: Regenerate dbt artifacts + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system == 'windows-latest' run: | + $env:Path += ';C:\Users\runneradmin\.local\bin' poetry run dbt deps poetry run dbt build poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml - - name: Run `dbt-bouncer` on generated artifacts - run: poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml + - name: Regenerate dbt artifacts and run `dbt-bouncer` + if: matrix.operating-system != 'windows-latest' + run: | + poetry run dbt deps + poetry run dbt build + poetry run dbt docs generate + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml diff --git a/makefile b/makefile index 7f670395..2c0c0dec 100644 --- a/makefile +++ b/makefile @@ -1,53 +1,58 @@ -build-artifacts: - poetry run python ./scripts/generate_artifacts.py - -build-pex: - poetry run pex . \ - --interpreter-constraint ">=3.8.1,<3.13" \ - --jobs 128 \ - --max-install-jobs 0 \ - --output-file ./dist/dbt-bouncer.pex \ - --pip-version 23.2 \ - --platform macosx_11_0_x86_64-cp-38-cp38 \ - --platform macosx_11_0_x86_64-cp-39-cp39 \ - --platform macosx_11_0_x86_64-cp-310-cp310 \ - --platform macosx_11_0_x86_64-cp-311-cp311 \ - --platform macosx_11_0_x86_64-cp-312-cp312 \ - --platform manylinux2014_x86_64-cp-38-cp38 \ - --platform manylinux2014_x86_64-cp-39-cp39 \ - --platform manylinux2014_x86_64-cp-310-cp310 \ - --platform manylinux2014_x86_64-cp-311-cp311 \ - --platform manylinux2014_x86_64-cp-312-cp312 \ - --python-shebang='/usr/bin/env python' \ - --script dbt-bouncer - -test: - $(MAKE) test-unit - $(MAKE) test-integration - -test-integration: - poetry run pytest \ - -c ./tests \ - --junitxml=coverage.xml \ - --cov-report=term-missing:skip-covered \ - --cov=src/dbt_bouncer/ \ - --numprocesses 5 \ - ./tests/integration \ - $(MAKE_ARGS) - -test-unit: - poetry run pytest \ - -c ./tests \ - --junitxml=coverage.xml \ - --cov-report=term-missing:skip-covered \ - --cov=src/dbt_bouncer/ \ - --numprocesses 5 \ - ./tests/unit \ - -m 'not not_in_parallel' && \ - poetry run pytest \ - -c ./tests \ - --junitxml=coverage.xml \ - --cov-report=term-missing:skip-covered \ - --cov=src/dbt_bouncer/ \ - --cov-append \ - -m not_in_parallel +build-artifacts: + poetry run python ./scripts/generate_artifacts.py + +build-pex: + poetry run pex . \ + --interpreter-constraint ">=3.8.1,<3.13" \ + --jobs 128 \ + --max-install-jobs 0 \ + --output-file ./dist/dbt-bouncer.pex \ + --pip-version 23.2 \ + --platform macosx_11_0_x86_64-cp-38-cp38 \ + --platform macosx_11_0_x86_64-cp-39-cp39 \ + --platform macosx_11_0_x86_64-cp-310-cp310 \ + --platform macosx_11_0_x86_64-cp-311-cp311 \ + --platform macosx_11_0_x86_64-cp-312-cp312 \ + --platform manylinux2014_x86_64-cp-38-cp38 \ + --platform manylinux2014_x86_64-cp-39-cp39 \ + --platform manylinux2014_x86_64-cp-310-cp310 \ + --platform manylinux2014_x86_64-cp-311-cp311 \ + --platform manylinux2014_x86_64-cp-312-cp312 \ + --python-shebang='/usr/bin/env python' \ + --script dbt-bouncer + +test: + $(MAKE) test-unit + $(MAKE) test-integration + +test-integration: + poetry run pytest \ + -c ./tests \ + --junitxml=coverage.xml \ + --cov-report=term-missing:skip-covered \ + --cov=src/dbt_bouncer/ \ + --numprocesses 5 \ + ./tests/integration \ + $(MAKE_ARGS) + +test-unit: + poetry run pytest \ + -c ./tests \ + --junitxml=coverage.xml \ + --cov-report=term-missing:skip-covered \ + --cov=src/dbt_bouncer/ \ + --numprocesses 5 \ + ./tests/unit \ + -m 'not not_in_parallel' && \ + poetry run pytest \ + -c ./tests \ + --junitxml=coverage.xml \ + --cov-report=term-missing:skip-covered \ + --cov=src/dbt_bouncer/ \ + --cov-append \ + -m not_in_parallel + +test-windows: + poetry run pytest -c ./tests --numprocesses 5 ./tests/unit -m 'not not_in_parallel' && \ + poetry run pytest -c ./tests -m not_in_parallel && \ + poetry run pytest -c ./tests --numprocesses 5 ./tests/integration