ci(snapshots): Add selective iOS snapshot upload workflow#268
Conversation
Add a GitHub Actions workflow that builds, generates, and uploads iOS snapshot images to Sentry. The workflow maps changed paths to the relevant snapshot tests so pull requests only regenerate the snapshots affected by their changes, while pushes to main and unmatched changes fall back to the full test set. Build products are produced once via build-for-testing and shared across the snapshot generation and image-name jobs to avoid redundant builds. The aggregated images and image-name manifest are then uploaded with sentry-cli. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restrict the workflow token to read-only repository access and pass the Sentry project secret required by snapshot uploads. Co-Authored-By: Codex <noreply@openai.com>
|
Fixed the upload failure in 792838f by adding |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: PR diff uses wrong git range
- Changed git diff from two-dot to three-dot syntax (BASE_SHA...HEAD_SHA) to compare from merge-base, ensuring only PR changes are detected.
Or push these changes by commenting:
@cursor push ddd1930820
Preview (ddd1930820)
diff --git a/.github/workflows/ios_sentry_upload_snapshots.yml b/.github/workflows/ios_sentry_upload_snapshots.yml
--- a/.github/workflows/ios_sentry_upload_snapshots.yml
+++ b/.github/workflows/ios_sentry_upload_snapshots.yml
@@ -60,7 +60,7 @@
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
- changed_files="$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}")"
+ changed_files="$(git diff --name-only "${BASE_SHA}...${HEAD_SHA}")"
else
changed_files=""
fiYou can send follow-ups to the cloud agent here.
Check out the repository in the snapshot upload job so sentry-cli can detect git metadata automatically when uploading snapshots. Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing selective upload flag
- Added the --selective flag to the sentry-cli build snapshots command so Sentry correctly distinguishes between skipped and removed snapshots during partial test runs.
Or push these changes by commenting:
@cursor push a0e29d705d
Preview (a0e29d705d)
diff --git a/.github/workflows/ios_sentry_upload_snapshots.yml b/.github/workflows/ios_sentry_upload_snapshots.yml
--- a/.github/workflows/ios_sentry_upload_snapshots.yml
+++ b/.github/workflows/ios_sentry_upload_snapshots.yml
@@ -325,4 +325,5 @@
--auth-token "${SENTRY_AUTH_TOKEN}" \
--project "${SENTRY_PROJECT}" \
--app-id "${SENTRY_APP_ID}" \
- --all-image-file-names-file "${{ github.workspace }}/snapshot-image-names/all-image-names.txt"
+ --all-image-file-names-file "${{ github.workspace }}/snapshot-image-names/all-image-names.txt" \
+ --selectiveYou can send follow-ups to the cloud agent here.
Use the PR merge-base diff when selecting snapshot test classes. Fan out snapshot generation by selected test class so each class runs in its own GitHub Actions matrix job. This avoids shared dynamic preview state between test classes while keeping the test-without-building runs parallel in CI. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
Addressed the valid diff-range feedback in 1dddfd2 by switching snapshot test selection to the PR merge-base diff ( I intentionally did not add |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Nested artifacts mismatch manifest names
- Added merge-multiple: true to flatten snapshot artifacts into a single directory structure, aligning uploaded paths with the basename-only manifest entries.
Or push these changes by commenting:
@cursor push 9dca3dc870
Preview (9dca3dc870)
diff --git a/.github/workflows/ios_sentry_upload_snapshots.yml b/.github/workflows/ios_sentry_upload_snapshots.yml
--- a/.github/workflows/ios_sentry_upload_snapshots.yml
+++ b/.github/workflows/ios_sentry_upload_snapshots.yml
@@ -285,6 +285,7 @@
with:
path: ${{ env.SNAPSHOT_UPLOAD_BASE_DIR }}
pattern: snapshots-*
+ merge-multiple: true
- name: Download image names
uses: actions/download-artifact@v5You can send follow-ups to the cloud agent here.
Merge snapshot matrix artifacts into the upload root so uploaded image paths match the generated all-image-name file. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Sentry Snapshot Testing
No base snapshots found to compare against. Make sure snapshots are uploaded from your main branch. |
Run each full-coverage image-name test class in its own matrix job so it can execute alongside selected snapshot generation. Aggregate the per-class image-name artifacts before uploading to Sentry so the upload still receives one complete image-name file. Co-Authored-By: OpenAI Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Wrong manifest path for upload
- Replaced hardcoded path with ALL_IMAGE_NAMES_FILE environment variable to reference the correct manifest location in snapshot-images/ directory.
Or push these changes by commenting:
@cursor push d016d2878e
Preview (d016d2878e)
diff --git a/.github/workflows/ios_sentry_upload_snapshots.yml b/.github/workflows/ios_sentry_upload_snapshots.yml
--- a/.github/workflows/ios_sentry_upload_snapshots.yml
+++ b/.github/workflows/ios_sentry_upload_snapshots.yml
@@ -332,4 +332,4 @@
--auth-token "${SENTRY_AUTH_TOKEN}" \
--project "${SENTRY_PROJECT}" \
--app-id "${SENTRY_APP_ID}" \
- --all-image-file-names-file "${{ github.workspace }}/snapshot-image-names/all-image-names.txt"
+ --all-image-file-names-file "${{ env.ALL_IMAGE_NAMES_FILE }}"You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 1d487d1. Configure here.
Pass the merged all-image-name manifest produced by the upload job to sentry-cli. This keeps the parallel image-name jobs while ensuring Sentry receives the manifest path that the aggregation step actually writes. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Replace mapfile with a Bash 3.2-compatible read loop when collecting per-shard image-name manifests. macOS runners use Bash 3.2 by default, so mapfile is not available in the upload job. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Add explanatory comments to the snapshot upload workflow describing each job's role in the selective testing flow: how pull requests narrow the test set by changed paths, why image-name generation always runs the full suite, and how the aggregated manifest lets Sentry distinguish skipped snapshots from removed ones. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>


Adds a GitHub Actions workflow that uploads iOS snapshots from
Examples/MultiModuleDemoto Sentry.The workflow builds the test bundle once, reuses the generated
.xctestrunfor snapshot rendering, selects the relevant snapshot test group from pull request file changes, and uploads the rendered subset with a full image-name manifest so Sentry can distinguish rendered, skipped, and removed snapshots.Selective test selection
Pull requests touching
ModuleArun the Module A snapshot group. Pull requests touchingModuleBorModuleCrun the Module B/C snapshot group. Broader demo, source, or package changes run both groups.Sentry upload
The upload job requires
SENTRY_AUTH_TOKENandSENTRY_APP_IDrepository secrets. It installssentry-cli, aggregates rendered snapshot artifacts, downloads the generated full image-name list, and uploads with--all-image-file-names-file.