P3.1: iOS goldens @2x + PNG optimizer + Makefile record/verify targets
- SnapshotGalleryTests rendered at displayScale: 2.0 (was native 3.0)
→ 49MB → 15MB (~69% reduction)
- Records via SNAPSHOT_TESTING_RECORD=1 env var (no code edits needed)
- scripts/optimize_goldens.sh runs zopflipng (or pngcrush fallback)
over both iOS and Android golden dirs
- scripts/{record,verify}_snapshots.sh one-command wrappers
- Makefile targets: make {record,verify,optimize}-snapshots
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
57
scripts/verify_snapshots.sh
Executable file
57
scripts/verify_snapshots.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# verify_snapshots.sh — verify every parity-gallery golden matches the
|
||||
# current code. Use as a pre-commit / CI gate.
|
||||
#
|
||||
# Exits non-zero if either platform's gallery drifts from its committed
|
||||
# baseline. Diff artifacts land under each platform's usual report dir:
|
||||
# Android: composeApp/build/outputs/roborazzi/
|
||||
# iOS: ~/Library/Developer/Xcode/DerivedData/.../HoneyDueTests/
|
||||
#
|
||||
# Usage
|
||||
# -----
|
||||
# ./scripts/verify_snapshots.sh # both platforms
|
||||
# ./scripts/verify_snapshots.sh --ios-only
|
||||
# ./scripts/verify_snapshots.sh --android-only
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
platform="both"
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--ios-only) platform="ios" ;;
|
||||
--android-only) platform="android" ;;
|
||||
-h|--help)
|
||||
sed -n '3,14p' "$0"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [--ios-only|--android-only]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ---------- Android ----------
|
||||
if [ "$platform" = "both" ] || [ "$platform" = "android" ]; then
|
||||
echo "==> Verifying Android goldens…"
|
||||
./gradlew :composeApp:verifyRoborazziDebug
|
||||
fi
|
||||
|
||||
# ---------- iOS ----------
|
||||
if [ "$platform" = "both" ] || [ "$platform" = "ios" ]; then
|
||||
echo "==> Verifying iOS goldens…"
|
||||
(
|
||||
cd iosApp
|
||||
xcodebuild test \
|
||||
-project honeyDue.xcodeproj \
|
||||
-scheme HoneyDue \
|
||||
-destination "${IOS_SIM_DESTINATION:-platform=iOS Simulator,name=iPhone 17,OS=latest}" \
|
||||
-only-testing:HoneyDueTests/SnapshotGalleryTests \
|
||||
2>&1 | tail -30
|
||||
)
|
||||
fi
|
||||
|
||||
echo "==> All snapshot checks passed."
|
||||
Reference in New Issue
Block a user