Loading ci/basop-pages/create_report_pages.py +37 −19 Original line number Diff line number Diff line Loading @@ -11,11 +11,14 @@ SUBPAGE_TMPL_CSS = """ overflow:hidden;padding:10px 5px;word-break:normal;} .tbase th{border-color:black;border-style:solid;border-width:1px;font-family:sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;} .tbase .tunder{font-weight:bold;text-align:center;text-decoration:underline;vertical-align:top} .tbase .tcenter{font-weight:bold;text-align:center;vertical-align:top} .tbase .tleft{text-align:left;vertical-align:top} .tbase .tincrease{text-align:left;vertical-align:top;background-color:#ff0000;border-color:inherit;font-weight:bold;} .tbase .treduce{text-align:left;vertical-align:top;background-color:#00ff00;border-color:inherit;font-weight:bold;} .tbase .tunder{font-weight:bold;text-align:center;text-decoration:underline;} .tbase .tcenter{font-weight:bold;text-align:center;} .tbase .tleft{text-align:left;horizontal-align:bottom} .tbase .tincrease{text-align:left;background-color:#ff0000;border-color:inherit;font-weight:bold;} .tbase .treduce{text-align:left;background-color:#00ff00;border-color:inherit;font-weight:bold;} .arrowup {font-weight:bold;background-color:#ff0000;font-size:200%;} .arrowdown {font-weight:bold;background-color:#00ff00;font-size:200%;} </style> """ Loading Loading @@ -54,6 +57,11 @@ TH_TMPL_GLOBAL = '<th class="tunder" rowspan="2">{}</th>' TH_TMPL_DIFFERENTIAL = '<th class="tunder" colspan="2">{}</th>' TH_TMPL_SECOND_ROW = '<th class="tcenter">{}</th>' ARROW_UP = '<span class="arrowup">⬀</span>' ARROW_DOWN = '<span class="arrowdown">⬂</span>' # ARROW_UP = '⬀' # ARROW_DOWN = '⬂' # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Result", "MLD", "MAXIMUM ABS DIFF"] Loading Loading @@ -127,20 +135,30 @@ def tr_from_row(row, id_current, id_previous): prev = row[f"{c}-{id_previous}"] curr = row[f"{c}-{id_current}"] # use red background if increase, green if decrease, white if same td_tmpl = TD_TMPL_NORMAL if c == "Result": # print errors in bold red font td_tmpl = TD_TMPL_INCREASE if prev == "ERROR" else TD_TMPL_NORMAL tr.append(td_tmpl.format(prev)) td_tmpl = TD_TMPL_INCREASE if curr == "ERROR" else TD_TMPL_NORMAL tr.append(td_tmpl.format(curr)) else: td_tmpl_curr = TD_TMPL_NORMAL td_tmpl_prev = TD_TMPL_NORMAL try: if float(curr) > float(prev): td_tmpl = TD_TMPL_INCREASE if float(curr) < float(prev): td_tmpl = TD_TMPL_REDUCE curr += f" {ARROW_UP}" td_tmpl_curr = TD_TMPL_INCREASE elif float(curr) < float(prev): curr += f" {ARROW_DOWN}" td_tmpl_curr = TD_TMPL_REDUCE except ValueError: # if we land here, one of the cells is not a number, this indicates a crash # or some error in the scripts, so mark with red as well td_tmpl = TD_TMPL_INCREASE td_tmpl_curr = TD_TMPL_INCREASE td_tmpl_prev = TD_TMPL_INCREASE tr.append(td_tmpl.format(row[f"{c}-{id_previous}"])) tr.append(td_tmpl.format(row[f"{c}-{id_current}"])) tr.append(td_tmpl_prev.format(prev)) tr.append(td_tmpl_curr.format(curr)) return TR_TMPL.format("\n".join(tr)) Loading Loading
ci/basop-pages/create_report_pages.py +37 −19 Original line number Diff line number Diff line Loading @@ -11,11 +11,14 @@ SUBPAGE_TMPL_CSS = """ overflow:hidden;padding:10px 5px;word-break:normal;} .tbase th{border-color:black;border-style:solid;border-width:1px;font-family:sans-serif;font-size:14px; font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;} .tbase .tunder{font-weight:bold;text-align:center;text-decoration:underline;vertical-align:top} .tbase .tcenter{font-weight:bold;text-align:center;vertical-align:top} .tbase .tleft{text-align:left;vertical-align:top} .tbase .tincrease{text-align:left;vertical-align:top;background-color:#ff0000;border-color:inherit;font-weight:bold;} .tbase .treduce{text-align:left;vertical-align:top;background-color:#00ff00;border-color:inherit;font-weight:bold;} .tbase .tunder{font-weight:bold;text-align:center;text-decoration:underline;} .tbase .tcenter{font-weight:bold;text-align:center;} .tbase .tleft{text-align:left;horizontal-align:bottom} .tbase .tincrease{text-align:left;background-color:#ff0000;border-color:inherit;font-weight:bold;} .tbase .treduce{text-align:left;background-color:#00ff00;border-color:inherit;font-weight:bold;} .arrowup {font-weight:bold;background-color:#ff0000;font-size:200%;} .arrowdown {font-weight:bold;background-color:#00ff00;font-size:200%;} </style> """ Loading Loading @@ -54,6 +57,11 @@ TH_TMPL_GLOBAL = '<th class="tunder" rowspan="2">{}</th>' TH_TMPL_DIFFERENTIAL = '<th class="tunder" colspan="2">{}</th>' TH_TMPL_SECOND_ROW = '<th class="tcenter">{}</th>' ARROW_UP = '<span class="arrowup">⬀</span>' ARROW_DOWN = '<span class="arrowdown">⬂</span>' # ARROW_UP = '⬀' # ARROW_DOWN = '⬂' # expected columns. actual columns are filtered from the incoming data later, this # is mainly for controlling the order in the output table COLUMNS = ["testcase", "Result", "MLD", "MAXIMUM ABS DIFF"] Loading Loading @@ -127,20 +135,30 @@ def tr_from_row(row, id_current, id_previous): prev = row[f"{c}-{id_previous}"] curr = row[f"{c}-{id_current}"] # use red background if increase, green if decrease, white if same td_tmpl = TD_TMPL_NORMAL if c == "Result": # print errors in bold red font td_tmpl = TD_TMPL_INCREASE if prev == "ERROR" else TD_TMPL_NORMAL tr.append(td_tmpl.format(prev)) td_tmpl = TD_TMPL_INCREASE if curr == "ERROR" else TD_TMPL_NORMAL tr.append(td_tmpl.format(curr)) else: td_tmpl_curr = TD_TMPL_NORMAL td_tmpl_prev = TD_TMPL_NORMAL try: if float(curr) > float(prev): td_tmpl = TD_TMPL_INCREASE if float(curr) < float(prev): td_tmpl = TD_TMPL_REDUCE curr += f" {ARROW_UP}" td_tmpl_curr = TD_TMPL_INCREASE elif float(curr) < float(prev): curr += f" {ARROW_DOWN}" td_tmpl_curr = TD_TMPL_REDUCE except ValueError: # if we land here, one of the cells is not a number, this indicates a crash # or some error in the scripts, so mark with red as well td_tmpl = TD_TMPL_INCREASE td_tmpl_curr = TD_TMPL_INCREASE td_tmpl_prev = TD_TMPL_INCREASE tr.append(td_tmpl.format(row[f"{c}-{id_previous}"])) tr.append(td_tmpl.format(row[f"{c}-{id_current}"])) tr.append(td_tmpl_prev.format(prev)) tr.append(td_tmpl_curr.format(curr)) return TR_TMPL.format("\n".join(tr)) Loading