135 lines
4.1 KiB
YAML
135 lines
4.1 KiB
YAML
name: MLU CI Reliability Report
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/mlu-ci-reliability-report.yml'
|
|
- 'scripts/ci/utils/mlu_ci_reliability_report.py'
|
|
- 'scripts/ci/utils/test_mlu_ci_reliability_report.py'
|
|
schedule:
|
|
- cron: '17 0 * * 1' # Every Monday at 00:17 UTC
|
|
workflow_dispatch:
|
|
inputs:
|
|
days:
|
|
description: 'Number of days to include (1-30; result artifacts are retained for 30 days)'
|
|
required: false
|
|
default: '7'
|
|
type: string
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: mlu-ci-reliability-report-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Checkout reporter tests
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Test MLU CI reliability reporter
|
|
run: python -m unittest discover -s scripts/ci/utils -p 'test_mlu_ci_reliability_report.py'
|
|
|
|
report:
|
|
needs: test
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
env:
|
|
REPORT_DAYS: ${{ inputs.days || '7' }}
|
|
steps:
|
|
- name: Checkout trusted reporter
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Build MLU CI reliability report
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
end_time_args=()
|
|
if [[ "${GITHUB_EVENT_NAME}" == "schedule" ]]; then
|
|
end_time_args=(--end-time "$(date -u +%Y-%m-%dT%H:00:00Z)")
|
|
fi
|
|
python scripts/ci/utils/mlu_ci_reliability_report.py \
|
|
--repo "${GITHUB_REPOSITORY}" \
|
|
--event all \
|
|
--days "${REPORT_DAYS}" \
|
|
"${end_time_args[@]}" \
|
|
--output mlu-ci-reliability.md \
|
|
--json-output mlu-ci-reliability.json
|
|
cat mlu-ci-reliability.md >> "${GITHUB_STEP_SUMMARY}"
|
|
|
|
- name: Upload report data
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: mlu-ci-reliability-${{ github.run_id }}
|
|
path: |
|
|
mlu-ci-reliability.md
|
|
mlu-ci-reliability.json
|
|
retention-days: 30
|
|
if-no-files-found: error
|
|
|
|
publish:
|
|
needs: report
|
|
if: ${{ github.repository == 'sgl-project/sglang' && github.ref == 'refs/heads/main' }}
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
actions: read
|
|
issues: write
|
|
steps:
|
|
- name: Download report data
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: mlu-ci-reliability-${{ github.run_id }}
|
|
path: report-data
|
|
|
|
- name: Update report in the tracking issue
|
|
uses: actions/github-script@v8
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const marker = '<!-- mlu-ci-reliability-report -->';
|
|
const body = fs.readFileSync('report-data/mlu-ci-reliability.md', 'utf8');
|
|
if (!body.includes(marker)) {
|
|
throw new Error('Report is missing its comment marker');
|
|
}
|
|
const issue = { ...context.repo, issue_number: 42935 };
|
|
const comments = await github.paginate(github.rest.issues.listComments, {
|
|
...issue,
|
|
per_page: 100,
|
|
});
|
|
const existing = comments.find(comment =>
|
|
comment.user?.login === 'github-actions[bot]' &&
|
|
comment.user?.type === 'Bot' &&
|
|
comment.body?.includes(marker)
|
|
);
|
|
if (existing) {
|
|
await github.rest.issues.updateComment({
|
|
...context.repo,
|
|
comment_id: existing.id,
|
|
body,
|
|
});
|
|
} else {
|
|
await github.rest.issues.createComment({ ...issue, body });
|
|
}
|