Skip to content

Commit 97d9280

Browse files
Build React Native iOS E2E IPA artifact
Assisted-By: devx/6c1e3ad5-96c8-4972-b087-da7ff7b195c3
1 parent e5a9bbe commit 97d9280

3 files changed

Lines changed: 117 additions & 6 deletions

File tree

e2e/BITRISE.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The non-secret E2E defaults are defined in `e2e/bitrise.yml` under `app.envs`. D
6060
| `E2E_BROWSERSTACK_POLL_SECONDS` | `30` | BrowserStack status polling interval. |
6161
| `E2E_IOS_EXPORT_METHOD` | `development` | Export method for the React Native iOS IPA. |
6262
| `E2E_ANDROID_COMMAND_TIMEOUT_SECONDS` | `1800` | Per-command timeout for React Native Android artifact commands. |
63+
| `E2E_IOS_COMMAND_TIMEOUT_SECONDS` | `1800` | Per-command timeout for React Native iOS dependency, CocoaPods, archive, and export commands. |
6364
| `E2E_PACKAGE_COMMAND_TIMEOUT_SECONDS` | `300` | Per-command timeout for package-suite matrix and suite commands. |
6465
| `E2E_RUBY_INSTALL_TIMEOUT_SECONDS` | `1800` | Timeout for installing the exact repository Ruby version from `.ruby-version`. |
6566

@@ -87,7 +88,11 @@ Configure the Bitrise app to run the `e2e` pipeline for pull requests once the s
8788

8889
## Code signing
8990

90-
React Native iOS IPA generation is added in a later phase and will require Bitrise iOS code signing setup for the sample app.
91+
React Native iOS IPA generation uses Bitrise's certificate and profile installer before running `xcodebuild archive` and `xcodebuild -exportArchive`.
92+
93+
The React Native iOS artifact workflow overrides the default Linux stack and runs on `osx-xcode-26.0.x-edge` with `g2.mac.4large`, because it requires Xcode and iOS signing. Its cache keys are prefixed with `rn-ios-macos-` so macOS caches cannot restore Linux-built dependencies.
94+
95+
Upload the required signing certificate and provisioning profile for the React Native sample app to the Bitrise app before running the iOS artifact workflow.
9196

9297
## Caching
9398

e2e/bitrise.yml

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ app:
1616
- E2E_BROWSERSTACK_POLL_SECONDS: "30"
1717
- E2E_IOS_EXPORT_METHOD: development
1818
- E2E_ANDROID_COMMAND_TIMEOUT_SECONDS: "1800"
19+
- E2E_IOS_COMMAND_TIMEOUT_SECONDS: "1800"
1920
- E2E_PACKAGE_COMMAND_TIMEOUT_SECONDS: "300"
2021
- E2E_RUBY_INSTALL_TIMEOUT_SECONDS: "1800"
2122

@@ -62,28 +63,84 @@ workflows:
6263
$BITRISE_DEPLOY_DIR/e2e-matrix.json:E2E_MATRIX_JSON
6364
6465
e2e-build-react-native-ios:
66+
meta:
67+
bitrise.io:
68+
stack: osx-xcode-26.0.x-edge
69+
machine_type_id: g2.mac.4large
6570
steps:
6671
- git-clone@8: {}
72+
- certificate-and-profile-installer@1: {}
6773
- restore-cache@1:
6874
inputs:
6975
- key: |-
70-
rn-ios-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/ios/Podfile.lock" }}
76+
rn-ios-macos-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/ios/Podfile.lock" }}
7177
- script@1:
72-
title: Create React Native iOS artifact placeholder
78+
title: Build React Native iOS IPA artifact
7379
inputs:
7480
- content: |-
7581
set -euo pipefail
82+
source e2e/scripts/bitrise_ci_helpers
83+
e2e_prepare_ruby
84+
e2e_log "Enabling Corepack"
85+
corepack enable
86+
e2e_log "Configuring storefront environment"
87+
./scripts/setup_storefront_env --skip-optional-prompts
88+
e2e_log "Installing React Native dependencies"
89+
cd platforms/react-native
90+
e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" pnpm install --frozen-lockfile
91+
cd sample
92+
e2e_log "Installing iOS Ruby dependencies"
93+
e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" bundle install
94+
cd ios
95+
e2e_log "Installing CocoaPods dependencies"
96+
e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" bundle exec pod install --deployment --repo-update
7697
mkdir -p "$BITRISE_DEPLOY_DIR/e2e"
77-
echo "Phase 2 placeholder for React Native iOS IPA" > "$BITRISE_DEPLOY_DIR/e2e/react-native-ios.ipa"
78-
envman add --key E2E_REACT_NATIVE_IOS_APP_PATH --value "$BITRISE_DEPLOY_DIR/e2e/react-native-ios.ipa"
98+
archive_path="$BITRISE_DEPLOY_DIR/e2e/CheckoutKitReactNativeDemo.xcarchive"
99+
export_path="$BITRISE_DEPLOY_DIR/e2e/react-native-ios-export"
100+
export_options="$BITRISE_DEPLOY_DIR/e2e/ExportOptions.plist"
101+
export_method="${E2E_IOS_EXPORT_METHOD:-development}"
102+
cat > "$export_options" <<PLIST
103+
<?xml version="1.0" encoding="UTF-8"?>
104+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
105+
<plist version="1.0">
106+
<dict>
107+
<key>method</key>
108+
<string>$export_method</string>
109+
<key>signingStyle</key>
110+
<string>automatic</string>
111+
<key>stripSwiftSymbols</key>
112+
<true/>
113+
<key>compileBitcode</key>
114+
<false/>
115+
</dict>
116+
</plist>
117+
PLIST
118+
e2e_log "Archiving React Native iOS app"
119+
e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" xcodebuild archive \
120+
-workspace CheckoutKitReactNativeDemo.xcworkspace \
121+
-scheme CheckoutKitReactNativeDemo \
122+
-configuration Release \
123+
-sdk iphoneos \
124+
-destination generic/platform=iOS \
125+
-archivePath "$archive_path" \
126+
-skipPackagePluginValidation
127+
e2e_log "Exporting React Native iOS IPA"
128+
e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" xcodebuild -exportArchive \
129+
-archivePath "$archive_path" \
130+
-exportPath "$export_path" \
131+
-exportOptionsPlist "$export_options"
132+
ios_ipa="$(find "$export_path" -name "*.ipa" -print -quit)"
133+
test -f "$ios_ipa"
134+
e2e_log "Publishing iOS IPA path"
135+
envman add --key E2E_REACT_NATIVE_IOS_APP_PATH --value "$ios_ipa"
79136
- deploy-to-bitrise-io@2:
80137
inputs:
81138
- pipeline_intermediate_files: |-
82139
$E2E_REACT_NATIVE_IOS_APP_PATH:E2E_REACT_NATIVE_IOS_APP_PATH
83140
- save-cache@1:
84141
inputs:
85142
- key: |-
86-
rn-ios-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/ios/Podfile.lock" }}
143+
rn-ios-macos-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/ios/Podfile.lock" }}
87144
- paths: |-
88145
platforms/react-native/node_modules
89146
platforms/react-native/sample/ios/Pods

e2e/test/bitrise_pipeline_test.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,55 @@ def test_react_native_android_workflow_does_not_use_local_native_sdk_overrides
156156
refute_includes script, "--local"
157157
end
158158

159+
def test_react_native_ios_workflow_uses_macos_xcode_resources
160+
workflow = load_bitrise_config.fetch("workflows").fetch("e2e-build-react-native-ios")
161+
meta = workflow.fetch("meta").fetch("bitrise.io")
162+
163+
assert_equal "osx-xcode-26.0.x-edge", meta.fetch("stack")
164+
assert_equal "g2.mac.4large", meta.fetch("machine_type_id")
165+
end
166+
167+
def test_react_native_ios_workflow_builds_real_ipa_artifact
168+
config = load_bitrise_config
169+
script = workflow_script("e2e-build-react-native-ios")
170+
171+
assert_equal "1800", app_env_values.fetch("E2E_IOS_COMMAND_TIMEOUT_SECONDS")
172+
assert_workflow_has_step(config, "e2e-build-react-native-ios", "certificate-and-profile-installer")
173+
assert_includes script, "source e2e/scripts/bitrise_ci_helpers"
174+
assert_includes script, "e2e_prepare_ruby"
175+
assert_includes script, 'e2e_log "Configuring storefront environment"'
176+
assert_includes script, 'e2e_log "Installing React Native dependencies"'
177+
assert_includes script, 'e2e_log "Installing iOS Ruby dependencies"'
178+
assert_includes script, 'e2e_log "Installing CocoaPods dependencies"'
179+
assert_includes script, 'e2e_log "Archiving React Native iOS app"'
180+
assert_includes script, 'e2e_log "Exporting React Native iOS IPA"'
181+
assert_includes script, 'e2e_log "Publishing iOS IPA path"'
182+
assert_includes script, "corepack enable"
183+
assert_includes script, "cd platforms/react-native"
184+
assert_command_order script, "cd platforms/react-native", "pnpm install --frozen-lockfile"
185+
assert_includes script, "pnpm install --frozen-lockfile"
186+
assert_includes script, "./scripts/setup_storefront_env --skip-optional-prompts"
187+
assert_includes script, 'e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" pnpm install --frozen-lockfile'
188+
assert_includes script, 'e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" bundle install'
189+
assert_includes script, 'e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" bundle exec pod install --deployment --repo-update'
190+
assert_includes script, 'e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" xcodebuild archive'
191+
assert_includes script, 'e2e_run_with_timeout "${E2E_IOS_COMMAND_TIMEOUT_SECONDS:-1800}" xcodebuild -exportArchive'
192+
assert_includes script, "bundle exec pod install --deployment --repo-update"
193+
assert_includes script, "xcodebuild archive"
194+
assert_includes script, "-sdk iphoneos"
195+
assert_includes script, "generic/platform=iOS"
196+
assert_includes script, "xcodebuild -exportArchive"
197+
assert_includes script, "E2E_REACT_NATIVE_IOS_APP_PATH"
198+
refute_includes script, "Phase 2 placeholder for React Native iOS IPA"
199+
end
200+
201+
def test_react_native_ios_workflow_does_not_use_local_native_sdk_overrides
202+
script = workflow_script("e2e-build-react-native-ios")
203+
204+
refute_includes script, "USE_LOCAL_SDK"
205+
refute_includes script, "--local"
206+
end
207+
159208
def test_bitrise_setup_docs_exist
160209
assert File.exist?("e2e/BITRISE.md")
161210
end

0 commit comments

Comments
 (0)