Skip to content

Commit

Permalink
tests: make it easier to read overall results in github
Browse files Browse the repository at this point in the history
Use collapsible sections for cicmds.
  • Loading branch information
eli-schwartz committed Apr 4, 2023
1 parent 3c655bc commit 5fe7ecb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion run_project_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ def __lt__(self, other: object) -> bool:
failing_logs: T.List[str] = []
print_debug = 'MESON_PRINT_TEST_OUTPUT' in os.environ
under_ci = 'CI' in os.environ
ci_is_github = 'GITHUB_ACTIONS' in os.environ
raw_ci_jobname = os.environ.get('MESON_CI_JOBNAME', None)
ci_jobname = raw_ci_jobname if raw_ci_jobname != 'thirdparty' else None
do_debug = under_ci or print_debug
Expand Down Expand Up @@ -420,11 +421,16 @@ def log_text_file(logfile: T.TextIO, testdir: Path, result: TestResult) -> None:


def _run_ci_include(args: T.List[str]) -> str:
header = f'Included file {args[0]}:'
footer = ''
if ci_is_github:
header = f'::group::==== {header} ===='
footer = '::endgroup::'
if not args:
return 'At least one parameter required'
try:
data = Path(args[0]).read_text(errors='ignore', encoding='utf-8')
return 'Included file {}:\n{}\n'.format(args[0], data)
return f'{header}\n{data}\n{footer}'
except Exception:
return 'Failed to open {}'.format(args[0])

Expand Down

0 comments on commit 5fe7ecb

Please sign in to comment.