Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
86 lines
2.5 KiB
YAML
86 lines
2.5 KiB
YAML
name: CI Auto Bisect
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["PR Test"]
|
|
types: [completed]
|
|
branches: [main]
|
|
workflow_dispatch: {}
|
|
|
|
concurrency:
|
|
group: ci-auto-bisect
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: read
|
|
|
|
jobs:
|
|
auto-bisect:
|
|
# Only run for scheduled pr-test completions (not PR-triggered), or manual dispatch
|
|
if: >
|
|
github.repository == 'sgl-project/sglang' && (
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event.workflow_run.event == 'schedule' &&
|
|
github.event.workflow_run.conclusion != 'cancelled')
|
|
)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Full history needed for git log between SHAs
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.14'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install requests anthropic
|
|
|
|
- name: Run Auto Bisect
|
|
id: bisect
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT_FOR_NIGHTLY_CI_DATA }}
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
PYTHONUNBUFFERED: 1
|
|
PYTHONIOENCODING: utf-8
|
|
run: |
|
|
cd scripts/ci_monitor
|
|
python ci_auto_bisect.py \
|
|
--github-token $GITHUB_TOKEN \
|
|
--anthropic-api-key $ANTHROPIC_API_KEY \
|
|
--output bisect_results.json \
|
|
--max-failures 10
|
|
|
|
- name: Upload Bisect Results
|
|
if: always() && hashFiles('scripts/ci_monitor/bisect_results.json') != ''
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ci-auto-bisect-${{ github.run_number }}
|
|
path: scripts/ci_monitor/bisect_results.json
|
|
retention-days: 14
|
|
|
|
- name: Post to Slack
|
|
if: always()
|
|
env:
|
|
SGLANG_DIFFUSION_SLACK_TOKEN: ${{ secrets.SGLANG_DIFFUSION_SLACK_TOKEN }}
|
|
run: |
|
|
cd scripts/ci_monitor
|
|
|
|
# Report if the bisect step itself failed
|
|
if [ "${{ steps.bisect.outcome }}" = "failure" ]; then
|
|
echo "::error::Auto bisect analysis failed - check logs above"
|
|
fi
|
|
|
|
if [ -f bisect_results.json ] && [ -n "$SGLANG_DIFFUSION_SLACK_TOKEN" ]; then
|
|
pip install slack_sdk
|
|
python3 post_bisect_to_slack.py --report-file bisect_results.json
|
|
else
|
|
echo "Bisect results or Slack token not available, skipping notification"
|
|
fi
|