From 897e2e3b6c62ef1c42b179ea9b52a36be3d1333a Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sat, 12 Sep 2026 18:44:42 +0900 Subject: [PATCH 1/2] gh-actions: Reduce CI for draft pull requests --- .github/workflows/jit.yml | 5 ++ .github/workflows/mypy.yml | 2 + .github/workflows/ready-for-review.yml | 20 ++++++++ .github/workflows/reusable-context.yml | 70 ++++++++++++++++++++++---- .github/workflows/tail-call.yml | 3 ++ 5 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/ready-for-review.yml diff --git a/.github/workflows/jit.yml b/.github/workflows/jit.yml index 813589c2bc14c8b..aeed41a7b5d2cc0 100644 --- a/.github/workflows/jit.yml +++ b/.github/workflows/jit.yml @@ -1,6 +1,7 @@ name: JIT on: pull_request: + types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] paths: &paths - '**jit**' - 'Python/bytecodes.c' @@ -47,6 +48,7 @@ jobs: ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3 windows: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }}) runs-on: ${{ matrix.runner }} @@ -87,6 +89,7 @@ jobs: ./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3 macos: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }}) runs-on: ${{ matrix.runner }} @@ -130,6 +133,7 @@ jobs: ./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3 linux: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }}) runs-on: ${{ matrix.runner }} @@ -168,6 +172,7 @@ jobs: ./python -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3 linux-extras: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.name }} runs-on: ubuntu-26.04 diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 3cdce4f5952e3d0..ff1dbd33cabc02f 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -6,6 +6,7 @@ on: branches: - main pull_request: + types: [opened, synchronize, reopened, ready_for_review] paths: - ".github/workflows/mypy.yml" - "Lib/_colorize.py" @@ -48,6 +49,7 @@ concurrency: jobs: mypy: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: Run mypy on ${{ matrix.target }} runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/.github/workflows/ready-for-review.yml b/.github/workflows/ready-for-review.yml new file mode 100644 index 000000000000000..e28c536404a02ff --- /dev/null +++ b/.github/workflows/ready-for-review.yml @@ -0,0 +1,20 @@ +name: Full tests when ready for review + +on: + pull_request: + types: [ready_for_review] + +permissions: + actions: write + contents: read + +jobs: + dispatch-tests: + name: Dispatch full test matrix + runs-on: ubuntu-latest + steps: + - name: Run Tests workflow on the PR branch + env: + GH_TOKEN: ${{ github.token }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} + run: gh workflow run build.yml --ref "$HEAD_REF" diff --git a/.github/workflows/reusable-context.yml b/.github/workflows/reusable-context.yml index c998cbff181dd12..c7f4a4a76489f03 100644 --- a/.github/workflows/reusable-context.yml +++ b/.github/workflows/reusable-context.yml @@ -60,17 +60,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 outputs: - run-android: ${{ steps.changes.outputs.run-android }} - run-ci-fuzz: ${{ steps.changes.outputs.run-ci-fuzz }} - run-ci-fuzz-stdlib: ${{ steps.changes.outputs.run-ci-fuzz-stdlib }} - run-docs: ${{ steps.changes.outputs.run-docs }} - run-ios: ${{ steps.changes.outputs.run-ios }} - run-macos: ${{ steps.changes.outputs.run-macos }} - run-tests: ${{ steps.changes.outputs.run-tests }} - run-ubuntu: ${{ steps.changes.outputs.run-ubuntu }} - run-emscripten: ${{ steps.changes.outputs.run-emscripten }} - run-wasi: ${{ steps.changes.outputs.run-wasi }} - run-windows-tests: ${{ steps.changes.outputs.run-windows-tests }} + run-android: ${{ steps.filtered.outputs.run-android }} + run-ci-fuzz: ${{ steps.filtered.outputs.run-ci-fuzz }} + run-ci-fuzz-stdlib: ${{ steps.filtered.outputs.run-ci-fuzz-stdlib }} + run-docs: ${{ steps.filtered.outputs.run-docs }} + run-ios: ${{ steps.filtered.outputs.run-ios }} + run-macos: ${{ steps.filtered.outputs.run-macos }} + run-tests: ${{ steps.filtered.outputs.run-tests }} + run-ubuntu: ${{ steps.filtered.outputs.run-ubuntu }} + run-emscripten: ${{ steps.filtered.outputs.run-emscripten }} + run-wasi: ${{ steps.filtered.outputs.run-wasi }} + run-windows-tests: ${{ steps.filtered.outputs.run-windows-tests }} steps: - name: Set up Python uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -123,3 +123,51 @@ jobs: GITHUB_EVENT_NAME: ${{ github.event_name }} CCF_TARGET_REF: ${{ github.base_ref || github.event.repository.default_branch }} CCF_HEAD_REF: ${{ github.event.pull_request.head.sha || github.sha }} + + # Draft PRs are still useful for early feedback, but running the complete + # platform matrix on every incremental push is unnecessarily expensive. + # Dedicated lightweight workflows (for example lint and JIT's interpreter + # build) can continue to run while these outputs suppress the full matrix. + - name: Filter draft PRs + id: filtered + shell: bash + run: | + if [[ "${DRAFT_PR}" == "true" ]]; then + value=false + echo "run-android=${value}" >> "$GITHUB_OUTPUT" + echo "run-ci-fuzz=${value}" >> "$GITHUB_OUTPUT" + echo "run-ci-fuzz-stdlib=${value}" >> "$GITHUB_OUTPUT" + echo "run-docs=${value}" >> "$GITHUB_OUTPUT" + echo "run-ios=${value}" >> "$GITHUB_OUTPUT" + echo "run-macos=${value}" >> "$GITHUB_OUTPUT" + echo "run-tests=${value}" >> "$GITHUB_OUTPUT" + echo "run-ubuntu=${value}" >> "$GITHUB_OUTPUT" + echo "run-emscripten=${value}" >> "$GITHUB_OUTPUT" + echo "run-wasi=${value}" >> "$GITHUB_OUTPUT" + echo "run-windows-tests=${value}" >> "$GITHUB_OUTPUT" + else + echo "run-android=${RUN_ANDROID}" >> "$GITHUB_OUTPUT" + echo "run-ci-fuzz=${RUN_CI_FUZZ}" >> "$GITHUB_OUTPUT" + echo "run-ci-fuzz-stdlib=${RUN_CI_FUZZ_STDLIB}" >> "$GITHUB_OUTPUT" + echo "run-docs=${RUN_DOCS}" >> "$GITHUB_OUTPUT" + echo "run-ios=${RUN_IOS}" >> "$GITHUB_OUTPUT" + echo "run-macos=${RUN_MACOS}" >> "$GITHUB_OUTPUT" + echo "run-tests=${RUN_TESTS}" >> "$GITHUB_OUTPUT" + echo "run-ubuntu=${RUN_UBUNTU}" >> "$GITHUB_OUTPUT" + echo "run-emscripten=${RUN_EMSCRIPTEN}" >> "$GITHUB_OUTPUT" + echo "run-wasi=${RUN_WASI}" >> "$GITHUB_OUTPUT" + echo "run-windows-tests=${RUN_WINDOWS_TESTS}" >> "$GITHUB_OUTPUT" + fi + env: + DRAFT_PR: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft }} + RUN_ANDROID: ${{ steps.changes.outputs.run-android }} + RUN_CI_FUZZ: ${{ steps.changes.outputs.run-ci-fuzz }} + RUN_CI_FUZZ_STDLIB: ${{ steps.changes.outputs.run-ci-fuzz-stdlib }} + RUN_DOCS: ${{ steps.changes.outputs.run-docs }} + RUN_IOS: ${{ steps.changes.outputs.run-ios }} + RUN_MACOS: ${{ steps.changes.outputs.run-macos }} + RUN_TESTS: ${{ steps.changes.outputs.run-tests }} + RUN_UBUNTU: ${{ steps.changes.outputs.run-ubuntu }} + RUN_EMSCRIPTEN: ${{ steps.changes.outputs.run-emscripten }} + RUN_WASI: ${{ steps.changes.outputs.run-wasi }} + RUN_WINDOWS_TESTS: ${{ steps.changes.outputs.run-windows-tests }} diff --git a/.github/workflows/tail-call.yml b/.github/workflows/tail-call.yml index 81e8235f236ea70..fade1cd7d5e810c 100644 --- a/.github/workflows/tail-call.yml +++ b/.github/workflows/tail-call.yml @@ -1,6 +1,7 @@ name: Tail calling interpreter on: pull_request: + types: [opened, synchronize, reopened, ready_for_review] paths: &paths - '.github/workflows/tail-call.yml' - 'Python/bytecodes.c' @@ -24,6 +25,7 @@ env: jobs: macos: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.target }} runs-on: ${{ matrix.runner }} timeout-minutes: 60 @@ -58,6 +60,7 @@ jobs: ./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3 linux: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false name: ${{ matrix.target }} runs-on: ${{ matrix.runner }} timeout-minutes: 60 From ace25f234cb6c606bd5c29224be2854b797008e0 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sat, 12 Sep 2026 18:53:20 +0900 Subject: [PATCH 2/2] gh-actions: Drop converted_to_draft trigger --- .github/workflows/jit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jit.yml b/.github/workflows/jit.yml index aeed41a7b5d2cc0..1f1945b9c93c8a0 100644 --- a/.github/workflows/jit.yml +++ b/.github/workflows/jit.yml @@ -1,7 +1,7 @@ name: JIT on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] + types: [opened, synchronize, reopened, ready_for_review] paths: &paths - '**jit**' - 'Python/bytecodes.c'