[do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch#780
[do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch#780cameroncooke wants to merge 17 commits intomainfrom
Cameroncooke/snapshots ci branch#780Conversation
📸 Snapshot Test72 unchanged
🛸 Powered by Emerge Tools |
Sentry Build Distribution
|
7502a1a to
beb2055
Compare
ios/HackerNews.xcodeproj/xcshareddata/xcschemes/HackerNews.xcscheme
Outdated
Show resolved
Hide resolved
…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>
537b41f to
4b99f38
Compare
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>
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>
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>
| pull_request: | ||
| branches: [main] | ||
| paths: [ios/**, .github/workflows/ios*] |
There was a problem hiding this comment.
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.
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>
| - name: List generated images | ||
| run: | | ||
| echo "Generated snapshot images:" | ||
| ls -1 snapshot-images/ | ||
| echo "Total: $(ls -1 snapshot-images/ | wc -l | tr -d ' ') images" |
There was a problem hiding this comment.
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.
-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>
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/