From ecf65b612e92dea244bb0cdf43486e8e1adcf08d Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 11 Jul 2024 09:55:53 +0200 Subject: [PATCH] [ci]fix deprecated set-output from Python --- .ci/ctest2ci.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.ci/ctest2ci.py b/.ci/ctest2ci.py index f0722f7216c7..53c8a462ea89 100755 --- a/.ci/ctest2ci.py +++ b/.ci/ctest2ci.py @@ -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 @@ -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)) @@ -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): @@ -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)