Skip to content

Commit

Permalink
fix(l1, l2, levm): slack messages (#1356)
Browse files Browse the repository at this point in the history
Co-authored-by: Javier Rodríguez Chatruc <[email protected]>
  • Loading branch information
ilitteri and jrchatruc authored Nov 29, 2024
1 parent a665092 commit 668780a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 64 deletions.
24 changes: 1 addition & 23 deletions .github/scripts/publish_levm_ef_tests_summary.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat cmd/ef_tests/levm/levm_ef_tests_summary_slack.txt)" '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Daily LEVM EF Tests Run Report"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": $text
}
}
]
}')
EOF
--data "$(cat cmd/ef_tests/levm/levm_ef_tests_summary_slack.txt)"
24 changes: 1 addition & 23 deletions .github/scripts/publish_loc.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat loc_report_slack.txt)" '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "Lines of Code Report"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": $text
}
}
]
}')
EOF
--data "$(cat loc_report_slack.txt)"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ levm_ef_tests_summary.txt

loc_report_slack.txt
loc_report_github.txt
loc_report.json
22 changes: 21 additions & 1 deletion cmd/ef_tests/levm/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,27 @@ pub fn summary_for_slack(reports: &[EFTestReport]) -> String {
let total_run = reports.len();
let success_percentage = (total_passed as f64 / total_run as f64) * 100.0;
format!(
r#""*Summary*: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n""#,
r#"{{
"blocks": [
{{
"type": "header",
"text": {{
"type": "plain_text",
"text": "Daily LEVM EF Tests Run Report"
}}
}},
{{
"type": "divider"
}},
{{
"type": "section",
"text": {{
"type": "mrkdwn",
"text": "*Summary*: {total_passed}/{total_run} ({success_percentage:.2}%)\n\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n"
}}
}}
]
}}"#,
fork_summary_for_slack(reports, SpecId::CANCUN),
fork_summary_for_slack(reports, SpecId::SHANGHAI),
fork_summary_for_slack(reports, SpecId::HOMESTEAD),
Expand Down
54 changes: 37 additions & 17 deletions cmd/loc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,50 @@ fn slack_message(old_report: LinesOfCodeReport, new_report: LinesOfCodeReport) -
let ethrex_diff_total = ethrex_l1_diff + ethrex_l2_diff + levm_diff;

format!(
r#""*ethrex L1:* {} {}\n*ethrex L2:* {} {}\n*levm:* {} {}\n*ethrex (total):* {} {}""#,
r#"{{
"blocks": [
{{
"type": "header",
"text": {{
"type": "plain_text",
"text": "Daily LEVM EF Tests Run Report"
}}
}},
{{
"type": "divider"
}},
{{
"type": "section",
"text": {{
"type": "mrkdwn",
"text": "*ethrex L1:* {} {}\n*ethrex L2:* {} {}\n*levm:* {} {}\n*ethrex (total):* {} {}"
}}
}}
]
}}"#,
new_report.ethrex_l1,
if new_report.ethrex > old_report.ethrex {
format!("(+{ethrex_l1_diff})")
} else {
format!("(-{ethrex_l1_diff})")
match new_report.ethrex_l1.cmp(&old_report.ethrex_l1) {
std::cmp::Ordering::Greater => format!("(+{ethrex_l1_diff})"),
std::cmp::Ordering::Less => format!("(-{ethrex_l1_diff})"),
std::cmp::Ordering::Equal => "".to_string(),
},
new_report.ethrex_l2,
if new_report.ethrex_l2 > old_report.ethrex_l2 {
format!("(+{ethrex_l2_diff})")
} else {
format!("(-{ethrex_l2_diff})")
match new_report.ethrex_l2.cmp(&old_report.ethrex_l2) {
std::cmp::Ordering::Greater => format!("(+{ethrex_l2_diff})"),
std::cmp::Ordering::Less => format!("(-{ethrex_l2_diff})"),
std::cmp::Ordering::Equal => "".to_string(),
},
new_report.levm,
if new_report.levm > old_report.levm {
format!("(+{levm_diff})")
} else {
format!("(-{levm_diff})")
match new_report.levm.cmp(&old_report.levm) {
std::cmp::Ordering::Greater => format!("(+{levm_diff})"),
std::cmp::Ordering::Less => format!("(-{levm_diff})"),
std::cmp::Ordering::Equal => "".to_string(),
},
new_report.ethrex,
if new_report.ethrex > old_report.ethrex {
format!("(+{ethrex_diff_total})")
} else {
format!("(-{ethrex_diff_total})")
match new_report.ethrex.cmp(&old_report.ethrex) {
std::cmp::Ordering::Greater => format!("(+{ethrex_diff_total})"),
std::cmp::Ordering::Less => format!("(-{ethrex_diff_total})"),
std::cmp::Ordering::Equal => "".to_string(),
},
)
}
Expand Down

0 comments on commit 668780a

Please sign in to comment.