Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion compilesketches/compilesketches.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import atexit
import time
import contextlib
import enum
import json
Expand Down Expand Up @@ -893,13 +894,22 @@ def compile_sketch(self, sketch_path, clean_build_cache):
if clean_build_cache:
for cache_path in pathlib.Path("/tmp").glob(pattern="arduino*"):
shutil.rmtree(path=cache_path)

start_time = time.monotonic()
compilation_data = self.run_arduino_cli_command(
command=compilation_command, enable_output=self.RunCommandOutput.NONE, exit_on_failure=False)
diff_time = time.monotonic() - start_time
time_summary = ""
if diff_time > 60:
if diff_time > 360:
time_summary += f"{int(diff_time / 360)} hours "
time_summary += f"{int(diff_time / 60) % 60} minutes "
time_summary += f"{int(diff_time) % 60} seconds."

# Group compilation output to make the log easy to read
# https://github.com/actions/toolkit/blob/master/docs/commands.md#group-and-ungroup-log-lines
print("::group::Compiling sketch:", path_relative_to_workspace(path=sketch_path))
print(compilation_data.stdout)
print("Compilation time elapsed", time_summary)
print("::endgroup::")

class CompilationResult:
Expand Down
1 change: 1 addition & 0 deletions compilesketches/tests/test_compilesketches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,7 @@ class CompilationData:
expected_stdout = (
"::group::Compiling sketch: " + str(compilesketches.path_relative_to_workspace(path=sketch_path)) + "\n"
+ str(stdout) + "\n"
+ "Compilation time elapsed 0 seconds.\n"
+ "::endgroup::"
)
if not expected_success:
Expand Down