Skip to content

Commit

Permalink
Standardize CI scripts to print both raw and GitHub actions messages …
Browse files Browse the repository at this point in the history
…when run under GitHub actions

Apparently the location information is no longer visible in build logs

Pointed out in #1704 (comment)
  • Loading branch information
lethosor committed Dec 28, 2020
1 parent eb6957a commit 4460584
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions travis/lint.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion travis/script-syntax.py
Expand Up @@ -11,14 +11,14 @@ 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
for i in range(len(parts) - 1):
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):
Expand Down

0 comments on commit 4460584

Please sign in to comment.