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.
This commit is contained in:
Quentin Monnet 2021-11-29 22:54:07 +00:00 committed by Andrii Nakryiko
parent 4374bad784
commit 7f11cd48d6
2 changed files with 22 additions and 2 deletions

View File

@ -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
}

View File

@ -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."