@@ -180,7 +180,7 @@ def process_build_reports():
180180
181181 first_line = True
182182 for board in artifact_boards :
183- print (f"<tr>" , f"<td rowspan='{ len (artifact_boards )} '>{ BOARD_STATUS [artifact_status ]} <a href='#{ artifact } '><code>{ artifact } </code></a></td>" if first_line else "" )
183+ print (f"<tr>" , f"<td rowspan='{ len (artifact_boards )} '>{ BOARD_STATUS [artifact_status ]} <a href='#user-content- { artifact } '><code>{ artifact } </code></a></td>" if first_line else "" )
184184 first_line = False
185185
186186 summary = BOARD_SUMMARY [board ]
@@ -190,7 +190,7 @@ def process_build_reports():
190190
191191 print (f"<td><code>{ board_link } </code></td><td align='center'>{ BOARD_STATUS [status ]} </td>" )
192192 if status == FAILURE :
193- print (f"<td colspan=3 >{ TEST_MATRIX ['CI test' ][board ]['issues' ][0 ]} </td></tr>" )
193+ print (f"<td colspan='3' >{ TEST_MATRIX ['CI test' ][board ]['issues' ][0 ]} </td></tr>" )
194194 else :
195195 tests_str = summary ['tests' ] or "-"
196196 warnings_str = summary ['warnings' ] or "-"
@@ -215,7 +215,7 @@ def process_build_reports():
215215
216216 # Print the test matrix
217217
218- header_row = "<tr><th colspan=2 >Sketch / Board</th>"
218+ header_row = "<tr><th colspan='2' >Sketch / Board</th>"
219219 for board in artifact_boards :
220220 status = BOARD_SUMMARY [board ]['status' ]
221221 header_col = f"<code>{ board } </code>"
@@ -226,7 +226,7 @@ def process_build_reports():
226226 header_row += f"<th>{ header_col } </th>"
227227 header_row += "</tr>"
228228
229- print ("<table id='# {artifact}'>" )
229+ print (f "<table id='{ artifact } '>" )
230230 print (header_row )
231231
232232 artifact_matrix = { sketch : results for sketch , results in TEST_MATRIX .items () if any (board in results for board in artifact_boards ) }
@@ -240,17 +240,18 @@ def process_build_reports():
240240 issues = test_result ['issues' ] if test_result else ""
241241
242242 sketch_status = max (sketch_status , status )
243+ row_data += f"<td align='center'>{ TEST_STATUS [status ]} </td>"
244+ name_link = example_name (sketch_name )
245+ if issues :
243246 sketch_id = sketch_name .replace ('/' , '_' ).replace (' ' , '_' ).replace ('-' , '_' )
244- icon_link = f"<a href='#{ sketch_id } _{ board } '>{ TEST_STATUS [status ]} </a>" if issues else TEST_STATUS [status ]
245- row_data += f"<td align='center'>{ icon_link } </a></td>"
246- print (f"<tr><td>{ TEST_STATUS [sketch_status ]} </td><td><code>{ example_name (sketch_name )} </code></td>{ row_data } </tr>" )
247+ name_link = f"<a href='#user-content-{ artifact } _{ sketch_id } '>{ name_link } </a>"
248+ print (f"<tr><td>{ TEST_STATUS [sketch_status ]} </td><td>{ name_link } </td>{ row_data } </tr>" )
247249 print ("</table>\n " )
248250
249- print (f"<details><summary>:scroll: <b>Detailed test issues for <code>{ artifact } </code></b></summary>\n " )
250- print ("<table>" )
251- print ("<tr><th>Sketch</th><th>Build Details</th></tr>" )
251+ sketch_log_map = {}
252252 for sketch_name , board_results in artifact_matrix .items ():
253- row_open = False
253+ test_log_map = {}
254+ sketch_status = SKIP
254255 for board in artifact_boards :
255256 if not board in board_results :
256257 continue
@@ -261,22 +262,32 @@ def process_build_reports():
261262 if not issues :
262263 continue
263264
264- if not row_open :
265- row_open = True
266- print (f"<tr><td>{ example_name (sketch_name )} </td>" )
267- print ("<td>" )
265+ sketch_status = max (sketch_status , status )
268266
269267 job_link = BOARD_SUMMARY [board ]['job_link' ]
268+ test_text = f"<code>{ board } </code>"
270269 if job_link :
271- job_link = f" <a href='{ job_link } '> :scroll:</a>"
272- sketch_id = sketch_name .replace ('/' , '_' ).replace (' ' , '_' ).replace ('-' , '_' )
273- print (f"<details id='{ sketch_id } _{ board } '><summary>{ artifact_count (len (issues ), status , TEST_STATUS )} <code>{ board } </code>{ job_link } </summary>" )
274- print ("\n ```\n " + "\n " .join (issues ) + "\n ```" )
275- print ("</details>" )
270+ test_text += f" (<a href='{ job_link } '>full log</a>)"
271+ test_text = f"<tr><td>{ TEST_STATUS [status ]} { test_text } <br/>"
272+ test_text += "\n \n ```\n " + "\n " .join (issues ) + "\n ```\n </td></tr>"
276273
277- if row_open :
278- print ("</td></tr>" )
279- print ("</table></details>\n " )
274+ test_log_list = test_log_map .get (status , [])
275+ test_log_list .append (test_text )
276+ test_log_map [status ] = test_log_list
277+
278+ sketch_log_list = sketch_log_map .get (status , [])
279+ sketch_log_list .append ((sketch_name , test_log_map ))
280+ sketch_log_map [status ] = sketch_log_list
281+
282+ for sketch_status in [ERROR , EXPECTED_ERROR , WARNING ]:
283+ for sketch_name , test_log_map in sketch_log_map .get (sketch_status , []):
284+ sketch_id = sketch_name .replace ('/' , '_' ).replace (' ' , '_' ).replace ('-' , '_' )
285+ print (f"<a name='{ artifact } _{ sketch_id } '/><details name='{ artifact } '><summary>Logs for { TEST_STATUS [sketch_status ]} { example_name (sketch_name )} </summary>\n " )
286+ print ("<table>" )
287+ for test_status in [ERROR , EXPECTED_ERROR , WARNING ]:
288+ for text in test_log_map .get (test_status , []):
289+ print (text )
290+ print ("</table></details>\n " )
280291
281292if __name__ == "__main__" :
282293 process_build_reports ()
0 commit comments