Skip to content

Commit a619790

Browse files
JRPanWilliam-An
andauthored
CI Updates (#474)
* CI Updates 1. branch-aware checkout 2. enforce format check 3. remove merge queue runs * Make CI-Success depends on check format * check format fiirst then run CIs * surpress some output * silence CUDA install msg. * refactor yaml * vibe coding the plots into the email * Trying to see email addr * update CI * sleep 5 min and check supress git clone output with --quiet * Try again * rm " in ptx * try again * try again * fix ptx * try again * ues python instead * addressing reviewer concerns * checkout before sending email * moving correlation plot to stats-archive instead of attachment * checkout before senidng email * set env * Change CI runner from ubuntu-latest to tgrogers-raid * Fix CI envs * move REPORT_URL into the job * export it * try again * try again * this time should work --------- Co-authored-by: WilliamMTK <[email protected]>
1 parent ec00037 commit a619790

File tree

6 files changed

+506
-360
lines changed

6 files changed

+506
-360
lines changed

.github/scripts/send_ci_email.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import os
2+
import sys
3+
import smtplib
4+
import getpass
5+
import argparse
6+
from email.message import EmailMessage
7+
8+
"""Command-line interface
9+
10+
New argument-based interface (no positional args):
11+
--email-type {success,failure}
12+
--urgent (flag, only for failure emails)
13+
"""
14+
15+
parser = argparse.ArgumentParser(description="Send CI result email (success/failure)")
16+
parser.add_argument("-t", "--email-type", required=True, choices=["success", "failure"], help="Type of email to send")
17+
parser.add_argument("-u", "--urgent", action="store_true", help="Mark failure email as urgent (uses ❗). If not set, treated as warning (⚠️)")
18+
19+
args = parser.parse_args()
20+
21+
EMAIL_TYPE = args.email_type
22+
URGENCY = "urgent" if args.urgent else "warning"
23+
24+
username = getpass.getuser()
25+
26+
FROM = f"{username}@ecn.purdue.edu"
27+
TO = os.getenv("GROUP_EMAIL", None)
28+
BRANCH_NAME = os.getenv("BRANCH_NAME", None)
29+
ACTION_URL = os.getenv("ACTION_URL", None)
30+
REPORT_URL = os.getenv("REPORT_URL", None)
31+
# No failed-jobs enumeration used anymore
32+
33+
if TO is None or BRANCH_NAME is None or ACTION_URL is None:
34+
print("Missing required environment variables")
35+
print(f"TO: {TO}")
36+
print(f"BRANCH_NAME: {BRANCH_NAME}")
37+
print(f"ACTION_URL: {ACTION_URL}")
38+
exit(1)
39+
40+
# --- Build HTML body based on email type ---
41+
if EMAIL_TYPE == "success":
42+
43+
# Build correlation plot links if REPORT_URL provided
44+
plots_html = ""
45+
if REPORT_URL:
46+
v100_kernel = os.path.join(REPORT_URL, "v100-combined_per_kernel.html")
47+
v100_app = os.path.join(REPORT_URL, "v100-combined_per_app.html")
48+
a100_kernel = os.path.join(REPORT_URL, "ampere-a100-combined_per_kernel.html")
49+
a100_app = os.path.join(REPORT_URL, "ampere-a100-combined_per_app.html")
50+
plots_html = f"""
51+
<h3>Correlation Plots</h3>
52+
<ul>
53+
<li><a href=\"{v100_kernel}\">V100 - Per Kernel</a></li>
54+
<li><a href=\"{v100_app}\">V100 - Per App</a></li>
55+
<li><a href=\"{a100_kernel}\">A100 - Per Kernel</a></li>
56+
<li><a href=\"{a100_app}\">A100 - Per App</a></li>
57+
</ul>
58+
"""
59+
html_body = f"""
60+
<html>
61+
<body>
62+
<h2>✅ Github CI - Build {BRANCH_NAME} SUCCESS</h2>
63+
<p><strong>Action link:</strong> <a href=\"{ACTION_URL}\">View Action</a></p>
64+
<p><strong>Branch/PR Name:</strong> {BRANCH_NAME}</p>
65+
{plots_html}
66+
</body>
67+
</html>
68+
"""
69+
subject = f"✅ Github CI - Build {BRANCH_NAME} SUCCESS"
70+
else: # failure
71+
# Choose emoji based on urgency
72+
emoji = "❗" if URGENCY == 'urgent' else "⚠️"
73+
74+
html_body = f"""
75+
<html>
76+
<body>
77+
<h2>{emoji} Github CI - Build {BRANCH_NAME} FAILED</h2>
78+
<p><strong>Action link:</strong> <a href=\"{ACTION_URL}\">View Action</a></p>
79+
<p><strong>Branch/PR Name:</strong> {BRANCH_NAME}</p>
80+
<p style=\"color: red;\"><strong>Please check the action logs for details.</strong></p>
81+
</body>
82+
</html>
83+
"""
84+
subject = f"{emoji}Github CI FAILED - Build {BRANCH_NAME}"
85+
86+
# --- Create the Email with HTML alternative ---
87+
msg = EmailMessage()
88+
msg['To'] = TO
89+
msg['Subject'] = subject
90+
msg['From'] = FROM
91+
msg.set_content("This email contains HTML content. If you see this, your client did not render HTML.")
92+
msg.add_alternative(html_body, subtype='html')
93+
94+
# --- Send the Email ---
95+
with smtplib.SMTP('localhost') as smtp:
96+
smtp.send_message(msg)
97+
98+
print(f"{EMAIL_TYPE.title()} email sent successfully!")

.github/workflows/long-tests.yml

Lines changed: 0 additions & 256 deletions
This file was deleted.

0 commit comments

Comments
 (0)