Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: End-to-End Tests
run-name: e2e Test - ${{ inputs.test-name || github.event.inputs.generate-cli-command }}
run-name: e2e Test - ${{ inputs.test-name || inputs.generate-cli-command || github.event.inputs.generate-cli-command }}

on:
workflow_dispatch:
Expand All @@ -12,21 +12,47 @@ on:
description: "Name for this test run"
required: false
type: string
ref:
description: "Ref (branch/sha) to checkout for generating configs"
required: false
type: string
workflow_call:
inputs:
generate-cli-command:
description: "Command passed to generate matrix script"
required: true
type: string
test-name:
description: "Name for this test run"
required: false
type: string
ref:
description: "Ref (branch/sha) to checkout for generating configs"
required: false
type: string

jobs:
get-jobs:
runs-on: ubuntu-latest
outputs:
search-space-config: ${{ steps.get-jobs.outputs.search-space-config }}
environment: bryan-test
steps:
- name: Checkout code
- name: Checkout code (ref)
if: ${{ inputs.ref && inputs.ref != '' }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ inputs.ref }}

- name: Checkout code (default)
if: ${{ !inputs.ref || inputs.ref == '' }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- id: get-jobs
run: |
pip install pydantic
CONFIG_JSON=$(python3 ${GITHUB_WORKSPACE}/utils/matrix_logic/generate_sweep_configs.py \
${{ inputs.generate-cli-command }} \
${{ inputs.generate-cli-command || github.event.inputs.generate-cli-command }} \
--runner-config .github/configs/runners.yaml \
--config-files .github/configs/nvidia-master.yaml .github/configs/amd-master.yaml)
echo "search-space-config=$CONFIG_JSON" >> $GITHUB_OUTPUT
Expand Down
126 changes: 126 additions & 0 deletions .github/workflows/pr-comment-sweep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Slash Command Sweep

on:
# PR comment trigger
issue_comment:
types: [created]
# Manual trigger
workflow_dispatch:
inputs:
pr-number:
description: PR number to checkout (refs/pull/<num>/head)
required: false
type: string
generator-args:
description: Args passed to generate_sweep_configs.py (omit /sweep)
required: false
type: string
# Push-based example/testing
push:
branches-ignore:
- main
- master

concurrency:
group: ${{ github.event.issue.number && format('PR-SWEEP-{0}', github.event.issue.number) || format('REF-SWEEP-{0}', github.ref_name) }}
cancel-in-progress: true

permissions:
contents: read

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
pr-number: ${{ steps.parse.outputs.pr-number || steps.resolve.outputs.pr-number }}
generator-args: ${{ steps.parse.outputs.generator-args || steps.resolve.outputs.generator-args }}
steps:
- name: Parse PR comment (/sweep ...)
id: parse
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/sweep') }}
shell: bash
env:
BODY: ${{ github.event.comment.body }}
PR_NUMBER: ${{ github.event.issue.number }}
run: |
set -euo pipefail
# Allow optional leading whitespace before /sweep
Comment thread
cquil11 marked this conversation as resolved.
Outdated
cmd_line=$(printf "%s" "$BODY" | awk '/^[[:space:]]*\/sweep/{print; exit}')
if [[ -z "$cmd_line" ]]; then
echo "No /sweep command found in comment" >&2
exit 1
fi
# Trim leading spaces then strip the /sweep prefix
cmd_line=$(echo "$cmd_line" | sed 's/^[[:space:]]*//')
if [[ "$cmd_line" == "/sweep" ]]; then
cmd_args=""
else
cmd_args=${cmd_line#/sweep}
fi
cmd_args=$(echo "$cmd_args" | xargs || true)

echo "generator-args=$cmd_args" >> "$GITHUB_OUTPUT"
echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT"

- name: Find PR for this branch (if any)
id: find
if: ${{ github.event_name != 'issue_comment' }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const branch = context.ref.replace('refs/heads/', '');
const res = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${branch}` });
const num = res.data[0]?.number ? String(res.data[0].number) : '';
core.setOutput('pr-number', num);

- name: Prepare inputs (push/dispatch)
id: resolve
if: ${{ github.event_name != 'issue_comment' }}
shell: bash
env:
DISPATCH_PR: ${{ github.event.inputs.pr-number }}
DISPATCH_ARGS: ${{ github.event.inputs.generator-args }}
run: |
set -euo pipefail
pr_from_branch='${{ steps.find.outputs.pr-number }}'
pr_number="${DISPATCH_PR:-}"; if [[ -z "$pr_number" ]]; then pr_number="$pr_from_branch"; fi
gen_args="${DISPATCH_ARGS:-}"
if [[ -z "$gen_args" ]]; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no default
should just fail in this case

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default(gen_args='full-sweep --sin...) is for testing, will remove when ready to merge

gen_args='full-sweep --single-node --runner-type h200 --model-prefix dsr1 --seq-lens 1k1k --max-conc 4'
fi
echo "Resolved PR: $pr_number";
echo "Using generator args: $gen_args";
echo "pr-number=$pr_number" >> "$GITHUB_OUTPUT"
echo "generator-args=$gen_args" >> "$GITHUB_OUTPUT"

call-e2e-pr:
needs: prepare
if: ${{ github.event_name == 'issue_comment' && needs.prepare.outputs.pr-number != '' && needs.prepare.outputs.generator-args != '' }}
uses: ./.github/workflows/e2e-tests.yml
name: Run E2E (PR comment)
secrets: inherit
with:
generate-cli-command: ${{ needs.prepare.outputs.generator-args }}
test-name: PR #${{ needs.prepare.outputs.pr-number }} sweep
ref: refs/pull/${{ needs.prepare.outputs.pr-number }}/head

call-e2e-nonpr:
needs: prepare
if: ${{ github.event_name != 'issue_comment' && needs.prepare.outputs.generator-args != '' }}
uses: ./.github/workflows/e2e-tests.yml
name: Run E2E (manual/push)
secrets: inherit
with:
generate-cli-command: ${{ needs.prepare.outputs.generator-args }}
test-name: Manual/Push sweep
ref: ${{ needs.prepare.outputs.pr-number && format('refs/pull/{0}/head', needs.prepare.outputs.pr-number) || '' }}

note-ignored:
# Inform when comment doesn't meet criteria (non-PR or not a /sweep)
if: ${{ github.event_name == 'issue_comment' && (!github.event.issue.pull_request || !startsWith(github.event.comment.body, '/sweep')) }}
runs-on: ubuntu-latest
steps:
- run: |
echo "Comment ignored. Either not on a PR or not a /sweep command. For PR comments, runs require environment approval."
Loading