Skip to content

Commit 7c4c3dd

Browse files
authored
CI - Fix the merge queue (#3571)
# Description of Changes The merge queue was (partly) getting borked because we were putting all non-PR CI events into the same concurrency group, which meant they all non-PR CI jobs would run sequentially instead of running in parallel. This sometimes caused _painfully_ long delays in the merge queue. This was due to my misunderstanding in #3501 (comment), where I didn't realize that `cancel-in-progress: false` would cause everything to queue up. Now, for non-PR events, we append the commit SHA to the concurrency group. For merge queue events, this should be the SHA of the ephemeral merge commit that GH creates, so it will never conflict. For push events or manual workflow dispatch events, the SHA should be a sane way to recognize/cancel redundant events. # API and ABI breaking changes None. CI-only change. # Expected complexity level and risk 1 # Testing - [x] PR CI passes on this PR - [x] PR CI is still canceled on this PR if a new commit is pushed Unfortunately it's hard to test the behavior for non-PR events without merging and seeing if it works. --------- Co-authored-by: Zeke Foppa <[email protected]>
1 parent 09828ee commit 7c4c3dd

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ on:
1414
name: CI
1515

1616
concurrency:
17-
# When a PR number isn't available, the event won't be a `pull_request` event so it won't matter.
18-
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
19-
# Only cancel when the event is a pull_request
20-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.inputs.pr_number || format('sha-%s', github.sha) }}
18+
cancel-in-progress: true
2119

2220
jobs:
2321
docker_smoketests:

.github/workflows/csharp-test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ on:
77
pull_request:
88

99
concurrency:
10-
# When a PR number isn't available, the event won't be a `pull_request` event so it won't matter.
11-
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
12-
# Only cancel when the event is a pull_request
13-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-%s', github.sha) }}
11+
cancel-in-progress: true
1412

1513
jobs:
1614
unity-testsuite:

.github/workflows/internal-tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ permissions:
1010
contents: read
1111

1212
concurrency:
13-
# When a PR number isn't available, the event won't be a `pull_request` event so it won't matter.
14-
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
15-
# Only cancel when the event is a pull_request
16-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-%s', github.sha) }}
14+
cancel-in-progress: true
1715

1816
jobs:
1917
run-tests:

.github/workflows/typescript-test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ on:
88
merge_group:
99

1010
concurrency:
11-
# When a PR number isn't available, the event won't be a `pull_request` event so it won't matter.
12-
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
13-
# Only cancel when the event is a pull_request
14-
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || format('sha-%s', github.sha) }}
12+
cancel-in-progress: true
1513

1614
jobs:
1715
build-and-test:

0 commit comments

Comments
 (0)