Skip to content

Commit b83ba8a

Browse files
committed
fold up individual output by default
1 parent 530348d commit b83ba8a

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Diff for: build_platform.py

+20-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import shutil
66
import subprocess
77
import collections
8+
from contextlib import contextmanager
89

910
# optional wall option cause build failed if has warnings
1011
BUILD_WALL = False
@@ -310,6 +311,20 @@ def generate_uf2(example_path):
310311
print("Unknown platform: ", arg)
311312
exit(-1)
312313

314+
@contextmanager
315+
def group_output(title):
316+
sys.stdout.flush()
317+
sys.stderr.flush()
318+
print(f"::group::{title}")
319+
try:
320+
yield
321+
finally:
322+
sys.stdout.flush()
323+
sys.stderr.flush()
324+
print(f"::endgroup::")
325+
sys.stdout.flush()
326+
327+
313328
def test_examples_in_folder(folderpath):
314329
global success
315330
for example in sorted(os.listdir(folderpath)):
@@ -365,7 +380,8 @@ def test_examples_in_folder(folderpath):
365380
ColorPrint.print_pass(CHECK)
366381
if err:
367382
# also print out warning message
368-
ColorPrint.print_fail(err.decode("utf-8"))
383+
with group_output(f"{example} {fqbn} build output"):
384+
ColorPrint.print_fail(err.decode("utf-8"))
369385
if os.path.exists(gen_file_name):
370386
if ALL_PLATFORMS[platform][1] == None:
371387
ColorPrint.print_info("Platform does not support UF2 files, skipping...")
@@ -382,8 +398,9 @@ def test_examples_in_folder(folderpath):
382398
os.system("ls -lR "+BUILD_DIR+"/build")
383399
else:
384400
ColorPrint.print_fail(CROSS)
385-
ColorPrint.print_fail(out.decode("utf-8"))
386-
ColorPrint.print_fail(err.decode("utf-8"))
401+
with group_output(f"{example} {fqbn} built output"):
402+
ColorPrint.print_fail(out.decode("utf-8"))
403+
ColorPrint.print_fail(err.decode("utf-8"))
387404
success = 1
388405

389406
def test_examples_in_learningrepo(folderpath):

0 commit comments

Comments
 (0)