-
Notifications
You must be signed in to change notification settings - Fork 462
compile-perf: Slack notification on scheduled runs + 10% regression threshold #11745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
101d131
ac2b2c3
365f2a8
1dc9815
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,8 +229,51 @@ jobs: | |
| # job. trend.py exits non-zero (job red + ::error:: annotations) when a | ||
| # primary timer drifts past threshold vs the trailing median. | ||
| - name: Check trend (fail on regression) | ||
| id: trend | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| cd "$GITHUB_WORKSPACE/tools/compile-perf" | ||
| python trend.py --results "$GITHUB_WORKSPACE/perf-results" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Gap: PR description names the wrong secret The workflow reads Suggestion: Update the PR description to name |
||
|
|
||
| - name: Notify Slack | ||
| if: github.event_name == 'schedule' && always() | ||
| shell: bash | ||
| env: | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMPILE_PERF }} | ||
| TREND_OUTCOME: ${{ steps.trend.outcome }} | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| run: | | ||
| if [ -z "$SLACK_WEBHOOK" ]; then | ||
| echo "SLACK_WEBHOOK_COMPILE_PERF not set; skipping Slack notification" | ||
| exit 0 | ||
| fi | ||
| DATE=$(date -u +%Y-%m-%d) | ||
| if [ "$TREND_OUTCOME" = "success" ]; then | ||
| ICON=":white_check_mark:" | ||
| STATUS="No regressions detected" | ||
| elif [ "$TREND_OUTCOME" = "failure" ]; then | ||
| ICON=":warning:" | ||
| STATUS="Regression detected — see CI run for details" | ||
| else | ||
| ICON=":x:" | ||
| STATUS="Nightly job failed — see CI run for details" | ||
| fi | ||
| python -c " | ||
| import json, os, urllib.request | ||
| payload = { | ||
| 'text': ( | ||
| f'{os.environ[\"ICON\"]} *Compile-perf nightly — {os.environ[\"DATE\"]}*\n' | ||
| f'{os.environ[\"STATUS\"]}\n' | ||
|
jvepsalainen-nv marked this conversation as resolved.
Outdated
|
||
| f'• Run: {os.environ[\"RUN_URL\"]}\n' | ||
| f'• Report: https://shader-slang.org/slang-compile-perf/ ' | ||
| f'(may take a few minutes to update after the run)' | ||
| ) | ||
| } | ||
| req = urllib.request.Request( | ||
| os.environ['SLACK_WEBHOOK'], | ||
| data=json.dumps(payload).encode(), | ||
| headers={'Content-Type': 'application/json'}) | ||
| urllib.request.urlopen(req, timeout=10) | ||
| print('Slack notification sent') | ||
| " | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Gap: New Slack step is unreachable in CI until the cron is re-enabled
The new step is gated
if: github.event_name == 'schedule' && always(), but theschedule:block at lines 14-15 of this same workflow is intentionally commented out, andworkflow_dispatchis explicitly excluded by the== 'schedule'check. Result: the entire Slack notification path — bash branch selection, inlinepython -c,urllib.urlopencall, payload JSON shape, secret-missing skip — has zero execution coverage in this PR and will continue to have zero coverage until someone uncomments the cron weeks or months later. A typo in the inline Python, an env-var name mismatch, or a payload-shape regression would surface only at that point, exactly when the nightly alert is supposed to start working.Example: If
os.environ["ICON"]were misspelled in the f-string, manualworkflow_dispatchruns would never catch it; the first scheduled run would fail silently (job log shows a Python KeyError, but no Slack message arrives) and the on-call user would assume "no regressions" instead of "alerting broken".Suggestion: Either (a) temporarily widen the gate to also fire on a tagged
workflow_dispatchinput so the path can be exercised end-to-end once before the cron is enabled — e.g. add anotify-slackboolean input and gate on(github.event_name == 'schedule' || github.event.inputs.notify-slack == 'true') && always(); or (b) extract the inline Python intotools/compile-perf/notify_slack.pywith a small unit test asserting the JSON payload shape and the success/failure/else branch selection. Option (b) is preferable because it pins the contract without requiring a live run.