Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions e2e/BITRISE.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ Each workflow's main `script` step sets its own wall-clock budget with the Bitri

The `e2e-execute-browserstack-run` workflow fans out one parallel copy per BrowserStack run plan row. The `e2e-produce-browserstack-run-plan` workflow derives this count with `ruby e2e/scripts/e2e_matrix_to_browserstack_run_plan count` and publishes it as `E2E_BROWSERSTACK_RUN_PLAN_COUNT`, which the `e2e-execute-browserstack-run` `parallel` field reads, so it never needs manual alignment.

## Storefront secrets

These secrets are configured in Bitrise.io; they cannot live in the repository. `scripts/setup_storefront_env` reads them to configure the sample app before builds.

| Secret | Purpose |
|---|---|
| `STOREFRONT_DOMAIN` | Storefront domain for sample app builds. |
| `STOREFRONT_ACCESS_TOKEN` | Storefront access token for sample app builds. |

## Caching

React Native Android E2E builds use the released native Maven artifact versions declared by the React Native sample and module configuration. Do not pass the React Native `--local` flag or set local native SDK override environment variables for these builds.

The pipeline uses Bitrise cache steps for key-based pnpm/CocoaPods/Gradle cache paths.

Do not add `activate-build-cache-for-xcode` or `activate-build-cache-for-gradle`; the Bitrise Build Cache add-on is disabled for Shopify Bitrise apps.
Expand Down
44 changes: 34 additions & 10 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project_type: other

meta:
bitrise.io:
stack: ubuntu-noble-24.04-bitrise-2025-android
stack: &android_stack ubuntu-noble-24.04-bitrise-2025-android
machine_type_id: g2.linux.medium

app:
Expand Down Expand Up @@ -39,6 +39,27 @@ pipelines:
- e2e-execute-browserstack-run
should_always_run: workflow

step_bundles:
install-node-modules:
steps:
- restore-cache@3:
inputs:
- key: &rn_node_modules_cache_key |-
rn-node-modules-{{ .OS }}-{{ .Arch }}-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}
- script@1:
title: Install React Native dependencies
inputs:
- content: |-
set -euo pipefail
source e2e/scripts/bitrise_ci_helpers
e2e_enable_corepack
cd platforms/react-native
pnpm install --frozen-lockfile
- save-cache@1:
inputs:
- key: *rn_node_modules_cache_key
- paths: platforms/react-native/node_modules

workflows:
e2e-produce-browserstack-run-plan:
steps:
Expand Down Expand Up @@ -99,30 +120,33 @@ workflows:
platforms/react-native/sample/ios/Pods

e2e-build-react-native-android:
meta:
bitrise.io:
stack: *android_stack
machine_type_id: g2.linux.large
steps:
- git-clone@8: {}
- bundle::install-node-modules: {}
- restore-cache@3:
inputs:
- key: |-
rn-android-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/android/**/*.gradle*" }}
- key: &rn_gradle_cache_key |-
rn-gradle-{{ .OS }}-{{ .Arch }}-{{ checksum "platforms/react-native/sample/android/**/*.gradle*" }}
- script@1:
title: Create React Native Android artifact placeholder
title: Build React Native Android APK artifact
timeout: 3600
no_output_timeout: 3600
inputs:
- content: |-
set -euo pipefail
mkdir -p "$BITRISE_DEPLOY_DIR/e2e"
echo "Phase 2 placeholder for React Native Android APK" > "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$BITRISE_DEPLOY_DIR/e2e/react-native-android.apk"
e2e/scripts/build_react_native_android
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: |-
$E2E_REACT_NATIVE_ANDROID_APP_PATH:E2E_REACT_NATIVE_ANDROID_APP_PATH
- save-cache@1:
inputs:
- key: |-
rn-android-{{ checksum "platforms/react-native/pnpm-lock.yaml" }}-{{ checksum "platforms/react-native/sample/android/**/*.gradle*" }}
- key: *rn_gradle_cache_key
- paths: |-
platforms/react-native/node_modules
~/.gradle/caches
~/.gradle/wrapper

Expand Down
13 changes: 13 additions & 0 deletions e2e/scripts/bitrise_ci_helpers
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ set -euo pipefail
e2e_log() {
printf '\n==> %s\n' "$*"
}

e2e_enable_corepack() {
e2e_log "Enabling Corepack"
corepack enable
}

e2e_configure_storefront() {
e2e_log "Checking storefront configuration secrets"
: "${STOREFRONT_DOMAIN:?STOREFRONT_DOMAIN is required. Check https://app.bitrise.io/app/f51f9054-053e-40f1-81e9-ae727567ae76/workflow_editor#!/secrets and enable Expose for pull requests.}"
: "${STOREFRONT_ACCESS_TOKEN:?STOREFRONT_ACCESS_TOKEN is required. Check https://app.bitrise.io/app/f51f9054-053e-40f1-81e9-ae727567ae76/workflow_editor#!/secrets and enable Expose for pull requests.}"
e2e_log "Configuring storefront environment"
./scripts/setup_storefront_env --skip-optional-prompts
}
23 changes: 23 additions & 0 deletions e2e/scripts/build_react_native_android
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$script_dir/bitrise_ci_helpers"

e2e_enable_corepack
e2e_configure_storefront

e2e_log "Building React Native module"
cd platforms/react-native
pnpm module build

e2e_log "Building Android E2E APK"
cd sample/android
./gradlew assembleE2e --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a

android_apk="$PWD/app/build/outputs/apk/e2e/app-e2e.apk"
test -f "$android_apk"

e2e_log "Publishing Android APK path"
envman add --key E2E_REACT_NATIVE_ANDROID_APP_PATH --value "$android_apk"
18 changes: 18 additions & 0 deletions platforms/react-native/sample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ android {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
e2e {
initWith release
matchingFallbacks = ['release']
signingConfig signingConfigs.debug
minifyEnabled false
}
}

testOptions {
Expand All @@ -153,6 +159,18 @@ android {
}
}

gradle.projectsEvaluated {
if (project.findProperty("newArchEnabled").toString() == "true") {
def codegenTasks = rootProject.subprojects.collect { subproject ->
subproject.tasks.findByName("generateCodegenArtifactsFromSchema")
}.findAll { task -> task != null }

tasks.matching { task -> task.name.startsWith("configureCMake") }.configureEach { task ->
task.dependsOn(codegenTasks)
}
}
}

def checkoutKitPackageJsonFile = rootProject.file("../../modules/@shopify/checkout-kit-react-native/package.json")
def checkoutKitPackageJson = new groovy.json.JsonSlurper().parse(checkoutKitPackageJsonFile)
def shopifySdkVersion = checkoutKitPackageJson.checkoutKit?.nativeSdkVersions?.android as String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class MainApplication : Application(), ReactApplication {

override fun getJSMainModuleName(): String = "index"

override fun getBundleAssetName(): String = "CheckoutKitReactNativeDemo.android.bundle"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
Expand Down
Loading