tests: make it easier to read overall results in github

Use collapsible sections for cicmds.
pull/11644/head
Eli Schwartz 2 years ago
parent 3c655bca39
commit 5fe7ecb861
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 8
      run_project_tests.py

@ -289,6 +289,7 @@ class TestDef:
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
@ -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])

Loading…
Cancel
Save