Skip to content

Commit

Permalink
[ci]fix deprecated set-output from Python
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored Jul 11, 2024
1 parent 7c32a89 commit ecf65b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .ci/ctest2ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# - Colors for failing unit tests and test cases
# - Group control sequences to hide uninteresting output by default

import os
import sys
import re
import subprocess
Expand All @@ -36,6 +37,9 @@
fold_stack = list()
printable = set(string.printable)

def set_output(name, value):
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'{name}={value}', file=fh)

def start_fold(tag):
sys.stdout.write('::group::{}\n'.format(tag))
Expand Down Expand Up @@ -111,7 +115,7 @@ def start_test_fold():

if not in_failing_test and re.search('[0-9]+% tests passed, [0-9]+ tests failed out of', updated_line):
tests_failing = re.match(r'.* ([0-9]+) tests failed', updated_line).group(1)
updated_line += '\n::set-output name=TESTS_FAILING::{}'.format(tests_failing)
set_output(TESTS_FAILING, tests_failing)
end_fold()

if re.search('100% tests passed', updated_line):
Expand All @@ -121,7 +125,7 @@ def start_test_fold():
start_fold('submit')
elif re.search('Test results submitted to', updated_line):
cdash_url = re.match(r'.*(http.*)$', updated_line).group(1)
updated_line += '\n::set-output name=CDASH_URL::{}'.format(cdash_url)
set_output(CDASH_URL, cdash_url)
end_fold()

sys.stdout.write(updated_line)
Expand Down

0 comments on commit ecf65b6

Please sign in to comment.