From 7f11cd48d614a5aff93a1360ab9eb6bc2c7e0b00 Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Mon, 29 Nov 2021 22:54:07 +0000 Subject: [PATCH] ci: create helpers for formatting errors and notices Create helpers for formatting errors and notices for GitHub actions, instead of directly printing the double colons and attributes. --- travis-ci/vmtest/helpers.sh | 20 ++++++++++++++++++++ travis-ci/vmtest/run.sh | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/travis-ci/vmtest/helpers.sh b/travis-ci/vmtest/helpers.sh index e51713b..116e72c 100644 --- a/travis-ci/vmtest/helpers.sh +++ b/travis-ci/vmtest/helpers.sh @@ -24,3 +24,23 @@ travis_fold() { } ARCH=$(uname -m) + +__print() { + local TITLE="" + if [[ -n $2 ]]; then + TITLE=" title=$2" + fi + echo "::$1${TITLE}::$3" +} + +# $1 - title +# $2 - message +print_error() { + __print error $1 $2 +} + +# $1 - title +# $2 - message +print_notice() { + __print notice $1 $2 +} diff --git a/travis-ci/vmtest/run.sh b/travis-ci/vmtest/run.sh index 93a1f90..29a9bfc 100755 --- a/travis-ci/vmtest/run.sh +++ b/travis-ci/vmtest/run.sh @@ -420,9 +420,9 @@ if [[ "${KERNEL}" = 'LATEST' ]]; then "${REPO_ROOT}/${REPO_PATH}/tools/testing/selftests/bpf/test_bpftool_synctypes.py" && true test_results["bpftool"]=$? if [[ ${test_results["bpftool"]} -eq 0 ]]; then - echo "::notice title=bpftool_checks::bpftool checks passed successfully." + print_notice bpftool_checks "bpftool checks passed successfully." else - echo "::error title=bpftool_checks::bpftool checks returned ${test_results["bpftool"]}." + print_error bpftool_checks "bpftool checks returned ${test_results["bpftool"]}." fi else echo "Consistency checks skipped."