diff --git a/Tools/scripts/build_tests/pretty_diff_size.py b/Tools/scripts/build_tests/pretty_diff_size.py index 79598d706fb22..59d0c1eadeacb 100755 --- a/Tools/scripts/build_tests/pretty_diff_size.py +++ b/Tools/scripts/build_tests/pretty_diff_size.py @@ -90,6 +90,21 @@ def print_table(summary_data_list_second, summary_data_list_master): print_data.append(col_data) print(tabulate(print_data, headers=["Binary Name", "Text [B]", "Data [B]", "BSS (B)", "Total Flash Change [B] (%)", "Flash Free After PR (B)"])) + # Get the GitHub Actions summary file path + summary_file = os.getenv('GITHUB_STEP_SUMMARY') + if summary_file: + # Append the output to the summary file + with open(summary_file, 'a') as f: + f.write("### Diff summary\n") + f.write(tabulate(print_data, headers=[ + "Binary Name", + "Text [B]", + "Data [B]", + "BSS (B)", + "Total Flash Change [B] (%)", + "Flash Free After PR (B)" + ], tablefmt="github")) + f.write("\n") def extract_binaries_size(path): diff --git a/Tools/scripts/build_tests/test_ccache.py b/Tools/scripts/build_tests/test_ccache.py index c0d5543d1ebd0..9abdb22badef6 100755 --- a/Tools/scripts/build_tests/test_ccache.py +++ b/Tools/scripts/build_tests/test_ccache.py @@ -65,11 +65,22 @@ def build_board(boardname): build_board(boards[0]) subprocess.run(["ccache", "-z"]) build_board(boards[1]) -subprocess.run(["ccache", "-s"]) +result = subprocess.run(["ccache", "-s"], capture_output=True, text=True) +print(result.stdout) + +# Get the GitHub Actions summary file path +summary_file = os.getenv('GITHUB_STEP_SUMMARY') post = ccache_stats() hit_pct = 100 * post[0] / float(post[0]+post[1]) print("ccache hit percentage: %.1f%% %s" % (hit_pct, post)) +if summary_file: + # Append the output to the summary file + with open(summary_file, 'a') as f: + f.write(f"### ccache -s Output with {boards}\n") + f.write(f"```\n{result.stdout}\n```\n") + f.write(f"### ccache hit percentage (min {args.min_cache_pct})\n") + f.write("ccache hit percentage: %.1f%% %s\n" % (hit_pct, post)) if hit_pct < args.min_cache_pct: print("ccache hits too low, need %d%%" % args.min_cache_pct) sys.exit(1)