summaryrefslogtreecommitdiffstats
path: root/.github/actions/build-selftests/helpers.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 08:24:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 08:24:23 +0000
commit67c27783d7735af6ba22b9f031d97ca4ea56c29c (patch)
tree17770fad3c90bf420cb2470e6e51255fcbf31bf9 /.github/actions/build-selftests/helpers.sh
parentInitial commit. (diff)
downloadlibbpf-upstream.tar.xz
libbpf-upstream.zip
Adding upstream version 1.1.0.upstream/1.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '.github/actions/build-selftests/helpers.sh')
-rw-r--r--.github/actions/build-selftests/helpers.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/actions/build-selftests/helpers.sh b/.github/actions/build-selftests/helpers.sh
new file mode 100644
index 0000000..c44d098
--- /dev/null
+++ b/.github/actions/build-selftests/helpers.sh
@@ -0,0 +1,38 @@
+# shellcheck shell=bash
+
+# $1 - start or end
+# $2 - fold identifier, no spaces
+# $3 - fold section description
+foldable() {
+ local YELLOW='\033[1;33m'
+ local NOCOLOR='\033[0m'
+ if [ $1 = "start" ]; then
+ line="::group::$2"
+ if [ ! -z "${3:-}" ]; then
+ line="$line - ${YELLOW}$3${NOCOLOR}"
+ fi
+ else
+ line="::endgroup::"
+ fi
+ echo -e "$line"
+}
+
+__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
+}