1+ name : Sentry iOS Upload (Snapshots)
2+
3+ on :
4+ push :
5+ branches : [main]
6+ paths : [ios/**, .github/workflows/ios*]
7+
8+ jobs :
9+ upload_sentry_snapshots :
10+ runs-on : macos-26
11+
12+ defaults :
13+ run :
14+ working-directory : ./ios
15+
16+ steps :
17+ - name : Checkout
18+ uses : actions/checkout@v6
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Set up Ruby env
23+ uses : ruby/setup-ruby@v1
24+ with :
25+ ruby-version : 3.3.10
26+ bundler-cache : true
27+
28+ - name : Setup gems
29+ run : exec ../.github/scripts/ios/setup.sh
30+
31+ - name : Cache Swift Package Manager
32+ uses : actions/cache@v4
33+ with :
34+ path : |
35+ ~/Library/Caches/org.swift.swiftpm
36+ ~/Library/Developer/Xcode/DerivedData/HackerNews-*/SourcePackages
37+ key : ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
38+ restore-keys : ${{ runner.os }}-spm-
39+
40+ - name : Boot simulator
41+ run : xcrun simctl boot "iPhone 17 Pro Max" || true
42+
43+ - name : Generate snapshot images (iPhone)
44+ run : |
45+ set -o pipefail && TEST_RUNNER_SNAPSHOTS_EXPORT_DIR="snapshot-images/" xcodebuild test \
46+ -scheme HackerNews \
47+ -sdk iphonesimulator \
48+ -destination 'platform=iOS Simulator,name=iPhone 17 Pro Max' \
49+ -only-testing:HackerNewsTests/HackerNewsSnapshotTest \
50+ -resultBundlePath ../SnapshotResults-iphone.xcresult \
51+ ONLY_ACTIVE_ARCH=YES \
52+ TARGETED_DEVICE_FAMILY=1 \
53+ SUPPORTS_MACCATALYST=NO \
54+ | xcpretty
55+
56+ - name : Generate snapshot images (iPad)
57+ run : |
58+ set -o pipefail && TEST_RUNNER_SNAPSHOTS_EXPORT_DIR="snapshot-images/" xcodebuild test \
59+ -scheme HackerNews \
60+ -sdk iphonesimulator \
61+ -destination 'platform=iOS Simulator,name=iPad Air 11-inch (M3)' \
62+ -only-testing:HackerNewsTests/HackerNewsSnapshotTest \
63+ -resultBundlePath ../SnapshotResults-ipad.xcresult \
64+ ONLY_ACTIVE_ARCH=YES \
65+ TARGETED_DEVICE_FAMILY="1,2" \
66+ SUPPORTS_MACCATALYST=NO \
67+ | xcpretty
68+
69+ - name : List generated images
70+ run : |
71+ echo "Generated snapshot images:"
72+ ls -1 snapshot-images/
73+ echo "Total: $(ls -1 snapshot-images/ | wc -l | tr -d ' ') images"
74+
75+ - name : Upload snapshots to Sentry
76+ env :
77+ SENTRY_SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }}
78+ run : bundle exec fastlane ios upload_sentry_preview_snapshots
0 commit comments