oficina / base Public

Clone
git clone https://amadan.net/oficina/base

Plain git — no account needed to clone.

Download

Download this file

1#!/bin/sh
2# Base's screenshot gate (rastrillo/native RastrilloSnapshots): the look
3# (the sky at its still pose, the surfaces, the type scale, the marks) and
4# Ask (the mockups' thread, its states and cards), light and dark, and on
5# iPhone at the default size and AX3.
6#
7# native/scripts/snapshots.sh [compare|record] [mac|iphone|all]
8#
9# compare (the default) fails on any changed, missing or stale picture;
10# record redraws the baselines in apple/Tests/BaseSnapshots/__Snapshots__/.
11# Review the contact sheets, apple/.build/snapshots/base-*/index.html,
12# before committing a recording, beside the approved mockups
13# (.superpowers/mockups/native/, git-ignored).
14#
15# Not in .amadan/ci.d: baselines are exact only on the OS and simulator
16# runtime that drew them (ENVIRONMENT beside them says which). The runner
17# scripts are rastrillo/native's own, from the pinned checkout; the iPhone
18# half runs on its "Rastrillo Snapshots" simulator under its lock. Drawn
19# with Timeless Sans when `make fonts` has fetched it; a run without it
20# draws DM Sans, and fails against baselines drawn in Timeless.
21set -eu
22cd "$(dirname "$0")/.."
23mode=${1:-compare}
24platforms=${2:-all}
25case "$mode" in compare|record) ;; *) echo "usage: $0 [compare|record] [mac|iphone|all]" >&2; exit 2 ;; esac
26case "$platforms" in mac|iphone|all) ;; *) echo "usage: $0 [compare|record] [mac|iphone|all]" >&2; exit 2 ;; esac
27scripts/fonts-into-bundle.sh
28swift package --package-path apple resolve
29shared=${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}
30case "$shared" in /*) ;; *) shared="$(pwd)/$shared" ;; esac
31tools="$shared/tools"
32
33failed=0
34case "$platforms" in mac|all)
35 (cd apple && swift build --build-tests)
36 if ! (cd apple && "$tools/snapshots-mac.sh" "$mode" BaseSnapshots); then failed=1; fi ;;
37esac
38case "$platforms" in iphone|all)
39 xcodegen generate --spec ios/project.yml
40 if ! (cd apple && SNAPSHOT_DERIVED_DATA=.build/xcode "$tools/snapshots-iphone.sh" "$mode" BasePhoneSnapshots BasePhoneSnapshots \
41 -project ../ios/BasePhone.xcodeproj -test-timeouts-enabled YES -default-test-execution-time-allowance 120); then
42 failed=1
43 fi ;;
44esac
45exit "$failed"
46