Skip to content

Commit 2093783

Browse files
Build React Native Android E2E APK artifact
Assisted-By: devx/396ca0c4-44ad-415d-8d80-7200df4e42a4
1 parent 8ac1c3c commit 2093783

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

bitrise.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,20 @@ workflows:
8080
rn-android-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/android/**/*.gradle*" }}
8181
- activate-build-cache-for-gradle: {}
8282
- script@1:
83-
title: Create React Native Android artifact placeholder
83+
title: Build React Native Android APK artifact
8484
inputs:
8585
- content: |-
8686
set -euo pipefail
87-
mkdir -p "$BITRISE_DEPLOY_DIR/e2e"
88-
echo "Phase 2 placeholder for React Native Android APK" > "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
89-
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
87+
corepack enable
88+
pnpm install --frozen-lockfile
89+
./scripts/setup_storefront_env --skip-optional-prompts
90+
cd platforms/react-native
91+
pnpm module build
92+
cd sample/android
93+
./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a
94+
android_apk="$PWD/app/build/outputs/apk/debug/app-debug.apk"
95+
test -f "$android_apk"
96+
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$android_apk"
9097
- deploy-to-bitrise-io@2:
9198
inputs:
9299
- pipeline_intermediate_files: |-

e2e/BITRISE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Phase 2 only validates the graph shape and intermediate artifact wiring. Browser
2525
| Variable | Initial value | Purpose |
2626
|---|---|---|
2727
| `E2E_RUN_COUNT` | `2` | Number of expanded matrix rows to run in parallel. Keep this aligned with `ruby e2e/scripts/e2e_matrix count`. |
28+
| `STOREFRONT_DOMAIN` | Bitrise secret or app env | Required by `scripts/setup_storefront_env` for sample app builds. |
29+
| `STOREFRONT_ACCESS_TOKEN` | Bitrise secret | Required by `scripts/setup_storefront_env` for sample app builds. |
2830

2931
## Future secrets
3032

@@ -47,6 +49,8 @@ React Native iOS IPA generation is added in a later phase and will require Bitri
4749

4850
## Caching
4951

52+
React Native Android E2E builds use the released native Maven artifact versions declared by the React Native sample and module configuration. Do not set local native SDK override flags for these builds.
53+
5054
The skeleton includes placeholders for:
5155

5256
- key-based pnpm/CocoaPods/Gradle cache paths

e2e/test/bitrise_pipeline_test.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ def test_pipeline_uses_intermediate_file_sharing_placeholders
4848
assert_workflow_has_step(config, "e2e-report", "pull-intermediate-files")
4949
end
5050

51+
def test_react_native_android_workflow_builds_real_apk_artifact
52+
script = workflow_script("e2e-build-react-native-android")
53+
54+
assert_includes script, "corepack enable"
55+
assert_includes script, "pnpm install --frozen-lockfile"
56+
assert_includes script, "./scripts/setup_storefront_env --skip-optional-prompts"
57+
assert_includes script, "pnpm module build"
58+
assert_includes script, "./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a"
59+
assert_includes script, "app/build/outputs/apk/debug/app-debug.apk"
60+
refute_includes script, "Phase 2 placeholder for React Native Android APK"
61+
end
62+
63+
def test_react_native_android_workflow_does_not_use_local_native_sdk_overrides
64+
script = workflow_script("e2e-build-react-native-android")
65+
66+
refute_includes script, "USE_LOCAL_SDK"
67+
refute_includes script, "publish_android_snapshot"
68+
refute_includes script, "--local"
69+
end
70+
5171
def test_bitrise_setup_docs_exist
5272
assert File.exist?("e2e/BITRISE.md")
5373
end
@@ -58,6 +78,16 @@ def load_bitrise_config
5878
YAML.safe_load_file("bitrise.yml")
5979
end
6080

81+
def workflow_script(workflow)
82+
steps = load_bitrise_config.fetch("workflows").fetch(workflow).fetch("steps")
83+
steps.filter_map do |step|
84+
step_value = step.values.first
85+
next unless step.keys.first.start_with?("script")
86+
87+
step_value.fetch("inputs", []).find { |input| input.key?("content") }&.fetch("content")
88+
end.join("\n")
89+
end
90+
6191
def expected_workflows
6292
[
6393
"e2e-package-suite",

0 commit comments

Comments
 (0)