Skip to content

CI: before/after Live Activity previews on pull requests - #14

Draft
R44VC0RP wants to merge 3 commits into
mainfrom
ci/live-activity-previews
Draft

R44VC0RP wants to merge 3 commits into
mainfrom
ci/live-activity-previews

Conversation

@R44VC0RP

Copy link
Copy Markdown
Owner

Adds a workflow that renders every Live Activity style a PR touches on an iPhone 17 Pro simulator (iOS 27), before and after the change, and posts them as one comment: Lock Screen, minimized Dynamic Island and expanded Dynamic Island per style.

How it works

  • Live Activity previews runs on PRs that touch apps/expo/src/widgets/**, contracts, the expo-widgets patch or this tooling, on the xcode-27 runner with read-only permissions. It picks the affected styles (a changed style plus every style that reuses it), builds the debug app with ad-hoc signing, captures "before" on the base commit's widget code and "after" on the PR's, and uploads the PNGs.
  • Live Activity previews comment runs from main with write access and never executes PR code. It checks the PR's head matches the captured commit, stores validated PNGs on the live-activity-preview-images branch and updates one comment per PR.
  • serve-sim is built from R44VC0RP/serve-sim at a pinned commit (hark-ci): the npm release lacks the state command and the Xcode 27 touch routing the long-press needs.

Testing
Verified locally as CI would run it (fresh worktree, build-app.sh, new simulator, run.sh for approval, standard and verdict). This PR changes the tooling, so it should capture all nine styles as its first real run. The comment step only starts working once this is merged, because workflow_run workflows run from the default branch; until then the images are in the run's live-activity-previews artifact.

Known
The debug build sometimes crashes on launch (expo-notifications NotificationCenterManager.addDelegate, an ExpoFabricView assertion). run.sh relaunches when the app process disappears.

A pull request that touches Live Activity code now gets a comment with each
affected style rendered on an iPhone 17 Pro simulator (iOS 27) before and
after the change: Lock Screen, minimized Dynamic Island, expanded Dynamic
Island, stacked as one 1206x1222 image per style.

"Live Activity previews" (pull_request, read-only, xcode-27 runner):
- affected-styles.mjs picks the styles: a changed style file plus every
  style that reuses it (found by scanning for `standard.`/`approval.`
  references), or all styles when shared widget code, contracts, the
  expo-widgets patch or this tooling changes.
- build-app.sh builds the debug app for the simulator with ad-hoc signing,
  which keeps the widget extension's App Group without an Apple account.
- run.sh swaps apps/expo/src/widgets and packages/contracts/src to the base
  commit, captures "before" through Metro, restores the PR's code and
  captures "after", all on one native build.
- capture.sh is the existing capture-la.sh flow with frames read from
  serve-sim's MJPEG stream by frame.py (Pillow, since the runner has no
  ffmpeg). open-url.sh and tap-label.sh accept a fresh simulator's
  'Open in "Hark"?' and "Allow Live Activities" prompts.
- The debug build sometimes crashes on launch (expo-notifications
  NotificationCenterManager.addDelegate, ExpoFabricView assertion); run.sh
  relaunches when the app process disappears.
- serve-sim is built from Ryan's fork at a pinned commit: npm's 0.1.48 has
  no `state` command and sends touches to the target Xcode 27 ignores.

"Live Activity previews comment" (workflow_run, write access, default
branch only) never runs PR code: it checks that the PR's head is the
captured commit, copies only validated PNGs to the
live-activity-preview-images branch and updates one marked comment.

Verified locally as CI would run it: fresh worktree, pnpm install,
build-app.sh (BUILD SUCCEEDED, ~4 min on this Mac), a new simulator from
setup-sim.sh, then run.sh for approval+standard and for verdict against
a812cab~1. Outputs were 1206x1222 before/after pairs showing the expected
changes; comment.mjs rendered the table. affected-styles.mjs on b05c813,
a812cab, 758a2d0 and db73330 gave all, the four approval styles, all, and
none. shellcheck is clean; actionlint only flags the new xcode-27 label.
The workflows themselves have not run on GitHub yet.
The first run on the xcode-27 runner built the app but `simctl create` for
the iPhone 17 Pro failed with "Incompatible device" on the runner's newest
iOS runtime. setup-sim.sh now falls back to the iPhone 18 Pro, which has the
same 1206x2622 screen the crops assume and is preinstalled on the image,
and logs the runtime, the device type it used, and the device types when
neither works.

The failure surfaced only in the next step as `Invalid device: ` because
`echo "udid=$(setup-sim.sh | tail -1)"` swallowed the script's exit status.
Both workflows now run steps with `shell: bash` (-eo pipefail) and the build
and boot steps assign the script output before writing it, failing on an
empty UDID.

Verified: an iPhone 18 Pro simulator here captures 1206x2622 frames;
shellcheck is clean and actionlint only flags the xcode-27 label.
The second run picked the newest runtime, iOS 27.1, which the runner's
default Xcode 27.0 can't create devices on, so both the iPhone 17 Pro and
the 18 Pro fallback failed. setup-sim.sh now tries the runtime matching
`xcrun --sdk iphonesimulator --show-sdk-version` first, then the others
newest first, each with both device types.

Verified locally: SDK 27.0 orders iOS-27-0 before iOS-26-5 and creates an
iPhone 17 Pro; shellcheck is clean.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant