Skip to content

[do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch#780

Open
cameroncooke wants to merge 17 commits intomainfrom
cameroncooke/snapshots-ci
Open

[do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch#780
cameroncooke wants to merge 17 commits intomainfrom
cameroncooke/snapshots-ci

Conversation

@cameroncooke
Copy link
Copy Markdown

@cameroncooke cameroncooke commented Apr 1, 2026

This branch exists just to test the unreleased changes to SnapshowPreviews on the here: EmergeTools/SnapshotPreviews#252

See workflow run which is using SnapshotPreviews with CI export functionality:
https://github.com/EmergeTools/hackernews/actions/runs/23857485626/job/69554642234?pr=780

Resulting Sentry Snapshots URL:
https://sentry.sentry.io/preprod/snapshots/177173/

@emerge-tools
Copy link
Copy Markdown

emerge-tools bot commented Apr 3, 2026

📸 Snapshot Test

72 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
HackerNews
com.emergetools.hackernews.snapshots
0 0 0 0 72 0 N/A

🛸 Powered by Emerge Tools

@sentry
Copy link
Copy Markdown

sentry bot commented Apr 3, 2026

Sentry Build Distribution

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

Configure launchpad-test-ios build distribution settings

@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch 3 times, most recently from 7502a1a to beb2055 Compare April 7, 2026 09:59
cameroncooke and others added 5 commits April 7, 2026 12:11
…p crash

The test process working directory differs from the shell's, so a
relative path caused the SnapshotCIExportCoordinator to fail creating
the export directory, triggering a preconditionFailure (SIGTRAP) during
test bootstrapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ately

Move TEST_RUNNER_SNAPSHOTS_EXPORT_DIR and XCODE_RUNNING_FOR_PREVIEWS into
the job-level env block so both iPhone and iPad test steps share the same
absolute export path. Add a dedicated boot step for the iPad simulator and
clarify the existing boot step name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cameroncooke cameroncooke force-pushed the cameroncooke/snapshots-ci branch from 537b41f to 4b99f38 Compare April 7, 2026 11:11
Run the snapshot upload workflow on PRs targeting main in addition to
pushes, scoped to ios and workflow file paths for both triggers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cameroncooke and others added 2 commits April 7, 2026 12:33
Add upload_sentry_preview_snapshots lane that uploads snapshot images
generated by SnapshotPreviews to Sentry, separate from the existing
swift-snapshot-testing upload lane.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cameroncooke and others added 2 commits April 7, 2026 14:43
Add branch-scoped DerivedData caching and split the single xcodebuild
test into build-for-testing + test-without-building to improve CI
wall-clock time and give better visibility into build vs test duration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move sim boot before cache steps so it boots during cache restore
- Pin DerivedData to a fixed path with -derivedDataPath so cache
  reliably hits across runs
- Add -skipPackageUpdates to avoid ~2min SPM resolution (Package.resolved
  is committed)
- Enable COMPILATION_CACHING, EAGER_LINKING, FUSE_BUILD_SCRIPT_PHASES
  for faster incremental and zero-change builds
- Strip redundant build settings from test-without-building step
- Simplify SPM cache path (DD cache now covers SourcePackages)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +7 to +9
pull_request:
branches: [main]
paths: [ios/**, .github/workflows/ios*]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The workflow will fail on pull requests from forked repositories because secrets like SENTRY_SENTRY_AUTH_TOKEN are not available, causing the Sentry upload step to fail.
Severity: MEDIUM

Suggested Fix

To fix this, consider running the Sentry upload step only on push events to the main branch, or use a pull_request_target trigger with appropriate security controls like environment approval gates. This ensures that steps requiring secrets only run in a trusted context.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/ios_sentry_upload_snapshots.yml#L7-L9

Potential issue: The workflow is configured to trigger on `pull_request` events. For
pull requests originating from forked repositories, GitHub Actions does not provide
secrets for security reasons. As a result, the `SENTRY_SENTRY_AUTH_TOKEN` secret will be
an empty string. The `fastlane` action `upload_sentry_preview_snapshots` requires a
valid authentication token and will fail when the token is empty. This will cause the CI
workflow to fail for any external contributor submitting a pull request from a fork,
blocking their contribution.

cameroncooke and others added 4 commits April 8, 2026 09:42
DerivedData cache already contains SourcePackages, and
-skipPackageUpdates prevents xcodebuild from fetching. The SPM cache
was downloading 759MB for no benefit — removing it saves ~4 minutes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The split into build-for-testing + test-without-building was paying
~2min xcodebuild startup tax twice. For 23 snapshot tests that run in
10s, the visibility tradeoff isn't worth ~1min of added overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment on lines +83 to +87
- name: List generated images
run: |
echo "Generated snapshot images:"
ls -1 snapshot-images/
echo "Total: $(ls -1 snapshot-images/ | wc -l | tr -d ' ') images"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The workflow will fail if no snapshot images are generated because the ls command will error when the snapshot-images/ directory is not found.
Severity: MEDIUM

Suggested Fix

Add a defensive step to ensure the directory exists before listing its contents, such as mkdir -p snapshot-images, or add continue-on-error: true to the "List generated images" step to prevent a workflow failure.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/ios_sentry_upload_snapshots.yml#L83-L87

Potential issue: The workflow includes a step to list generated snapshot images using
`ls -1 snapshot-images/`. However, if the preceding snapshot generation step produces no
images, the `snapshot-images/` directory may not be created by the external
`cameroncooke/snapshot-ci` tool. The workflow does not defensively create this directory
or handle potential errors from the `ls` command. If the directory is absent, the `ls`
command will fail with a non-zero exit code, causing the entire workflow run to fail.

cameroncooke and others added 2 commits April 8, 2026 11:52
-skipPackageUpdates prevents xcodebuild from fetching new commits when
Package.resolved changes, causing failures. Since the DD cache is keyed
on branch name (not Package.resolved), we need to allow SPM to fetch
deltas. -skipPackagePluginValidation still skips plugin trust prompts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DerivedData cache download time was too variable (1.5-5 min) on GHA
network, often outweighing build savings. Restore the original SPM
cache which is smaller and more predictable. Keep COMPILATION_CACHING
and other build settings which work independently of DD caching.
Also removed -derivedDataPath to use default location (matches SPM
cache paths).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
xcodebuild was matching both arm64 and x86_64 for the same simulator,
triggering a warning and potentially slowing destination resolution.
Pinning arch=arm64 eliminates the ambiguity on Apple Silicon runners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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