diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index f9545f0f..c1a44f37 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -2,7 +2,7 @@ name: CI pipeline on: - pull_request_target: + pull_request: branches: - main @@ -51,7 +51,7 @@ jobs: cat changed_files.txt | xargs poetry run pre-commit run --files unit-tests: - needs: [pre-commit] + # needs: [pre-commit] runs-on: ${{ matrix.operating-system }} permissions: contents: write @@ -83,16 +83,24 @@ jobs: poetry-version: ${{ env.POETRY_VERSION }} python-version: ${{ matrix.python-version }} - - name: Run pytest (unit tests) + - run: | + $env:Path += ';C:\Users\runneradmin\.local\bin' + poetry --version + if: matrix.operating-system == 'windows-latest' + + # - run: poetry --version + + + - name: Run pytest if: matrix.operating-system == 'windows-latest' - run: make test-unit + 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 @@ -101,16 +109,35 @@ jobs: junitxml-path: ./coverage.xml - name: Run pytest (integration tests) + if: matrix.operating-system != 'windows-latest' run: make test-integration - name: Regenerate dbt artifacts run: | + if [[ ${{ matrix.operating-system }} == "windows-latest" ]]; then + $env:Path += ';C:\Users\runneradmin\.local\bin' + fi poetry run dbt deps poetry run dbt build poetry run dbt docs generate - name: Run `dbt-bouncer` on generated artifacts - run: poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml + run: | + if [[ ${{ matrix.operating-system }} == "windows-latest" ]]; then + $env:Path += ';C:\Users\runneradmin\.local\bin' + fi + poetry run dbt-bouncer --config-file ./dbt-bouncer-example.yml + + - name: Determine python version + id: python-version + run: | + if [[ ${{ matrix.operating-system }} == "windows-latest" ]]; then + echo "PYTHON_VERSION=$(cat .python-version)" >> $ENV:GITHUB_OUTPUT + else + export PYTHON_VERSION=$(cat .python-version) + echo "PYTHON_VERSION: $PYTHON_VERSION" + echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_OUTPUT + fi e2e-tests: needs: [pre-commit] 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