Skip to content

Commit b1b2dfd

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

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

e2e/BITRISE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ The non-secret E2E defaults are defined in `e2e/bitrise.yml` under `app.envs`. D
6060

6161
Secrets still need to be configured in Bitrise.io.
6262

63+
| Secret | Purpose |
64+
|---|---|
65+
| `STOREFRONT_DOMAIN` | Required by `scripts/setup_storefront_env` for sample app builds. |
66+
| `STOREFRONT_ACCESS_TOKEN` | Required by `scripts/setup_storefront_env` for sample app builds. |
67+
6368
## Future secrets
6469

6570
Do not add BrowserStack credentials until the BrowserStack integration phase.
@@ -81,6 +86,8 @@ React Native iOS IPA generation is added in a later phase and will require Bitri
8186

8287
## Caching
8388

89+
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.
90+
8491
The skeleton includes placeholders for:
8592

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

e2e/bitrise.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,20 @@ workflows:
8989
rn-android-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/android/**/*.gradle*" }}
9090
- activate-build-cache-for-gradle: {}
9191
- script@1:
92-
title: Create React Native Android artifact placeholder
92+
title: Build React Native Android APK artifact
9393
inputs:
9494
- content: |-
9595
set -euo pipefail
96-
mkdir -p "$BITRISE_DEPLOY_DIR/e2e"
97-
echo "Phase 2 placeholder for React Native Android APK" > "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
98-
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
96+
corepack enable
97+
pnpm install --frozen-lockfile
98+
./scripts/setup_storefront_env --skip-optional-prompts
99+
cd platforms/react-native
100+
pnpm module build
101+
cd sample/android
102+
./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a
103+
android_apk="$PWD/app/build/outputs/apk/debug/app-debug.apk"
104+
test -f "$android_apk"
105+
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$android_apk"
99106
- deploy-to-bitrise-io@2:
100107
inputs:
101108
- pipeline_intermediate_files: |-

e2e/test/bitrise_pipeline_test.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,26 @@ def test_dev_up_installs_bitrise_cli
7373
assert_includes packages, "bitrise"
7474
end
7575

76+
def test_react_native_android_workflow_builds_real_apk_artifact
77+
script = workflow_script("e2e-build-react-native-android")
78+
79+
assert_includes script, "corepack enable"
80+
assert_includes script, "pnpm install --frozen-lockfile"
81+
assert_includes script, "./scripts/setup_storefront_env --skip-optional-prompts"
82+
assert_includes script, "pnpm module build"
83+
assert_includes script, "./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a"
84+
assert_includes script, "app/build/outputs/apk/debug/app-debug.apk"
85+
refute_includes script, "Phase 2 placeholder for React Native Android APK"
86+
end
87+
88+
def test_react_native_android_workflow_does_not_use_local_native_sdk_overrides
89+
script = workflow_script("e2e-build-react-native-android")
90+
91+
refute_includes script, "USE_LOCAL_SDK"
92+
refute_includes script, "publish_android_snapshot"
93+
refute_includes script, "--local"
94+
end
95+
7696
def test_bitrise_setup_docs_exist
7797
assert File.exist?("e2e/BITRISE.md")
7898
end
@@ -83,6 +103,16 @@ def load_bitrise_config
83103
YAML.safe_load_file(BITRISE_CONFIG_PATH)
84104
end
85105

106+
def workflow_script(workflow)
107+
steps = load_bitrise_config.fetch("workflows").fetch(workflow).fetch("steps")
108+
steps.filter_map do |step|
109+
step_value = step.values.first
110+
next unless step.keys.first.start_with?("script")
111+
112+
step_value.fetch("inputs", []).find { |input| input.key?("content") }&.fetch("content")
113+
end.join("\n")
114+
end
115+
86116
def expected_workflows
87117
[
88118
"e2e-package-suite",

0 commit comments

Comments
 (0)