From 85f1ecabd7f58f306b2a042376209ac8cf49ab9b Mon Sep 17 00:00:00 2001 From: cirakg Date: Sun, 18 Oct 2026 21:10:37 +0200 Subject: 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 --- docker/scripts/screenshots.sh | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 docker/scripts/screenshots.sh (limited to 'docker/scripts/screenshots.sh') 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/.png (the watch screen only), plus a +# -diff.png when it differs from test/golden/.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: $*" -- cgit v1.2.3