From 0e747aeca5a709424b47c739ffb0cc2143009517 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 2 Dec 2024 11:15:31 -0800 Subject: [PATCH 1/4] ci: allow test matrix to always run, reporting success when skipped --- .github/workflows/pytest_matrix.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pytest_matrix.yml b/.github/workflows/pytest_matrix.yml index c0a9e7bb7..328db1f4a 100644 --- a/.github/workflows/pytest_matrix.yml +++ b/.github/workflows/pytest_matrix.yml @@ -17,11 +17,6 @@ on: - 'poetry.lock' - 'pyproject.toml' pull_request: - paths: - - 'airbyte_cdk/**' - - 'unit_tests/**' - - 'poetry.lock' - - 'pyproject.toml' jobs: pytest: @@ -52,12 +47,24 @@ jobs: # Common steps: - name: Checkout code uses: actions/checkout@v4 + - id: changes + uses: dorny/paths-filter@v3.0.2 + with: + filters: | + src: + - 'airbyte_cdk/**' + - 'unit_tests/**' + - 'bin/**' + - 'poetry.lock' + - 'pyproject.toml' - name: Set up Poetry uses: Gr1N/setup-poetry@v9 + if: steps.changes.outputs.src == 'true' with: poetry-version: "1.7.1" - name: Set up Python uses: actions/setup-python@v5 + if: steps.changes.outputs.src == 'true' with: python-version: ${{ matrix.python-version }} cache: "poetry" @@ -67,6 +74,7 @@ jobs: # Job-specific step(s): - name: Run Pytest timeout-minutes: 60 + if: steps.changes.outputs.src == 'true' env: GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }} run: > @@ -75,17 +83,17 @@ jobs: -m "not linting and not super_slow and not flaky" - name: Print Coverage Report - if: always() + if: always() && steps.changes.outputs.src == 'true' run: poetry run coverage report - name: Create Coverage Artifacts - if: always() + if: always() && steps.changes.outputs.src == 'true' run: | poetry run coverage html -d htmlcov poetry run coverage xml -o htmlcov/coverage.xml - name: Upload coverage to GitHub Artifacts - if: always() + if: always() && steps.changes.outputs.src == 'true' uses: actions/upload-artifact@v4 with: name: py${{ matrix.python-version }}-${{ matrix.os }}-test-coverage From 6b1c1fe15a38ad6c539de30c281c422446b5ba2a Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 2 Dec 2024 11:18:21 -0800 Subject: [PATCH 2/4] also skip dependencies installation --- .github/workflows/pytest_matrix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pytest_matrix.yml b/.github/workflows/pytest_matrix.yml index 328db1f4a..740bc06c4 100644 --- a/.github/workflows/pytest_matrix.yml +++ b/.github/workflows/pytest_matrix.yml @@ -69,6 +69,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: "poetry" - name: Install dependencies + if: steps.changes.outputs.src == 'true' run: poetry install --all-extras # Job-specific step(s): From 8a13211060cc7f06c203003c5cbb1852a40f7484 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 2 Dec 2024 11:31:02 -0800 Subject: [PATCH 3/4] ci: skip downstream connector tests if no source code is changed --- .github/workflows/connector-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/connector-tests.yml b/.github/workflows/connector-tests.yml index fb25bc72d..a3fc757ed 100644 --- a/.github/workflows/connector-tests.yml +++ b/.github/workflows/connector-tests.yml @@ -94,7 +94,7 @@ jobs: steps: - name: Abort if extra not changed (${{matrix.cdk_extra}}) id: no_changes - if: ${{ matrix.cdk_extra != 'n/a' && needs.cdk_changes.outputs[matrix.cdk_extra] == 'false' }} + if: ${{ needs.cdk_changes.outputs['src'] == 'false' || matrix.cdk_extra != 'n/a' && needs.cdk_changes.outputs[matrix.cdk_extra] == 'false' }} run: | echo "Aborting job as specified extra not changed: ${{matrix.cdk_extra}} = ${{ needs.cdk_changes.outputs[matrix.cdk_extra] }}" echo "> Skipped '${{matrix.connector}}' (no relevant changes)" >> $GITHUB_STEP_SUMMARY From fa8290ff7c1a22093877c462675f0e222c2f318a Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 2 Dec 2024 11:36:42 -0800 Subject: [PATCH 4/4] improve debug prints --- .github/workflows/connector-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/connector-tests.yml b/.github/workflows/connector-tests.yml index a3fc757ed..b2b056026 100644 --- a/.github/workflows/connector-tests.yml +++ b/.github/workflows/connector-tests.yml @@ -96,7 +96,11 @@ jobs: id: no_changes if: ${{ needs.cdk_changes.outputs['src'] == 'false' || matrix.cdk_extra != 'n/a' && needs.cdk_changes.outputs[matrix.cdk_extra] == 'false' }} run: | - echo "Aborting job as specified extra not changed: ${{matrix.cdk_extra}} = ${{ needs.cdk_changes.outputs[matrix.cdk_extra] }}" + echo "Aborting job." + echo "Source code changed: ${{ needs.cdk_changes.outputs['src'] }}" + if [ "${{ matrix.cdk_extra }}" != "n/a" ]; then + echo "Extra not changed: ${{ matrix.cdk_extra }} = ${{ needs.cdk_changes.outputs[matrix.cdk_extra] }}" + fi echo "> Skipped '${{matrix.connector}}' (no relevant changes)" >> $GITHUB_STEP_SUMMARY echo "status=cancelled" >> $GITHUB_OUTPUT exit 0