Modify buildtestpublish_all.sh
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 34s
Build-Test-Publish / build (linux/arm64) (push) Successful in 49s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 7s

This commit is contained in:
Your Name 2025-06-25 19:36:09 +12:00
parent 85ef510cf8
commit 428f45bd08

View File

@ -2,9 +2,16 @@
set -euo pipefail set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Arrays to track results
declare -A BUILD_RESULTS
declare -A TEST_RESULTS
declare -A PUBLISH_RESULTS
declare -a PROJECTS
function dothis() { function dothis() {
local thisthing="$1" local thisthing="$1"
local dir="$2" local dir="$2"
local project="$3"
cmd="" cmd=""
@ -13,9 +20,29 @@ function dothis() {
if [ -z "$cmd" ]; then if [ -z "$cmd" ]; then
echo "No ${thisthing} script found in $dir" echo "No ${thisthing} script found in $dir"
case "$thisthing" in
build) BUILD_RESULTS["$project"]="SKIP" ;;
test) TEST_RESULTS["$project"]="SKIP" ;;
publish) PUBLISH_RESULTS["$project"]="SKIP" ;;
esac
return 0
else else
echo "Running $cmd" echo "Running $cmd"
"$cmd" if "$cmd"; then
case "$thisthing" in
build) BUILD_RESULTS["$project"]="✓" ;;
test) TEST_RESULTS["$project"]="✓" ;;
publish) PUBLISH_RESULTS["$project"]="✓" ;;
esac
return 0
else
case "$thisthing" in
build) BUILD_RESULTS["$project"]="✗" ;;
test) TEST_RESULTS["$project"]="✗" ;;
publish) PUBLISH_RESULTS["$project"]="✗" ;;
esac
return 1
fi
fi fi
} }
@ -66,21 +93,24 @@ function buildtestpublish() {
local dir="$1" local dir="$1"
TOOLNAME=$(basename "$dir") TOOLNAME=$(basename "$dir")
TOOLNAME=$(echo "$TOOLNAME" | tr '[:lower:]' '[:upper:]') TOOLNAME_UPPER=$(echo "$TOOLNAME" | tr '[:lower:]' '[:upper:]')
title "🔧 $TOOLNAME 🔧" title "🔧 $TOOLNAME_UPPER 🔧"
export PROJECT="$TOOLNAME" export PROJECT="$TOOLNAME_UPPER"
# Add to projects list
PROJECTS+=("$TOOLNAME")
cd "$dir" cd "$dir"
subtitle "🔨 BUILDING $TOOLNAME 🔨" subtitle "🔨 BUILDING $TOOLNAME_UPPER 🔨"
dothis build "$dir" dothis build "$dir" "$TOOLNAME" || true
subtitle "🔍 TESTING $TOOLNAME 🔍" subtitle "🔍 TESTING $TOOLNAME_UPPER 🔍"
dothis test "$dir" dothis test "$dir" "$TOOLNAME" || true
subtitle "📦 PUBLISHING $TOOLNAME 📦" subtitle "📦 PUBLISHING $TOOLNAME_UPPER 📦"
dothis publish "$dir" dothis publish "$dir" "$TOOLNAME" || true
echo "Done" echo "Done"
} }
@ -105,8 +135,47 @@ title "🔨 BUILDING ALL TOOLS 🔨"
getpkg/build.sh getpkg/build.sh
export GETPKG="${SCRIPT_DIR}/getpkg/output/getpkg" export GETPKG="${SCRIPT_DIR}/getpkg/output/getpkg"
[ -f "$GETPKG" ] || die "Build failed." if [ ! -f "$GETPKG" ]; then
echo "Build failed."
exit 1
fi
buildtestpublish_all buildtestpublish_all
function print_summary() {
title "📊 BUILD SUMMARY 📊"
# Calculate column widths
local max_project_width=7 # "PROJECT" header
for project in "${PROJECTS[@]}"; do
if [ ${#project} -gt $max_project_width ]; then
max_project_width=${#project}
fi
done
# Add padding
max_project_width=$((max_project_width + 2))
# Print header
printf "│ %-*s │ %-7s │ %-7s │ %-7s │\n" $max_project_width "PROJECT" "BUILD" "TEST" "PUBLISH"
printf "├"
printf "─%.0s" $(seq 1 $((max_project_width + 2)))
printf "┼─────────┼─────────┼─────────┤\n"
# Print results for each project
for project in "${PROJECTS[@]}"; do
local build_status="${BUILD_RESULTS[$project]:-'-'}"
local test_status="${TEST_RESULTS[$project]:-'-'}"
local publish_status="${PUBLISH_RESULTS[$project]:-'-'}"
printf "│ %-*s │ %-7s │ %-7s │ %-7s │\n" \
$max_project_width "$project" \
"$build_status" "$test_status" "$publish_status"
done
echo
}
print_summary
title "🚀 Deployment Complete! 🚀" title "🚀 Deployment Complete! 🚀"