Skip to content

Commit

Permalink
ci: add vmtest build testing
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Lysenko <[email protected]>
  • Loading branch information
mykola-lysenko committed Mar 26, 2023
1 parent 106bf6a commit 7cc9fb8
Show file tree
Hide file tree
Showing 2 changed files with 431 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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
}

# No arguments
llvm_default_version() {
echo "16"
}

# No arguments
llvm_latest_version() {
echo "17"
}

# $1 - toolchain name
llvm_version() {
local toolchain="$1"
local toolchain_name="$(echo $toolchain | cut -d '-' -f 1)"
local toolchain_version="$(echo $toolchain | cut -d '-' -f 2)"

if [ "$toolchain_name" == "llvm" ]; then
echo "$toolchain_version"
return 0
else
llvm_default_version
return 1
fi
}

# No arguments
kernel_build_make_jobs() {
# returns the number of processes to use when building kernel/selftests/samples
# default to 4*nproc if MAX_MAKE_JOBS is not defined
smp=$((4*$(nproc)))
MAX_MAKE_JOBS=${MAX_MAKE_JOBS:-$smp}
echo $(( smp > MAX_MAKE_JOBS ? MAX_MAKE_JOBS : smp ))
}
Loading

0 comments on commit 7cc9fb8

Please sign in to comment.