Seperate RN andriod and IOS into 2 separated Stages. (#23400)

### Description
Seperate RN andriod and IOS into 2 separated Stages.



### Motivation and Context
Speed up the PR process.
This commit is contained in:
Jian Chen 2025-01-20 21:08:01 -05:00 committed by GitHub
parent e20b529a32
commit 83cb1e4a3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 184 additions and 127 deletions

View file

@ -61,7 +61,8 @@ stages:
- stage: Download_Node_Package_And_Publish_Validation_Script
dependsOn:
- ReactNative_CI
- ReactNative_CI_Android
- ReactNative_CI_iOS
- Build_web_Release
- Build_web_Debug
jobs:
@ -71,9 +72,11 @@ stages:
runCodesignValidationInjection: false
timeoutInMinutes: 10
steps:
# This pipeline usually are triggered by Zip-Nuget-Java-Nodejs Packaging Pipeline,
# The NPM_packages is from Android_Java_API_AAR_Packaging_QNN, not from RN_CI
- download: build
artifact: 'NPM_packages'
displayName: 'Download onnxruntime-node Pipeline Artifact'
displayName: 'Download NPM_packages from Zip-Nuget-Java-Nodejs Packaging Pipeline Pipeline Artifact'
- task: CopyFiles@2
inputs:

View file

@ -29,11 +29,10 @@ parameters:
type: boolean
stages:
- stage: Build_Packages
displayName: Build Packages
- stage: Build_Android_Packages
displayName: Build_Android_Packages
dependsOn: '${{parameters.InitialStageDependsOn}}'
jobs:
- template: android-java-api-aar.yml
parameters:
buildConfig: '${{parameters.BuildConfig}}'
@ -43,72 +42,18 @@ stages:
enable_code_sign: '${{parameters.enable_code_sign}}'
pool_name: '${{parameters.PoolName}}'
packageName: 'onnxruntime-android'
- job: Build_Ios_Pod_For_React_Native
pool:
vmImage: 'macOS-13'
timeoutInMinutes: 90
variables:
runCodesignValidationInjection: false
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
ORT_CACHE_DIR: '$(Pipeline.Workspace)/ccache_ort'
steps:
- template: use-xcode-version.yml
- task: UsePythonVersion@0
displayName: Use python 3.12
inputs:
versionSpec: "3.12"
addToPath: true
architecture: "x64"
- script: |
pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt
displayName: "Install Python requirements"
- template: mac-build-step-with-cache.yml
parameters:
WithCache: true
Today: $(TODAY)
AdditionalKey: react_${{parameters.BuildConfig}}
CacheDir: $(ORT_CACHE_DIR)
BuildStep:
- script: |
set -e -x
python $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
--build-dir "$(Build.BinariesDirectory)/ios_framework_full" \
--staging-dir "$(Build.BinariesDirectory)/staging" \
--variant Full \
--build-settings-file $(Build.SourcesDirectory)/tools/ci_build/github/js/react_native_e2e_full_ios_framework_build_settings.json
displayName: Build iOS package and assemble pods
env:
CC: clang
CXX: clang++
CCACHE_CPP2: 1
CCACHE_DEPEND: 1
CCACHE_SLOPPINESS: modules
CCACHE_DIR: $(ORT_CACHE_DIR)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.BinariesDirectory)/staging'
artifact: 'onnxruntime-ios-full-pod'
- stage: ReactNative_CI
displayName: React Native CI
- stage: ReactNative_CI_Android
displayName: ReactNative_CI_Android
dependsOn:
- Build_Packages
- Build_Android_Packages
jobs:
- job: ReactNative_CI
- job: ReactNative_CI_Android
pool:
vmImage: 'macOS-13'
variables:
runCodesignValidationInjection: false
timeoutInMinutes: 90
steps:
- template: use-xcode-version.yml
- task: UsePythonVersion@0
displayName: Use python 3.12
inputs:
@ -139,10 +84,6 @@ stages:
brew tap wix/brew
displayName: brew tap wix/brew
- script:
brew install applesimutils
displayName: Install applesimutils tools required by detox ios
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
@ -157,13 +98,6 @@ stages:
targetFolder: $(Build.SourcesDirectory)/js/react_native/android/libs
displayName: Copy Android package to React Native directory
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'onnxruntime-ios-full-pod'
targetPath: '$(Build.BinariesDirectory)/ios-full-pod'
displayName: Download iOS pod artifacts
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js'
@ -198,26 +132,14 @@ stages:
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Bootstrap Android and iOS e2e tests
- script: |
ORT_C_LOCAL_POD_PATH=$(Build.BinariesDirectory)/ios-full-pod/onnxruntime-c \
pod install
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/ios'
displayName: Pod install for onnxruntime react native ios bridge library
- script: |
ORT_C_LOCAL_POD_PATH=$(Build.BinariesDirectory)/ios-full-pod/onnxruntime-c \
pod install
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e/ios'
displayName: Pod install for onnxruntime react native ios e2e tests
- script: |
yarn add --dev jest-junit
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: install jest junit reporter js/react_native/e2e
- script: |
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android \
-keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US"
keytool -genkey -v -keystore debug.keystore -alias androiddebugkey -storepass android \
-keypass android -keyalg RSA -keysize 2048 -validity 999999 -dname "CN=Android Debug,O=Android,C=US"
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e/android'
displayName: Generate a debug keystore
@ -233,11 +155,6 @@ stages:
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Build React Native Detox Android e2e Tests
- script: |
detox build --configuration ios.sim.release
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Build React Native Detox iOS e2e Tests
#
# Unit tests and E2E tests with Android emulator
#
@ -283,6 +200,173 @@ stages:
condition: succeededOrFailed()
displayName: Publish React Native Detox Android e2e Test Results
- script: |
git restore .
workingDirectory: '$(Build.SourcesDirectory)/js'
displayName: Restore git changes
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/js/pack-npm-packages.ps1'
arguments: '"${{parameters.NpmPackagingMode}}" $(Build.SourcesDirectory) react_native'
workingDirectory: '$(Build.SourcesDirectory)'
errorActionPreference: stop
displayName: Pack NPM packages
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/js/common
contents: onnxruntime-common*.tgz
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Create Artifacts onnxruntime-common'
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/js/react_native
contents: onnxruntime-react-native*.tgz
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: Create Artifacts onnxruntime-react-native
- task: PublishPipelineArtifact@1
inputs:
artifact: android_e2e_test_logs_$(Build.BuildId)_$(Build.BuildNumber)_$(System.JobAttempt)
targetPath: '$(Build.SourcesDirectory)/js/react_native/e2e/artifacts'
condition: succeededOrFailed()
displayName: Publish React Native Detox E2E test logs
- task: PublishPipelineArtifact@0
inputs:
artifactName: '${{parameters.PackageName}}'
targetPath: '$(Build.ArtifactStagingDirectory)'
displayName: Publish Pipeline Artifact
- template: explicitly-defined-final-tasks.yml
- stage: ReactNative_CI_iOS
displayName: ReactNative_CI_iOS
dependsOn: '${{parameters.InitialStageDependsOn}}'
jobs:
- job: ReactNative_CI_iOS
pool:
vmImage: 'macOS-13'
timeoutInMinutes: 90
variables:
runCodesignValidationInjection: false
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
ORT_CACHE_DIR: '$(Pipeline.Workspace)/ccache_ort'
steps:
- template: use-xcode-version.yml
- task: UsePythonVersion@0
displayName: Use python 3.12
inputs:
versionSpec: "3.12"
addToPath: true
architecture: "x64"
- script: |
pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt
displayName: "Install Python requirements"
# Build the iOS package
- template: mac-build-step-with-cache.yml
parameters:
WithCache: true
Today: $(TODAY)
AdditionalKey: react_${{parameters.BuildConfig}}
CacheDir: $(ORT_CACHE_DIR)
BuildStep:
- script: |
set -e -x
python $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
--build-dir "$(Build.BinariesDirectory)/ios_framework_full" \
--staging-dir "$(Build.BinariesDirectory)/ios-full-pod" \
--variant Full \
--build-settings-file $(Build.SourcesDirectory)/tools/ci_build/github/js/react_native_e2e_full_ios_framework_build_settings.json
displayName: Build iOS package and assemble pods
env:
CC: clang
CXX: clang++
CCACHE_CPP2: 1
CCACHE_DEPEND: 1
CCACHE_SLOPPINESS: modules
CCACHE_DIR: $(ORT_CACHE_DIR)
# Test the iOS package
- task: NodeTool@0
inputs:
versionSpec: '20.x'
- script:
brew install coreutils ninja npm yarn
displayName: Install coreutils, ninja, npm, and yarn
- script:
yarn global add detox-cli
displayName: Install detox cli tools
- script:
brew tap wix/brew
displayName: brew tap wix/brew
- script:
brew install applesimutils
displayName: Install applesimutils tools required by detox ios
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js'
displayName: npm ci js
- script: |
npm ci
workingDirectory: '$(Build.SourcesDirectory)/js/common'
displayName: npm ci js/common
- script: |
yarn
workingDirectory: '$(Build.SourcesDirectory)/js/react_native'
displayName: yarn js/react_native
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/js/pack-npm-packages.ps1'
arguments: '"-dev.$(Get-Date -Format yyyyMMdd)-$(git rev-parse --short HEAD)" $(Build.SourcesDirectory) react_native'
workingDirectory: '$(Build.SourcesDirectory)'
errorActionPreference: stop
env:
ORT_JS_PACK_MODE: e2e
displayName: Pack NPM packages
- script: |
mv $(Build.SourcesDirectory)/js/common/onnxruntime-common*.tgz onnxruntime-common.tgz
yarn add --no-lockfile file:./onnxruntime-common.tgz
mv $(Build.SourcesDirectory)/js/react_native/onnxruntime-react-native*.tgz onnxruntime-react-native.tgz
yarn add --no-lockfile file:./onnxruntime-react-native.tgz
yarn
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Bootstrap Android and iOS e2e tests
- script: |
yarn add --dev jest-junit
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: install jest junit reporter js/react_native/e2e
- script: |
ORT_C_LOCAL_POD_PATH=$(Build.BinariesDirectory)/ios-full-pod/onnxruntime-c \
pod install
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/ios'
displayName: Pod install for onnxruntime react native ios bridge library
- script: |
ORT_C_LOCAL_POD_PATH=$(Build.BinariesDirectory)/ios-full-pod/onnxruntime-c \
pod install
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e/ios'
displayName: Pod install for onnxruntime react native ios e2e tests
- script: |
detox build --configuration ios.sim.release
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Build React Native Detox iOS e2e Tests
#
# Unit tests and E2E tests with iOS simulator
#
@ -348,44 +432,14 @@ stages:
condition: succeededOrFailed()
displayName: Publish React Native Detox iOS e2e Test Results
- script: |
git restore .
workingDirectory: '$(Build.SourcesDirectory)/js'
displayName: Restore git changes
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/js/pack-npm-packages.ps1'
arguments: '"${{parameters.NpmPackagingMode}}" $(Build.SourcesDirectory) react_native'
workingDirectory: '$(Build.SourcesDirectory)'
errorActionPreference: stop
displayName: Pack NPM packages
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/js/common
contents: onnxruntime-common*.tgz
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: 'Create Artifacts onnxruntime-common'
- task: CopyFiles@2
inputs:
sourceFolder: $(Build.SourcesDirectory)/js/react_native
contents: onnxruntime-react-native*.tgz
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: Create Artifacts onnxruntime-react-native
- task: PublishPipelineArtifact@1
inputs:
artifact: e2e_test_logs_$(Build.BuildId)_$(Build.BuildNumber)_$(System.JobAttempt)
artifact: ios_e2e_test_logs_$(Build.BuildId)_$(Build.BuildNumber)_$(System.JobAttempt)
targetPath: '$(Build.SourcesDirectory)/js/react_native/e2e/artifacts'
condition: succeededOrFailed()
displayName: Publish React Native Detox E2E test logs
- task: PublishPipelineArtifact@0
inputs:
artifactName: '${{parameters.PackageName}}'
targetPath: '$(Build.ArtifactStagingDirectory)'
displayName: Publish Pipeline Artifact
- template: explicitly-defined-final-tasks.yml