Skip to content

Commit 2120244

Browse files
force bundling
1 parent 4f8a704 commit 2120244

4 files changed

Lines changed: 119 additions & 37 deletions

File tree

.github/workflows/e2e-android.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: E2E Android
22

33
on:
4-
pull_request:
54
workflow_dispatch:
65

76
concurrency:

.github/workflows/e2e-ios.yml

Lines changed: 96 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,27 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
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
@@ -22,9 +39,16 @@ jobs:
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

.maestro/flows/onboarding_to_home.yaml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,41 @@ appId: com.bitpay.wallet
1313
id: "continue-without-an-account-button"
1414

1515
# Notifications screen
16-
- assertVisible:
17-
id: "set-notifications-view"
16+
- extendedWaitUntil:
17+
visible:
18+
id: "set-notifications-view"
19+
timeout: 15000
1820
- tapOn:
1921
id: "skip-button"
2022

2123
# Protect your wallet (security) screen
22-
- assertVisible:
23-
id: "security-view"
24+
- extendedWaitUntil:
25+
visible:
26+
id: "security-view"
27+
timeout: 15000
2428
- tapOn:
2529
id: "skip-button"
2630

2731
# Create key screen
28-
- assertVisible:
29-
id: "create-key-view"
32+
- extendedWaitUntil:
33+
visible:
34+
id: "create-key-view"
35+
timeout: 15000
3036
- tapOn:
3137
id: "i-already-have-a-key-button"
3238

3339
# Import screen - enter seed phrase
34-
- assertVisible:
35-
id: "import-view"
40+
- extendedWaitUntil:
41+
visible:
42+
id: "import-view"
43+
timeout: 15000
3644
- tapOn:
3745
id: "import-text-input"
3846
- inputText: "gown pizza sell law yard laundry gown action enemy speed embark awkward"
3947

40-
# Dismiss keyboard
41-
- hideKeyboard
48+
# Dismiss keyboard by tapping outside the input
49+
- tapOn:
50+
point: "50%,20%"
4251

4352
# Import wallet
4453
- tapOn:

ios/BitPayApp/AppDelegate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
104104
}
105105

106106
override func bundleURL() -> URL? {
107-
#if DEBUG
107+
#if MAESTRO
108+
// On CI there is no Metro server — use the embedded bundle (requires FORCE_BUNDLING=YES in xcodebuild)
109+
return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
110+
#elseif DEBUG
108111
return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
109112
#else
110113
return Bundle.main.url(forResource: "main", withExtension: "jsbundle")

0 commit comments

Comments
 (0)