aboutsummaryrefslogtreecommitdiff
path: root/docker/scripts/screenshots.sh
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-18 21:10:37 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-18 21:10:37 +0200
commit85f1ecabd7f58f306b2a042376209ac8cf49ab9b (patch)
tree00a0f3e2717e5c20ce0c427a979ef609a400d326 /docker/scripts/screenshots.sh
parent2071e2beda763137416ac386d4bb953711ec995d (diff)
build: complete the Docker pipeline for build, test, screenshots and packaging
- Container scripts now run from the mounted project (no image rebuild per script change): build-app.sh (strict -l 3, warnings fail), run-unit-tests.sh, screenshots.sh, app-diag.sh (perf/memory), lint.sh, package.sh and sim-vnc.sh (noVNC on 127.0.0.1:6080). - Headless simulator helpers: wait for port 1234, remove the stale single-instance lock (~/Sim-dev) that made later starts hang, show the simulator log on failure. - New targets: screenshots-approve, icons; `make lock` re-adds the requirements header; pytest treats warnings as errors. - Author/Summary headers on every build file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'docker/scripts/screenshots.sh')
-rwxr-xr-xdocker/scripts/screenshots.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/docker/scripts/screenshots.sh b/docker/scripts/screenshots.sh
new file mode 100755
index 0000000..3fc52f5
--- /dev/null
+++ b/docker/scripts/screenshots.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# Author: cirakg & claude ai
+# Summary: Screenshot the app on each device in the headless simulator and compare with the approved golden images.
+#
+# Usage: screenshots.sh DEVICE [DEVICE ...] (APPROVE=1 saves new goldens)
+# Output: build/screenshots/<DEVICE>.png (the watch screen only), plus a
+# <DEVICE>-diff.png when it differs from test/golden/<DEVICE>.png.
+set -euo pipefail
+# shellcheck source=ciq-env.sh
+source "$(dirname "${BASH_SOURCE[0]}")/ciq-env.sh"
+
+# Pause after the first frame, so animations and late redraws settle.
+readonly SETTLE_S=1
+
+(($# > 0)) || die "usage: screenshots.sh DEVICE [DEVICE ...]"
+ciq_require_sdk
+ciq_require_key
+
+for device in "$@"; do
+ build-app.sh debug "${device}"
+done
+
+ciq_start_display
+ciq_start_simulator
+
+out="${BUILD_DIR}/screenshots"
+mkdir -p "${out}"
+approve=()
+[[ "${APPROVE:-0}" == 1 ]] && approve=(--approve)
+failed=0
+for device in "$@"; do
+ if ! ciq_launch_app "${device}" "${out}/${device}.log"; then
+ ciq_stop_app
+ log "no first frame on ${device}; see build/screenshots/${device}.log"
+ failed=1
+ continue
+ fi
+ sleep "${SETTLE_S}"
+ mkdir -p "${out}/raw"
+ import -window "$(ciq_simulator_window)" "${out}/raw/${device}-window.png"
+ ciq_stop_app
+ python3 /work/tools/sim_screenshot.py --raw "${out}/raw/${device}-window.png" \
+ --device-dir "${CIQ_HOME}/Devices/${device}" --out "${out}/${device}.png" \
+ --golden "/work/test/golden/${device}.png" "${approve[@]}" || failed=1
+done
+
+((failed == 0)) || die "screenshot checks failed; see build/screenshots/"
+log "screenshots checked on: $*"