-
Notifications
You must be signed in to change notification settings - Fork 24
[do not merge] Use SnapshotPreviews from Cameroncooke/snapshots ci branch
#780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c2b918e
56fdd63
81230e5
676b945
4b99f38
5f81e4c
1c63516
86400e6
1a07a3c
5a524f3
4693c5c
7832aa8
7ffad21
887a063
05b0f54
bf734e6
d363a7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: Sentry iOS Upload (Snapshots) | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: [ios/**, .github/workflows/ios*] | ||
| pull_request: | ||
| branches: [main] | ||
| paths: [ios/**, .github/workflows/ios*] | ||
|
|
||
| jobs: | ||
| upload_sentry_snapshots: | ||
| runs-on: macos-26 | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./ios | ||
|
|
||
| env: | ||
| TEST_RUNNER_SNAPSHOTS_EXPORT_DIR: "${{ github.workspace }}/ios/snapshot-images" | ||
| XCODE_RUNNING_FOR_PREVIEWS: 1 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Ruby env | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: 3.3.10 | ||
| bundler-cache: true | ||
|
|
||
| - name: Setup gems | ||
| run: exec ../.github/scripts/ios/setup.sh | ||
|
|
||
| - name: Boot iPhone simulator | ||
| run: xcrun simctl boot "iPhone 17 Pro Max" || true | ||
|
|
||
| - name: Cache Swift Package Manager | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/Library/Caches/org.swift.swiftpm | ||
| ~/Library/Developer/Xcode/DerivedData/HackerNews-*/SourcePackages | ||
| key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||
| restore-keys: ${{ runner.os }}-spm- | ||
|
|
||
| - name: Generate snapshot images (iPhone) | ||
| run: | | ||
| set -o pipefail && xcodebuild test \ | ||
| -scheme HackerNews \ | ||
| -sdk iphonesimulator \ | ||
| -destination 'platform=iOS Simulator,name=iPhone 17 Pro Max,arch=arm64' \ | ||
| -only-testing:HackerNewsTests/HackerNewsSnapshotTest \ | ||
| -resultBundlePath ../SnapshotResults-iphone.xcresult \ | ||
| -skipPackagePluginValidation \ | ||
| ONLY_ACTIVE_ARCH=YES \ | ||
| TARGETED_DEVICE_FAMILY=1 \ | ||
| SUPPORTS_MACCATALYST=NO \ | ||
| CODE_SIGNING_ALLOWED=NO \ | ||
| COMPILATION_CACHING=YES \ | ||
| EAGER_LINKING=YES \ | ||
| FUSE_BUILD_SCRIPT_PHASES=YES \ | ||
| | xcpretty | ||
|
|
||
| # - name: Boot iPad simulator | ||
| # run: xcrun simctl boot "iPad Air 11-inch (M3)" || true | ||
|
|
||
| # - name: Generate snapshot images (iPad) | ||
| # run: | | ||
| # set -o pipefail && xcodebuild test \ | ||
| # -scheme HackerNews \ | ||
| # -sdk iphonesimulator \ | ||
| # -destination 'platform=iOS Simulator,name=iPad Air 11-inch (M3)' \ | ||
| # -only-testing:HackerNewsTests/HackerNewsSnapshotTest \ | ||
| # -resultBundlePath ../SnapshotResults-ipad.xcresult \ | ||
| # ONLY_ACTIVE_ARCH=YES \ | ||
| # TARGETED_DEVICE_FAMILY="1,2" \ | ||
| # SUPPORTS_MACCATALYST=NO \ | ||
| # | xcpretty | ||
|
|
||
| - name: List generated images | ||
| run: | | ||
| echo "Generated snapshot images:" | ||
| ls -1 snapshot-images/ | ||
| echo "Total: $(ls -1 snapshot-images/ | wc -l | tr -d ' ') images" | ||
|
Comment on lines
+84
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Suggested FixAdd a defensive step to ensure the directory exists before listing its contents, such as Prompt for AI Agent |
||
|
|
||
| - name: Upload snapshots to Sentry | ||
| env: | ||
| SENTRY_SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} | ||
| run: bundle exec fastlane ios upload_sentry_preview_snapshots | ||
cameroncooke marked this conversation as resolved.
Show resolved
Hide resolved
cameroncooke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
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_TOKENare not available, causing the Sentry upload step to fail.Severity: MEDIUM
Suggested Fix
To fix this, consider running the Sentry upload step only on
pushevents to themainbranch, or use apull_request_targettrigger with appropriate security controls like environment approval gates. This ensures that steps requiring secrets only run in a trusted context.Prompt for AI Agent