From 2079daeb54a77d9fd388768c8b82d87deab9b244 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 1 Oct 2026 11:45:02 +0200 Subject: [PATCH 1/3] Limit standalone Python CI to relevant changes --- .github/workflows/python_push.yml | 51 +++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python_push.yml b/.github/workflows/python_push.yml index 428dfc09e30..8a8a7eb5dab 100644 --- a/.github/workflows/python_push.yml +++ b/.github/workflows/python_push.yml @@ -1,9 +1,8 @@ name: python build on: - # Not restricted to python/**: these tests also cover contracts shared with the Go - # code, such as libs/dyn/dynvar/testdata/reference_vectors.json, so a change outside - # python/ can break them. + # Keep workflow triggers unrestricted so skipped jobs satisfy required checks. + # The change filter includes the shared fixture consumed by Python tests. pull_request: types: [opened, synchronize] merge_group: @@ -18,7 +17,43 @@ on: - main jobs: + changes: + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + python: ${{ steps.changes.outputs.python }} + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Detect Python changes + id: changes + shell: bash + env: + BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }} + HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.event.after }} + run: | + changed_files=$(git diff --name-only "$BASE_SHA...$HEAD_SHA" -- \ + .github/workflows/python_push.yml \ + Taskfile.yml \ + go.mod \ + go.sum \ + libs/dyn/dynvar/testdata/reference_vectors.json \ + python/ \ + tools/task/ \ + ) + if [[ -n "$changed_files" ]]; then + echo "python=true" >> "$GITHUB_OUTPUT" + else + echo "python=false" >> "$GITHUB_OUTPUT" + fi + python_tests: + needs: changes + if: ${{ needs.changes.outputs.python == 'true' }} name: tests runs-on: ubuntu-latest @@ -46,10 +81,18 @@ jobs: run: go tool -modfile=tools/task/go.mod task pydabs-test python_linters: + needs: changes + if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }} name: lint runs-on: ubuntu-latest steps: + - name: Fail if change detection did not succeed + if: ${{ needs.changes.result != 'success' }} + run: | + echo "Python change detection did not succeed" + exit 1 + - name: Checkout repository and submodules uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -67,6 +110,8 @@ jobs: run: go tool -modfile=tools/task/go.mod task pydabs-lint python_docs: + needs: changes + if: ${{ needs.changes.outputs.python == 'true' }} name: docs runs-on: ubuntu-latest From 412fe3e35747de1246db9d450be23b696c434d1f Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 1 Oct 2026 17:09:09 +0200 Subject: [PATCH 2/3] Fail Python jobs when change detection fails --- .github/workflows/python_push.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python_push.yml b/.github/workflows/python_push.yml index 8a8a7eb5dab..7e828ad901c 100644 --- a/.github/workflows/python_push.yml +++ b/.github/workflows/python_push.yml @@ -8,11 +8,8 @@ on: merge_group: types: [checks_requested] push: - # Always run on push to main. The build cache can only be reused - # if it was saved by a run from the repository's default branch. - # The run result will be identical to that from the merge queue - # because the commit is identical, yet we need to perform it to - # seed the build cache. + # Run relevant Python jobs on main to seed build caches that can be reused + # by pull request and merge queue runs. branches: - main @@ -53,7 +50,7 @@ jobs: python_tests: needs: changes - if: ${{ needs.changes.outputs.python == 'true' }} + if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }} name: tests runs-on: ubuntu-latest @@ -63,6 +60,12 @@ jobs: pyVersion: ['3.10', '3.11', '3.12', '3.13'] steps: + - name: Fail if change detection did not succeed + if: ${{ needs.changes.result != 'success' }} + run: | + echo "Python change detection did not succeed" + exit 1 + - name: Checkout repository and submodules uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -111,11 +114,17 @@ jobs: python_docs: needs: changes - if: ${{ needs.changes.outputs.python == 'true' }} + if: ${{ always() && (needs.changes.result != 'success' || needs.changes.outputs.python == 'true') }} name: docs runs-on: ubuntu-latest steps: + - name: Fail if change detection did not succeed + if: ${{ needs.changes.result != 'success' }} + run: | + echo "Python change detection did not succeed" + exit 1 + - name: Checkout repository and submodules uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 From 71e15a9b7964da14ed97b5e8a64a4a77f6bddae3 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Mon, 5 Oct 2026 09:58:30 +0200 Subject: [PATCH 3/3] Run Python tests for acceptance fixtures --- .github/workflows/python_push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python_push.yml b/.github/workflows/python_push.yml index 7e828ad901c..1a391719665 100644 --- a/.github/workflows/python_push.yml +++ b/.github/workflows/python_push.yml @@ -36,6 +36,7 @@ jobs: changed_files=$(git diff --name-only "$BASE_SHA...$HEAD_SHA" -- \ .github/workflows/python_push.yml \ Taskfile.yml \ + acceptance/bundle/python/ \ go.mod \ go.sum \ libs/dyn/dynvar/testdata/reference_vectors.json \