mirror of
https://github.com/linkedin/Liger-Kernel.git
synced 2026-10-12 02:17:47 +00:00
Moving unit testing to a merge queue. (#1069)
## Summary <!--- This is a required section; please describe the main purpose of this proposed code change. ---> <!--- ## Details This is an optional section; is there anything specific that reviewers should be aware of? ---> Moving unit testing to a merge queue. ## Testing Done <!--- This is a required section; please describe how this change was tested. ---> <!-- Replace BLANK with your device type. For example, A100-80G-PCIe Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. --> Not applicable, workflow change. - Hardware Type: <BLANK> - [x] run `make test` to ensure correctness - [x] run `make checkstyle` to ensure code style - [x] run `make test-convergence` to ensure convergence
This commit is contained in:
@@ -13,11 +13,14 @@ on:
|
||||
paths:
|
||||
- "src/**"
|
||||
- "test/**"
|
||||
merge_group:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: # Enables manual trigger
|
||||
|
||||
concurrency:
|
||||
# This causes it to cancel previous in-progress actions on the same PR / branch,
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -13,11 +13,14 @@ on:
|
||||
paths:
|
||||
- "src/**"
|
||||
- "test/**"
|
||||
merge_group:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: # Enables manual trigger
|
||||
|
||||
concurrency:
|
||||
# This causes it to cancel previous in-progress actions on the same PR / branch,
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
name: Merge Queue Failure Handler
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["NVIDIA GPU"]
|
||||
types: [completed]
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
handle-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
github.event.workflow_run.conclusion == 'failure' &&
|
||||
github.event.workflow_run.event == 'merge_group'
|
||||
|
||||
steps:
|
||||
- name: Extract PR number from merge group
|
||||
id: extract-pr
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const headRef = '${{ github.event.workflow_run.head_branch }}';
|
||||
// Merge group branch format: gh-readonly-queue/main/pr-{number}-{sha}
|
||||
const match = headRef.match(/pr-(\d+)-/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
return null;
|
||||
result-encoding: string
|
||||
|
||||
- name: Comment on PR
|
||||
if: steps.extract-pr.outputs.result != 'null'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const prNumber = parseInt('${{ steps.extract-pr.outputs.result }}');
|
||||
const workflowName = '${{ github.event.workflow_run.name }}';
|
||||
const runUrl = '${{ github.event.workflow_run.html_url }}';
|
||||
|
||||
// Check if PR exists and is open
|
||||
try {
|
||||
const { data: pr } = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: prNumber
|
||||
});
|
||||
|
||||
// Add comment about merge queue failure
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: prNumber,
|
||||
body: `## ⚠️ Merge Queue Failed\n\nThe merge queue validation failed for this PR.\n\n**Failed Workflow:** ${workflowName}\n**Run Details:** ${runUrl}\n\nThe PR has been automatically removed from the merge queue. Please review the test failures and push fixes to re-attempt merging.`
|
||||
});
|
||||
|
||||
// If PR was somehow closed, reopen it
|
||||
if (pr.state === 'closed') {
|
||||
await github.rest.pulls.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: prNumber,
|
||||
state: 'open'
|
||||
});
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: prNumber,
|
||||
body: '🔄 This PR has been automatically reopened after merge queue failure.'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`Could not process PR #${prNumber}: ${error.message}`);
|
||||
}
|
||||
@@ -13,10 +13,13 @@ on:
|
||||
paths:
|
||||
- "src/**"
|
||||
- "test/**"
|
||||
merge_group:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: # Enables manual trigger
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
Reference in New Issue
Block a user