commit bcacec63cfe080c4dab80ef59b77da3dc87b32c5
parent 64b57063e54b16a50b3431c7006943bd2c678d49
Author: arjoonn <arjoonn@midpathsoftware.com>
Date: Sat, 28 Feb 2026 11:38:08 +0530
x
Diffstat:
| M | .jci/run.sh | | | 107 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- |
1 file changed, 95 insertions(+), 12 deletions(-)
diff --git a/.jci/run.sh b/.jci/run.sh
@@ -7,13 +7,76 @@
# JCI_REPO_ROOT - Repository root path
# JCI_OUTPUT_DIR - Output directory (where artifacts should go)
-set -e
+set -eo pipefail
-echo "=== JCI CI Pipeline ==="
-echo "Commit: ${JCI_COMMIT:0:12}"
-echo ""
+PIPELINE_NAME="JayporeCI"
-cd "$JCI_REPO_ROOT"
+# Summary bookkeeping --------------------------------------------------------
+declare -a SUMMARY_PIPELINE=()
+declare -a SUMMARY_BUILD_MATRIX=()
+
+add_pipeline_summary() {
+ local icon="$1"
+ local label="$2"
+ local ref="$3"
+ SUMMARY_PIPELINE+=("${icon}|${label}|${ref}")
+}
+
+add_build_matrix_entry() {
+ local icon="$1"
+ local label="$2"
+ local artifact="$3"
+ SUMMARY_BUILD_MATRIX+=("${icon}|${label}|${artifact}")
+}
+
+print_summary() {
+ local exit_code="$1"
+ local commit="${JCI_COMMIT:-unknown}"
+ local short_sha="${commit:0:12}"
+ local overall_icon="🟢"
+ [[ "${exit_code}" -ne 0 ]] && overall_icon="🔴"
+
+ printf "╔ %s : %s [sha %s]\n" "${overall_icon}" "${PIPELINE_NAME}" "${short_sha}"
+ echo "┏━ Pipeline"
+ echo "┃"
+
+ if [[ ${#SUMMARY_PIPELINE[@]} -eq 0 ]]; then
+ echo "┃ ⚪ : Pipeline exited before recording any steps"
+ else
+ for entry in "${SUMMARY_PIPELINE[@]}"; do
+ IFS='|' read -r icon label ref <<< "${entry}"
+ printf "┃ %s : %-20s [%s]\n" "${icon}" "${label}" "${ref}"
+ done
+ fi
+
+ if [[ ${#SUMMARY_BUILD_MATRIX[@]} -gt 0 ]]; then
+ echo "┃"
+ printf "┃ 🧱 Build Matrix (%d targets)\n" "${#SUMMARY_BUILD_MATRIX[@]}"
+ for entry in "${SUMMARY_BUILD_MATRIX[@]}"; do
+ IFS='|' read -r icon label artifact <<< "${entry}"
+ printf "┃ %s : %-18s [%s]\n" "${icon}" "${label}" "${artifact}"
+ done
+ fi
+
+ echo "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
+}
+
+run_step() {
+ local label="$1"
+ local ref="$2"
+ shift 2
+
+ set +e
+ "$@"
+ local exit_code=$?
+ set -e
+
+ local icon="🟢"
+ [[ ${exit_code} -ne 0 ]] && icon="🔴"
+ add_pipeline_summary "${icon}" "${label}" "${ref}"
+
+ return ${exit_code}
+}
# ---------------------------------------------------------------------------
# Helper: build one binary inside its own Docker container.
@@ -23,7 +86,8 @@ cd "$JCI_REPO_ROOT"
# Each invocation is fire-and-forget (&); collect PIDs for later wait.
# ---------------------------------------------------------------------------
PIDS=()
-TARGETS=() # human-readable label per job, index-matched to PIDS
+TARGETS=() # human-readable label per job, index-matched to PIDS
+TARGET_ARTIFACTS=()
build_target() {
local goos="$1"
@@ -47,17 +111,27 @@ build_target() {
&
PIDS+=($!)
- TARGETS+=("${label} → bin/${output_name}")
+ TARGETS+=("${label}")
+ TARGET_ARTIFACTS+=("${output_name}")
}
+trap 'print_summary $?' EXIT
+
+echo "=== JCI CI Pipeline ==="
+echo "Commit: ${JCI_COMMIT:0:12}"
+echo ""
+
+cd "$JCI_REPO_ROOT"
+
# ---------------------------------------------------------------------------
echo "--- Step 1: Updating code with latest VERSION ---"
-scripts/sync_version.sh
+run_step "Sync Version" "scripts/sync_version.sh" scripts/sync_version.sh
+echo ""
# Step 1: Build Docker image (sequential — other steps depend on it)
# ---------------------------------------------------------------------------
echo "--- Step 2: Building Docker image via scripts/build_image.sh ---"
-scripts/build_image.sh
+run_step "Build Image" "scripts/build_image.sh" scripts/build_image.sh
echo ""
# ---------------------------------------------------------------------------
@@ -90,20 +164,28 @@ FAILED=0
for i in "${!PIDS[@]}"; do
pid="${PIDS[$i]}"
label="${TARGETS[$i]}"
+ artifact="${TARGET_ARTIFACTS[$i]}"
if wait "${pid}"; then
- echo "[OK] ${label}"
+ echo "[OK] ${label} → bin/${artifact}"
+ add_build_matrix_entry "🟢" "${label}" "${artifact}"
else
- echo "[FAIL] ${label}"
+ echo "[FAIL] ${label} → bin/${artifact}"
+ add_build_matrix_entry "🔴" "${label}" "${artifact}"
FAILED=$((FAILED + 1))
fi
done
echo ""
+
+total_targets=${#TARGETS[@]}
if [[ "${FAILED}" -gt 0 ]]; then
echo "${FAILED} build(s) failed. See output above for details."
+ add_pipeline_summary "🔴" "Build Matrix" "${FAILED}/${total_targets} failed"
exit 1
fi
+add_pipeline_summary "🟢" "Build Matrix" "${total_targets} targets"
+
echo "All binaries built successfully:"
ls -lh bin/git-jci-*
echo ""
@@ -112,7 +194,8 @@ echo ""
# Step 3: Build site (sequential — needs the binaries to be present)
# ---------------------------------------------------------------------------
echo "--- Step 4: Building site inside jci container ---"
-docker run --rm -v "$PWD:/tmp/Jaypore CI" jci "/tmp/Jaypore CI/scripts/build_site.sh"
+run_step "Docs & Site" "scripts/build_site.sh" \
+ docker run --rm -v "$PWD:/tmp/Jaypore CI" jci "/tmp/Jaypore CI/scripts/build_site.sh"
echo ""
echo "All steps completed successfully!"