Skip to content

Upload Snapshots to Sentry using SnapshotPreview and SwiftSnapshotTesting libraries#780

Merged
cameroncooke merged 7 commits intomainfrom
cameroncooke/snapshots-ci
Apr 23, 2026
Merged

Upload Snapshots to Sentry using SnapshotPreview and SwiftSnapshotTesting libraries#780
cameroncooke merged 7 commits intomainfrom
cameroncooke/snapshots-ci

Conversation

@cameroncooke
Copy link
Copy Markdown
Contributor

@cameroncooke cameroncooke commented Apr 1, 2026

Add dedicated iOS snapshot upload pipelines for Sentry.

We want snapshot artifacts from both SnapshotPreviews and Swift Snapshot Testing in Sentry without piggybacking on the existing Emerge upload job. This PR adds dedicated Fastlane lanes and GitHub Actions workflows for each snapshot source, updates the preview target devices to match the current simulator lineup, and centralizes the runtime checks used to keep snapshot output deterministic during preview and snapshot runs.

I kept the Sentry uploads as separate workflows instead of extending the Emerge pipeline further. That keeps each job single-purpose, lets the SnapshotPreviews flow build once and fan out across multiple simulators, and preserves the Swift Snapshot Testing flow as a record-and-upload path with its own wiring.

Additional review context:

  • the SnapshotPreviews workflow now builds once, shares the build products across simulator jobs, and uploads the aggregated PNGs to Sentry in a final step
  • the Swift Snapshot Testing path now records snapshots in CI and uploads them through a dedicated fastlane lane
  • snapshot-specific runtime checks now go through a shared helper instead of repeating environment lookups in multiple places

Latest run

https://github.com/EmergeTools/hackernews/actions/runs/24782255032

Comment thread .github/scripts/ios/emerge-snapshots Outdated
@emerge-tools
Copy link
Copy Markdown

emerge-tools Bot commented Apr 3, 2026

📸 Snapshot Test

1 modified, 43 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
HackerNews
com.emergetools.hackernews.snapshots
0 0 1 0 43 0 ⏳ Needs approval

🛸 Powered by Emerge Tools

@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 3, 2026

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
HackerNews com.emergetools.hackernews 3.10 (1) Release
HackerNews com.emergetools.hackernews 3.10 (1) AdHoc

⚙️ launchpad-test-ios Build Distribution Settings

Comment thread .github/scripts/ios/emerge-snapshots Outdated
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch 3 times, most recently from 7502a1a to beb2055 Compare April 7, 2026 09:59
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread ios/HackerNews.xcodeproj/xcshareddata/xcschemes/HackerNews.xcscheme Outdated
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch from 537b41f to 4b99f38 Compare April 7, 2026 11:11
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread ios/HackerNews.xcodeproj/project.pbxproj Outdated
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 15, 2026

Sentry Snapshot Testing

Name Added Removed Modified Renamed Unchanged Skipped Status
com.emergetools.hackernews
com.emergetools.hackernews
132 18 0 0 0 0 ✅ Approved

⚙️ hackernews-ios Snapshot Settings

Comment thread ios/HackerNews.xcodeproj/project.pbxproj Outdated
Comment thread ios/HackerNewsTests/SwiftSnapshotTest.swift
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread .github/workflows/ios_sentry_upload_swift_snapshots.yml
@NicoHinderling NicoHinderling changed the title [do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch Use SnapshotPreviews from Cameroncooke/snapshots ci branch Apr 16, 2026
@cameroncooke cameroncooke changed the title Use SnapshotPreviews from Cameroncooke/snapshots ci branch Upload Snapshots to Sentry using SnapshotPreview and SwiftSnapshotTesting libraries Apr 17, 2026
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml Outdated
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch 2 times, most recently from d1159c3 to 9cf7428 Compare April 22, 2026 12:00
Comment thread .github/workflows/ios_sentry_upload_snapshots.yml
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch from 9cf7428 to bb707f6 Compare April 22, 2026 12:10
Comment thread ios/Packages/Common/Sources/Common/AppRuntime.swift
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch 2 times, most recently from d07af60 to 09fa151 Compare April 22, 2026 13:53
Comment thread ios/HackerNews/Utils/Previews.swift Outdated
Replace repeated environment checks with a shared AppRuntime helper
and reuse it across app startup and date rendering.

Remove the test-level forced snapshot recording override so recording can
be controlled by the execution environment instead of hardcoded test
behavior.
Drop the invokeTest override that wrapped every test in withSnapshotTesting(record: .all), which forced all snapshots to re-record and fail on each run. CI workflows should prefer setting `TEST_RUNNER_SNAPSHOT_TESTING_RECORD` to achive the same effect. This allows local tets runs to do local diffing against local snapshots and CI to record snapshots which is needed for Sentry, and where Sentry will do the image diffing.
Update the SnapshotPreviews package pin to the latest revision on main to pick up upstream changes.
Add dedicated fastlane lanes for SnapshotPreviews and Swift Snapshot
Testing uploads to Sentry.

Pin the newer sentry fastlane plugin version and check in the local Ruby
version used for the iOS tooling setup.
Add dedicated GitHub Actions workflows for uploading SnapshotPreviews and Swift Snapshot Testing outputs to Sentry.

Remove the old Sentry upload step from the Emerge snapshots workflow so each pipeline has a single responsibility.
Replace TEST_RUNNER_XCODE_RUNNING_FOR_PREVIEWS with
TEST_RUNNER_EMERGE_IS_RUNNING_FOR_SNAPSHOTS in both snapshot upload jobs, using TEST_RUNNER_XCODE_RUNNING_FOR_PREVIEWS causes transparent images downstream at the render stage.
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch from fc3bf60 to a96d585 Compare April 23, 2026 09:10
@cameroncooke cameroncooke merged commit 30434f9 into main Apr 23, 2026
14 of 15 checks passed
@cameroncooke cameroncooke deleted the cameroncooke/snapshots-ci branch April 23, 2026 10:25
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.

2 participants