Skip to content

Commit 0594168

Browse files
ci: add vmtest build testing
Signed-off-by: Mykola Lysenko <[email protected]>
1 parent 106bf6a commit 0594168

File tree

2 files changed

+431
-0
lines changed

2 files changed

+431
-0
lines changed

.github/workflows/helpers.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# shellcheck shell=bash
2+
3+
# $1 - start or end
4+
# $2 - fold identifier, no spaces
5+
# $3 - fold section description
6+
foldable() {
7+
local YELLOW='\033[1;33m'
8+
local NOCOLOR='\033[0m'
9+
if [ $1 = "start" ]; then
10+
line="::group::$2"
11+
if [ ! -z "${3:-}" ]; then
12+
line="$line - ${YELLOW}$3${NOCOLOR}"
13+
fi
14+
else
15+
line="::endgroup::"
16+
fi
17+
echo -e "$line"
18+
}
19+
20+
__print() {
21+
local TITLE=""
22+
if [[ -n $2 ]]; then
23+
TITLE=" title=$2"
24+
fi
25+
echo "::$1${TITLE}::$3"
26+
}
27+
28+
# $1 - title
29+
# $2 - message
30+
print_error() {
31+
__print error $1 $2
32+
}
33+
34+
# $1 - title
35+
# $2 - message
36+
print_notice() {
37+
__print notice $1 $2
38+
}
39+
40+
# No arguments
41+
llvm_default_version() {
42+
echo "16"
43+
}
44+
45+
# No arguments
46+
llvm_latest_version() {
47+
echo "17"
48+
}
49+
50+
# $1 - toolchain name
51+
llvm_version() {
52+
local toolchain="$1"
53+
local toolchain_name="$(echo $toolchain | cut -d '-' -f 1)"
54+
local toolchain_version="$(echo $toolchain | cut -d '-' -f 2)"
55+
56+
if [ "$toolchain_name" == "llvm" ]; then
57+
echo "$toolchain_version"
58+
return 0
59+
else
60+
llvm_default_version
61+
return 1
62+
fi
63+
}
64+
65+
# No arguments
66+
kernel_build_make_jobs() {
67+
# returns the number of processes to use when building kernel/selftests/samples
68+
# default to 4*nproc if MAX_MAKE_JOBS is not defined
69+
smp=$((4*$(nproc)))
70+
MAX_MAKE_JOBS=${MAX_MAKE_JOBS:-$smp}
71+
echo $(( smp > MAX_MAKE_JOBS ? MAX_MAKE_JOBS : smp ))
72+
}

0 commit comments

Comments
 (0)