Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving RN_CI Android Testing to Linux #23422

Merged
merged 38 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7741248
Updating react-native to 0.70.15
jchen351 Jan 7, 2025
60560bd
Switching iOS back to 13.0
jchen351 Jan 7, 2025
77c3b70
Upgrade gradle to 7.5.1
jchen351 Jan 8, 2025
60c4da2
Also update yarn.lock
jchen351 Jan 8, 2025
85acc42
Adding x86_64 arch explitly
jchen351 Jan 8, 2025
df2c952
# TODO: remove this once we migrate the Pipelines to …
jchen351 Jan 8, 2025
c3f0bf6
Disable hermes by default
jchen351 Jan 8, 2025
5f8f4ee
Merge branch 'refs/heads/main' into Cjian/fix_rn_ci
jchen351 Jan 9, 2025
ce776be
set hermes_enabled tp ture
jchen351 Jan 10, 2025
16e7782
set herms to false
jchen351 Jan 10, 2025
16eae7e
seperating RN-ci pipeline
jchen351 Jan 10, 2025
353a80c
Merge branch 'main' into Cjian/seperate-rn
jchen351 Jan 16, 2025
b965982
Revert files back to main
jchen351 Jan 16, 2025
1a2feed
Fix e2e test log publish
jchen351 Jan 16, 2025
c80286b
Change artifact name
jchen351 Jan 16, 2025
1601765
Change artifact name
jchen351 Jan 17, 2025
751801b
Switching back to NPM_packages
jchen351 Jan 17, 2025
21ae003
Using onnxruntime-Ubuntu2204-AMD-CPU for Andriod Build
jchen351 Jan 17, 2025
de24e8b
Using onnxruntime-Ubuntu2204-AMD-CPU for Andriod Build
jchen351 Jan 17, 2025
79f3622
brew to apt-get
jchen351 Jan 17, 2025
483b46a
brew to apt-get
jchen351 Jan 17, 2025
59e8206
Reformat
jchen351 Jan 20, 2025
595e6db
Combining IOS stages
jchen351 Jan 20, 2025
aba9c00
install detox
jchen351 Jan 20, 2025
f4336fc
Update Yarn detox
jchen351 Jan 20, 2025
9b211cf
Update Yarn detox
jchen351 Jan 20, 2025
16a98b1
Install detox cli tools and prepend to PATH
jchen351 Jan 20, 2025
ae0e307
Create a separated job for Andriod RN E2e Test
jchen351 Jan 20, 2025
b9349fd
Merge branch 'Cjian/seperate-rn' into Cjian/android_ci_rn
jchen351 Jan 20, 2025
cb61bcb
Merge with Cjian/separate-rn
jchen351 Jan 20, 2025
42ac3ca
Merge with Cjian/separate-rn
jchen351 Jan 20, 2025
e77979a
npm install --global yarn
jchen351 Jan 20, 2025
51596c8
../../
jchen351 Jan 20, 2025
ee20059
Merge branch 'main' into Cjian/android_ci_rn
jchen351 Jan 21, 2025
dfbae55
Merge with master
jchen351 Jan 21, 2025
3993914
Adding set -x -e
jchen351 Jan 21, 2025
f466ada
Adding back npm install --global yarn
jchen351 Jan 21, 2025
d0848e2
check where is `yarn global bin`
jchen351 Jan 21, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
parameters:
- name: PackageName
displayName: 'Package name'
type: string
default: 'NPM_packages'

- name: ArtifactName
type: string
default: 'onnxruntime-android-full-aar'

- name: NpmPackagingMode
displayName: 'NPM packages publish configuration'
type: string
default: 'dev'

jobs:
- job: ReactNative_CI_Android
pool: 'onnxruntime-Ubuntu2204-AMD-CPU'
variables:
runCodesignValidationInjection: false
timeoutInMinutes: 90
steps:
- task: UsePythonVersion@0
displayName: Use python 3.12
inputs:
versionSpec: "3.12"
addToPath: true
architecture: "x64"

- task: JavaToolInstaller@0
displayName: Use jdk 17
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- task: NodeTool@0
inputs:
versionSpec: '20.x'

- script: |
sudo apt install coreutils ninja-build nodejs npm yarn
npm install --global yarn
displayName: Install coreutils, ninja, npm, and yarn

- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: '${{parameters.ArtifactName}}'
targetPath: '$(Build.BinariesDirectory)/android-full-aar'
displayName: Download Android AAR artifacts

- task: CopyFiles@2
inputs:
sourceFolder: $(Build.BinariesDirectory)/android-full-aar
contents: onnxruntime-android-*.aar
targetFolder: $(Build.SourcesDirectory)/js/react_native/android/libs
displayName: Copy Android package to React Native directory

- 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: |
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

- task: CopyFiles@2
inputs:
sourceFolder: $(Build.BinariesDirectory)/android-full-aar
contents: onnxruntime-*.aar
targetFolder: $(Build.SourcesDirectory)/js/react_native/e2e/android/app/libs
displayName: Copy Android package to Android e2e test directory

- script: |
yarn global add detox-cli
echo "Path: $PATH"
echo "##vso[task.prependpath]$(yarn global bin)"
jchen351 marked this conversation as resolved.
Show resolved Hide resolved
echo "Updated PATH: $PATH"
jchen351 marked this conversation as resolved.
Show resolved Hide resolved
echo "Detox bin directory: $(yarn global bin)"
ls $(yarn global bin)
displayName: Install detox cli tools and prepend to PATH

- script: |
detox build --configuration android.emu.release
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Build React Native Detox Android e2e Tests

#
# Unit tests and E2E tests with Android emulator
#
- template: ../../templates/use-android-emulator.yml
parameters:
create: true
start: true

- template: ../../templates/android-dump-logs-from-steps.yml
parameters:
steps:
- task: Gradle@3
inputs:
gradleWrapperFile: '$(Build.SourcesDirectory)/js/react_native/android/gradlew'
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/android'
options: '--stacktrace'
tasks: 'connectedDebugAndroidTest'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
testRunTitle: 'React Native Android Instrumented Test results'
sonarQubeRunAnalysis: false
spotBugsAnalysis: false
displayName: Run React Native Android Instrumented Tests

- script: |
JEST_JUNIT_OUTPUT_FILE=$(Build.SourcesDirectory)/js/react_native/e2e/android-test-results.xml \
detox test --record-logs all \
--configuration android.emu.release \
--loglevel trace \
--take-screenshots failing
workingDirectory: '$(Build.SourcesDirectory)/js/react_native/e2e'
displayName: Run React Native Detox Android e2e Tests

- template: ../../templates/use-android-emulator.yml
parameters:
stop: true

- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Build.SourcesDirectory)/js/react_native/e2e/android-test-results.xml'
failTaskOnFailedTests: true
testRunTitle: 'React Native Detox Android e2e Test Results'
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: ../../templates/explicitly-defined-final-tasks.yml
Loading
Loading