diff --git a/buildtestpublish_all.sh b/buildtestpublish_all.sh index 6a60766..5f24b63 100755 --- a/buildtestpublish_all.sh +++ b/buildtestpublish_all.sh @@ -2,9 +2,16 @@ set -euo pipefail 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() { local thisthing="$1" local dir="$2" + local project="$3" cmd="" @@ -13,9 +20,29 @@ function dothis() { if [ -z "$cmd" ]; then 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 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 } @@ -66,21 +93,24 @@ function buildtestpublish() { local dir="$1" TOOLNAME=$(basename "$dir") - TOOLNAME=$(echo "$TOOLNAME" | tr '[:lower:]' '[:upper:]') - title "🔧 $TOOLNAME 🔧" + TOOLNAME_UPPER=$(echo "$TOOLNAME" | tr '[:lower:]' '[:upper:]') + title "🔧 $TOOLNAME_UPPER 🔧" - export PROJECT="$TOOLNAME" + export PROJECT="$TOOLNAME_UPPER" + + # Add to projects list + PROJECTS+=("$TOOLNAME") cd "$dir" - subtitle "🔨 BUILDING $TOOLNAME 🔨" - dothis build "$dir" + subtitle "🔨 BUILDING $TOOLNAME_UPPER 🔨" + dothis build "$dir" "$TOOLNAME" || true - subtitle "🔍 TESTING $TOOLNAME 🔍" - dothis test "$dir" + subtitle "🔍 TESTING $TOOLNAME_UPPER 🔍" + dothis test "$dir" "$TOOLNAME" || true - subtitle "📦 PUBLISHING $TOOLNAME 📦" - dothis publish "$dir" + subtitle "📦 PUBLISHING $TOOLNAME_UPPER 📦" + dothis publish "$dir" "$TOOLNAME" || true echo "Done" } @@ -105,8 +135,47 @@ title "🔨 BUILDING ALL TOOLS 🔨" getpkg/build.sh export GETPKG="${SCRIPT_DIR}/getpkg/output/getpkg" -[ -f "$GETPKG" ] || die "Build failed." +if [ ! -f "$GETPKG" ]; then + echo "Build failed." + exit 1 +fi 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! 🚀"