@@ -9,10 +9,27 @@ concurrency:
99 cancel-in-progress : true
1010
1111jobs :
12+ changes :
13+ name : Detect changes
14+ runs-on : ubuntu-latest
15+ outputs :
16+ native : ${{ steps.filter.outputs.native }}
17+ steps :
18+ - uses : actions/checkout@v5
19+ - uses : dorny/paths-filter@v3
20+ id : filter
21+ with :
22+ filters : |
23+ native:
24+ - 'ios/**'
25+ - 'yarn.lock'
26+
1227 build-ios :
1328 name : Build iOS App
14- runs-on : macos-latest
15- timeout-minutes : 45
29+ needs : changes
30+ if : needs.changes.outputs.native == 'true'
31+ runs-on : macos-latest-xlarge
32+ timeout-minutes : 75
1633
1734 steps :
1835 - name : Checkout
2239 uses : actions/setup-node@v5
2340 with :
2441 node-version-file : ' .node-version'
25- cache : ' yarn'
42+
43+ - name : Cache node_modules
44+ id : cache-node-modules
45+ uses : actions/cache@v4
46+ with :
47+ path : node_modules
48+ key : node-modules-${{ hashFiles('yarn.lock') }}
2649
2750 - name : Install dependencies
51+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
2852 run : yarn install --frozen-lockfile
2953
3054 - name : Create env file
@@ -54,59 +78,106 @@ jobs:
5478 with :
5579 path : ios/Pods
5680 key : pods-${{ hashFiles('ios/Podfile.lock') }}
57- restore-keys : pods-
5881
5982 - name : Install CocoaPods
60- run : |
61- cd ios
62- bundle exec pod install
83+ run : cd ios && bundle exec pod install
84+
85+ - name : Select Xcode
86+ run : sudo xcode-select -switch /Applications/Xcode_16.2.app
87+
88+ - name : Get Xcode version
89+ run : echo "XCODE_VERSION=$(xcodebuild -version | head -1 | tr ' ' '-')" >> $GITHUB_ENV
6390
6491 - name : Cache Xcode build products
6592 uses : actions/cache@v4
6693 with :
6794 path : ios/build/Build/Products
68- key : xcode-products-${{ runner.os }}-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }}
69- restore-keys : xcode-products-${{ runner.os }}-
95+ key : xcode-products-${{ runner.os }}-${{ env.XCODE_VERSION }}-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }}
7096
71- - name : Select Xcode
72- run : sudo xcode-select -switch /Applications/Xcode.app
97+ - name : Boot simulator for build
98+ run : |
99+ UDID=$(xcrun simctl list devices available | grep -E "iPhone [0-9]" | head -1 | grep -E -o '\(([0-9A-F-]+)\)' | tr -d '()')
100+ echo "Booting simulator: $UDID"
101+ xcrun simctl boot "$UDID" || true
102+ xcrun simctl bootstatus "$UDID" -b
103+ echo "BUILD_SIMULATOR_UDID=$UDID" >> $GITHUB_ENV
73104
74105 - name : Build iOS app for simulator
75106 env :
76107 SENTRY_DISABLE_AUTO_UPLOAD : true
108+ NODE_OPTIONS : " --max_old_space_size=8192"
77109 run : |
78110 xcodebuild \
79111 -workspace ios/BitPayApp.xcworkspace \
80112 -scheme BitPayApp \
81113 -configuration Debug \
82114 -sdk iphonesimulator \
83115 -derivedDataPath ios/build \
84- -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
116+ -destination "id=$BUILD_SIMULATOR_UDID" \
85117 SWIFT_ACTIVE_COMPILATION_CONDITIONS="DEBUG MAESTRO" \
118+ FORCE_BUNDLING=YES \
119+ ONLY_ACTIVE_ARCH=YES \
120+ CLANG_MODULES_VALIDATE_SYSTEM_HEADERS=NO \
86121 build
87122
88- - name : Upload app artifact
89- uses : actions/upload-artifact@v5
123+ - name : Save . app to cache
124+ uses : actions/cache/save@v4
90125 with :
91- name : ios-app-simulator
92126 path : ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app
93- retention-days : 1
127+ key : ios-app-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }}
94128
95129 test-ios :
96130 name : E2E iOS Smoke
97- needs : build-ios
98- runs-on : macos-latest
131+ needs : [changes, build-ios]
132+ if : always() && (needs.build-ios.result == 'success' || needs.build-ios.result == 'skipped')
133+ runs-on : macos-latest-xlarge
99134 timeout-minutes : 30
100135
101136 steps :
102137 - name : Checkout
103138 uses : actions/checkout@v5
104139
105- - name : Download app artifact
106- uses : actions/download-artifact@v4
140+ - name : Setup Node
141+ uses : actions/setup-node@v5
142+ with :
143+ node-version-file : ' .node-version'
144+
145+ - name : Cache node_modules
146+ id : cache-node-modules
147+ uses : actions/cache@v4
148+ with :
149+ path : node_modules
150+ key : node-modules-${{ hashFiles('yarn.lock') }}
151+
152+ - name : Install dependencies
153+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
154+ run : yarn install --frozen-lockfile
155+
156+ - name : Create env file
157+ env :
158+ ENV_FILE : ${{ secrets.ENV_DEVELOPMENT }}
159+ run : |
160+ echo "$ENV_FILE" > .env.development
161+ echo "IS_MAESTRO=true" >> .env.development
162+
163+ - name : Restore .app from cache
164+ uses : actions/cache/restore@v4
107165 with :
108- name : ios-app-simulator
109- path : BitPayApp.app
166+ path : ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app
167+ key : ios-app-${{ hashFiles('ios/Podfile.lock', 'yarn.lock') }}
168+ fail-on-cache-miss : true
169+
170+ - name : Bundle JS and inject into app
171+ env :
172+ NODE_OPTIONS : " --max_old_space_size=8192"
173+ run : |
174+ npx react-native bundle \
175+ --platform ios \
176+ --dev false \
177+ --entry-file index.js \
178+ --bundle-output main.jsbundle \
179+ --assets-dest ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app
180+ cp main.jsbundle ios/build/Build/Products/Debug-iphonesimulator/BitPayApp.app/main.jsbundle
110181
111182 - name : Cache Maestro
112183 uses : actions/cache@v4
@@ -122,14 +193,14 @@ jobs:
122193
123194 - name : Boot simulator
124195 run : |
125- UDID=$(xcrun simctl list devices available | grep "iPhone 16" | head -1 | grep -E -o '\(([0-9A-F-]+)\)' | tr -d '()')
196+ UDID=$(xcrun simctl list devices available | grep -E "iPhone [0-9]" | head -1 | grep -E -o '\(([0-9A-F-]+)\)' | tr -d '()')
197+ echo "Booting simulator: $UDID"
126198 xcrun simctl boot "$UDID"
127- # Wait until simulator is fully booted before proceeding
128199 xcrun simctl bootstatus "$UDID" -b
129200 echo "SIMULATOR_UDID=$UDID" >> $GITHUB_ENV
130201
131202 - name : Install app on simulator
132- run : xcrun simctl install "$SIMULATOR_UDID" BitPayApp.app
203+ run : xcrun simctl install "$SIMULATOR_UDID" ios/build/Build/Products/Debug-iphonesimulator/ BitPayApp.app
133204
134205 - name : Run Maestro smoke tests
135206 run : maestro test .maestro/flows/ --format junit --output maestro-results.xml
0 commit comments