From b7abc04e0931de0d9a7a9f6ab21b03093514ac76 Mon Sep 17 00:00:00 2001 From: Guoxin Sui Date: Thu, 26 Nov 2026 11:28:51 -0700 Subject: [PATCH 1/5] CI/CD - Cancel superseded PR runs and skip draft/merge jobs Cancel superseded pull-request workflow runs while allowing active main/release builds to finish updating registry caches and folding queued commits. Skip PR validation on draft pull requests (re-triggering automatically on ready_for_review) across GitHub Actions and Azure Pipelines, and skip the no-op docker-merge jobs on pull requests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .azure-pipelines/ansible-integration-test.yml | 8 ++++++++ .azure-pipelines/cpu-unit-test.yml | 8 ++++++++ .azure-pipelines/cuda-unit-test.yml | 8 ++++++++ .github/workflows/build-image.yml | 13 ++++++++++++- .github/workflows/codeql-analysis.yml | 12 ++++++++++++ .github/workflows/gh-pages.yml | 11 +++++++++++ .github/workflows/lint.yml | 12 ++++++++++++ 7 files changed, 71 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/ansible-integration-test.yml b/.azure-pipelines/ansible-integration-test.yml index 9c8550966..004684a0e 100644 --- a/.azure-pipelines/ansible-integration-test.yml +++ b/.azure-pipelines/ansible-integration-test.yml @@ -5,6 +5,14 @@ trigger: - main - release/* +pr: + autoCancel: true + drafts: false + branches: + include: + - main + - release/* + pool: name: SuperBench CI demands: ansible-agent diff --git a/.azure-pipelines/cpu-unit-test.yml b/.azure-pipelines/cpu-unit-test.yml index ee71e4956..b0bd75b42 100644 --- a/.azure-pipelines/cpu-unit-test.yml +++ b/.azure-pipelines/cpu-unit-test.yml @@ -5,6 +5,14 @@ trigger: - main - release/* +pr: + autoCancel: true + drafts: false + branches: + include: + - main + - release/* + strategy: matrix: python-3.7: diff --git a/.azure-pipelines/cuda-unit-test.yml b/.azure-pipelines/cuda-unit-test.yml index be06491e8..5ebbfb516 100644 --- a/.azure-pipelines/cuda-unit-test.yml +++ b/.azure-pipelines/cuda-unit-test.yml @@ -5,6 +5,14 @@ trigger: - main - release/* +pr: + autoCancel: true + drafts: false + branches: + include: + - main + - release/* + pool: name: SuperBench CI demands: cuda-agent diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 57f837fcf..e6bb42d3e 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -9,16 +9,27 @@ on: branches: - main - release/* + types: + - opened + - synchronize + - reopened + - ready_for_review + - converted_to_draft release: types: - published workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + env: BUILDKIT_IMAGE: mcr.microsoft.com/oss/v2/moby/buildkit:v0.33.1-6@sha256:0bf1f35cb440e6f19c2e154ed007d798c206ad899c9495a2f8e9276eebfaaf69 jobs: docker-build: + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} name: Docker build ${{ matrix.name }} runs-on: ${{ matrix.runner }} timeout-minutes: 1200 @@ -193,7 +204,7 @@ jobs: run: echo ${{ steps.docker_build.outputs.digest }} docker-merge: needs: docker-build - if: ${{ !cancelled() }} + if: ${{ !cancelled() && github.event_name != 'pull_request' }} name: Docker merge ${{ matrix.name }} runs-on: self-hosted timeout-minutes: 300 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c389223b4..abd0de48b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,11 +9,22 @@ on: branches: - main - release/* + types: + - opened + - synchronize + - reopened + - ready_for_review + - converted_to_draft schedule: - cron: "30 1 * * 1" +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: analyze: + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} name: CodeQL analyze ${{ matrix.language }} runs-on: ubuntu-latest permissions: @@ -38,6 +49,7 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2 analyze-cpp: + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} name: CodeQL analyze cpp runs-on: ubuntu-latest container: diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 602011003..21785036f 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -8,9 +8,20 @@ on: branches: - main - release/* + types: + - opened + - synchronize + - reopened + - ready_for_review + - converted_to_draft + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: docs-build: + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7b371a1ee..6bec30866 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,9 +5,20 @@ on: branches: - main - release/* + types: + - opened + - synchronize + - reopened + - ready_for_review + - converted_to_draft + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: spelling: + if: ${{ !github.event.pull_request.draft }} name: Spelling check runs-on: ubuntu-latest steps: @@ -20,6 +31,7 @@ jobs: - name: Check spelling run: misspell -error . cpp: + if: ${{ !github.event.pull_request.draft }} name: CPP code lint runs-on: ubuntu-24.04 steps: From fc469cc29b7efc840908749d507b75261b7b501c Mon Sep 17 00:00:00 2001 From: Guoxin Sui Date: Thu, 26 Nov 2026 13:16:04 -0700 Subject: [PATCH 2/5] CI/CD - Cancel PR builds on close and keep fast checks on drafts Cancel in-progress Build Image runs when a pull request is merged or closed; otherwise non-required jobs such as rocm6.4 keep a self-hosted runner after merge (about 4.75 h on #894). Keep spelling, C++ lint and docs-build running on drafts: they are fast GitHub-hosted required checks, and catching their failures early avoids restarting image builds after ready_for_review. Restore Azure PR validation for every target branch so stacked pull requests keep unit tests, and document the push-run ordering trade-off next to the concurrency block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .azure-pipelines/ansible-integration-test.yml | 3 +-- .azure-pipelines/cpu-unit-test.yml | 3 +-- .azure-pipelines/cuda-unit-test.yml | 3 +-- .github/workflows/build-image.yml | 7 ++++++- .github/workflows/gh-pages.yml | 7 ------- .github/workflows/lint.yml | 8 -------- 6 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.azure-pipelines/ansible-integration-test.yml b/.azure-pipelines/ansible-integration-test.yml index 004684a0e..9133dea21 100644 --- a/.azure-pipelines/ansible-integration-test.yml +++ b/.azure-pipelines/ansible-integration-test.yml @@ -10,8 +10,7 @@ pr: drafts: false branches: include: - - main - - release/* + - '*' pool: name: SuperBench CI diff --git a/.azure-pipelines/cpu-unit-test.yml b/.azure-pipelines/cpu-unit-test.yml index b0bd75b42..e004a2fb0 100644 --- a/.azure-pipelines/cpu-unit-test.yml +++ b/.azure-pipelines/cpu-unit-test.yml @@ -10,8 +10,7 @@ pr: drafts: false branches: include: - - main - - release/* + - '*' strategy: matrix: diff --git a/.azure-pipelines/cuda-unit-test.yml b/.azure-pipelines/cuda-unit-test.yml index 5ebbfb516..5725ffaf2 100644 --- a/.azure-pipelines/cuda-unit-test.yml +++ b/.azure-pipelines/cuda-unit-test.yml @@ -10,8 +10,7 @@ pr: drafts: false branches: include: - - main - - release/* + - '*' pool: name: SuperBench CI diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index e6bb42d3e..960a73e12 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -15,11 +15,16 @@ on: - reopened - ready_for_review - converted_to_draft + - closed release: types: - published workflow_dispatch: +# Cancel superseded pull request runs, including when a PR becomes a draft or is +# closed; PR builds never push images or caches. Other events never cancel an +# in-progress run, so images publish in commit order: a newer run for the same +# ref waits, and only the latest waiting run is kept. concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} @@ -29,7 +34,7 @@ env: jobs: docker-build: - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} + if: ${{ github.event_name != 'pull_request' || (github.event.action != 'closed' && !github.event.pull_request.draft) }} name: Docker build ${{ matrix.name }} runs-on: ${{ matrix.runner }} timeout-minutes: 1200 diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 21785036f..48eee4d6c 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -8,12 +8,6 @@ on: branches: - main - release/* - types: - - opened - - synchronize - - reopened - - ready_for_review - - converted_to_draft concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} @@ -21,7 +15,6 @@ concurrency: jobs: docs-build: - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6bec30866..9d26183fe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,12 +5,6 @@ on: branches: - main - release/* - types: - - opened - - synchronize - - reopened - - ready_for_review - - converted_to_draft concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} @@ -18,7 +12,6 @@ concurrency: jobs: spelling: - if: ${{ !github.event.pull_request.draft }} name: Spelling check runs-on: ubuntu-latest steps: @@ -31,7 +24,6 @@ jobs: - name: Check spelling run: misspell -error . cpp: - if: ${{ !github.event.pull_request.draft }} name: CPP code lint runs-on: ubuntu-24.04 steps: From 0aaa8e1ff28ad95add0778b195c30be2900148ec Mon Sep 17 00:00:00 2001 From: Guoxin Sui Date: Thu, 26 Nov 2026 15:04:46 -0700 Subject: [PATCH 3/5] CI/CD - Clarify run ordering in image build concurrency comment GitHub processes runs in a concurrency group first-in-first-out by the time each starts waiting and does not guarantee dispatch order, so describe one-at-a-time execution per event and ref instead of promising commit-order image publication. Addresses Copilot review feedback on #906. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 960a73e12..77051aaa1 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -23,8 +23,8 @@ on: # Cancel superseded pull request runs, including when a PR becomes a draft or is # closed; PR builds never push images or caches. Other events never cancel an -# in-progress run, so images publish in commit order: a newer run for the same -# ref waits, and only the latest waiting run is kept. +# in-progress run: runs for the same event and ref execute one at a time, and +# only the most recently queued waiting run is kept. concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} From e997fb93a48759bc136a6d6c6c2397f966dadaf9 Mon Sep 17 00:00:00 2001 From: Guoxin Sui Date: Thu, 26 Nov 2026 15:14:40 -0700 Subject: [PATCH 4/5] CI/CD - Align PR branch filters and simplify draft job guards Use main and release/* as the pull request target branches for the Azure pipelines, matching every GitHub workflow. Shorten the build-image concurrency comment, and drop the explicit event check from the draft and closed job guards: push, release, dispatch and schedule events have no pull request fields, which evaluate to empty strings, so the shorter conditions make the same decisions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .azure-pipelines/ansible-integration-test.yml | 3 ++- .azure-pipelines/cpu-unit-test.yml | 3 ++- .azure-pipelines/cuda-unit-test.yml | 3 ++- .github/workflows/build-image.yml | 7 ++----- .github/workflows/codeql-analysis.yml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/ansible-integration-test.yml b/.azure-pipelines/ansible-integration-test.yml index 9133dea21..004684a0e 100644 --- a/.azure-pipelines/ansible-integration-test.yml +++ b/.azure-pipelines/ansible-integration-test.yml @@ -10,7 +10,8 @@ pr: drafts: false branches: include: - - '*' + - main + - release/* pool: name: SuperBench CI diff --git a/.azure-pipelines/cpu-unit-test.yml b/.azure-pipelines/cpu-unit-test.yml index e004a2fb0..b0bd75b42 100644 --- a/.azure-pipelines/cpu-unit-test.yml +++ b/.azure-pipelines/cpu-unit-test.yml @@ -10,7 +10,8 @@ pr: drafts: false branches: include: - - '*' + - main + - release/* strategy: matrix: diff --git a/.azure-pipelines/cuda-unit-test.yml b/.azure-pipelines/cuda-unit-test.yml index 5725ffaf2..5ebbfb516 100644 --- a/.azure-pipelines/cuda-unit-test.yml +++ b/.azure-pipelines/cuda-unit-test.yml @@ -10,7 +10,8 @@ pr: drafts: false branches: include: - - '*' + - main + - release/* pool: name: SuperBench CI diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 77051aaa1..f8e9e7648 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -21,10 +21,7 @@ on: - published workflow_dispatch: -# Cancel superseded pull request runs, including when a PR becomes a draft or is -# closed; PR builds never push images or caches. Other events never cancel an -# in-progress run: runs for the same event and ref execute one at a time, and -# only the most recently queued waiting run is kept. +# Cancel superseded pull request runs; other events wait for the running one. concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} @@ -34,7 +31,7 @@ env: jobs: docker-build: - if: ${{ github.event_name != 'pull_request' || (github.event.action != 'closed' && !github.event.pull_request.draft) }} + if: ${{ !github.event.pull_request.draft && github.event.action != 'closed' }} name: Docker build ${{ matrix.name }} runs-on: ${{ matrix.runner }} timeout-minutes: 1200 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index abd0de48b..aed2c4643 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,7 +24,7 @@ concurrency: jobs: analyze: - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} + if: ${{ !github.event.pull_request.draft }} name: CodeQL analyze ${{ matrix.language }} runs-on: ubuntu-latest permissions: @@ -49,7 +49,7 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2 analyze-cpp: - if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} + if: ${{ !github.event.pull_request.draft }} name: CodeQL analyze cpp runs-on: ubuntu-latest container: From 6b402e799121913f607654469a1de5bcc2e8395b Mon Sep 17 00:00:00 2001 From: Guoxin Sui Date: Thu, 26 Nov 2026 15:40:31 -0700 Subject: [PATCH 5/5] CI/CD - Unify draft and close handling across workflows Give CodeQL the same pull_request activity types and job guard as the image build, so both workflows that skip drafts also cancel in-progress runs when a pull request is merged or closed. Drop the build-image-only comment so all four concurrency blocks are identical. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/build-image.yml | 1 - .github/workflows/codeql-analysis.yml | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index f8e9e7648..d1357cd36 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -21,7 +21,6 @@ on: - published workflow_dispatch: -# Cancel superseded pull request runs; other events wait for the running one. concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || format('{0}-{1}', github.event_name, github.ref) }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index aed2c4643..1d2ef33a4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -15,6 +15,7 @@ on: - reopened - ready_for_review - converted_to_draft + - closed schedule: - cron: "30 1 * * 1" @@ -24,7 +25,7 @@ concurrency: jobs: analyze: - if: ${{ !github.event.pull_request.draft }} + if: ${{ !github.event.pull_request.draft && github.event.action != 'closed' }} name: CodeQL analyze ${{ matrix.language }} runs-on: ubuntu-latest permissions: @@ -49,7 +50,7 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2 analyze-cpp: - if: ${{ !github.event.pull_request.draft }} + if: ${{ !github.event.pull_request.draft && github.event.action != 'closed' }} name: CodeQL analyze cpp runs-on: ubuntu-latest container: