From 4460584361278f1866eac2cf4c032930b6e563e7 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 27 Dec 2020 23:35:36 -0500 Subject: [PATCH] Standardize CI scripts to print both raw and GitHub actions messages when run under GitHub actions Apparently the location information is no longer visible in build logs Pointed out in https://github.com/DFHack/dfhack/pull/1704#issuecomment-726991055 --- travis/lint.py | 8 ++------ travis/script-syntax.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/travis/lint.py b/travis/lint.py index e1db140c2..05aa28950 100755 --- a/travis/lint.py +++ b/travis/lint.py @@ -128,21 +128,17 @@ def main(): lines[i] = line.decode('utf-8') except UnicodeDecodeError: msg_params = (rel_path, i + 1, 'Invalid UTF-8 (other errors will be ignored)') + error('%s:%i: %s' % msg_params) if is_github_actions: - error() print('::error file=%s,line=%i::%s' % msg_params) - else: - error('%s:%i: %s' % msg_params) lines[i] = '' for linter in linters: try: linter.check(lines) except LinterError as e: + error('%s: %s' % (rel_path, e)) if is_github_actions: - error() print(e.github_actions_workflow_command(rel_path)) - else: - error('%s: %s' % (rel_path, e)) if fix: linter.fix(lines) contents = '\n'.join(lines) diff --git a/travis/script-syntax.py b/travis/script-syntax.py index 53891f762..593a25a24 100755 --- a/travis/script-syntax.py +++ b/travis/script-syntax.py @@ -11,6 +11,7 @@ def print_stderr(stderr, args): return for line in stderr.split('\n'): + print(line) parts = list(map(str.strip, line.split(':'))) # e.g. luac prints "luac:" in front of messages, so find the first part # containing the actual filename @@ -18,7 +19,6 @@ def print_stderr(stderr, args): if parts[i].endswith('.' + args.ext) and parts[i + 1].isdigit(): print('::error file=%s,line=%s::%s' % (parts[i], parts[i + 1], ':'.join(parts[i + 2:]))) break - print(line) def main(args):