mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-17 21:10:43 +00:00
### Description
<!-- Describe your changes. -->
Android emulator usage updates:
- Change approach to detecting boot has completed
- use `-delay-adb` and a simple command (`ls`) with `wait-for-device` as
the first step
- this ensures enough startup has occurred for adb to be responsive
- use secondary loop on the python side to check for sys.boot_completed
to be set
- doing the check on the python side provides more feedback and seems to
work well
- make the 'stop' logic more precise by using psutil
- add internal timeout of 20 mins for emulator startup
- waiting for the CI jobs overall timeout is way too long
- value is hardcoded for now (most CIs startup in under 10 mins) but
could be made configurable if needed
CI updates:
- add template for using the Android emulator
- update CIs to use template
- reorder React Native CI
- minimize the time the Android emulator or iOS simulator is running by
moving some build steps around
- don't run both at the same time
- unnecessary and potentially adds significant memory pressure to the
machine
- fix QNN Android emulator CI as much as possible
- now everything works apart from running onnx_test_runner with the QNN
EP
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Fix inconsistent detection of the emulator boot completing.
---------
Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
parameters:
|
|
- name: artifactName
|
|
displayName: Artifact Name
|
|
type: string
|
|
default: ''
|
|
|
|
- name: job_name_suffix
|
|
displayName: job name
|
|
type: string
|
|
default: ''
|
|
|
|
- name: packageName
|
|
# now we can build onnxruntime-android or onnxruntime-mobile for Android, need specify it here
|
|
displayName: Package Name
|
|
type: string
|
|
default: 'onnxruntime-android'
|
|
|
|
jobs:
|
|
- job: Final_AAR_Testing_Android_${{ parameters.job_name_suffix }}
|
|
workspace:
|
|
clean: all
|
|
pool:
|
|
# We need macOS-12 to run the Android emulator for now.
|
|
# https://github.com/actions/runner-images/issues/7671
|
|
vmImage: 'macOS-12'
|
|
variables:
|
|
- name: runCodesignValidationInjection
|
|
value: false
|
|
timeoutInMinutes: 90
|
|
dependsOn:
|
|
- Android_Java_API_AAR_Packaging_${{ parameters.job_name_suffix }}
|
|
steps:
|
|
- template: set-version-number-variables-step.yml
|
|
|
|
- task: DownloadPipelineArtifact@2
|
|
displayName: 'Download Final Android AAR'
|
|
inputs:
|
|
buildType: 'current'
|
|
artifactName: '${{parameters.artifactName}}'
|
|
targetPath: '$(Build.BinariesDirectory)/final-android-aar'
|
|
|
|
- task: JavaToolInstaller@0
|
|
displayName: Use jdk 11
|
|
inputs:
|
|
versionSpec: '11'
|
|
jdkArchitectureOption: 'x64'
|
|
jdkSourceOption: 'PreInstalled'
|
|
|
|
- template: use-android-ndk.yml
|
|
|
|
- template: install-appcenter.yml
|
|
|
|
- template: use-android-emulator.yml
|
|
parameters:
|
|
create: true
|
|
start: true
|
|
|
|
- script: |
|
|
set -e -x
|
|
mkdir android_test
|
|
cd android_test
|
|
cp -av $(Build.SourcesDirectory)/java/src/test/android ./
|
|
cd ./android
|
|
mkdir -p app/libs
|
|
cp $(Build.BinariesDirectory)/final-android-aar/${{parameters.packageName}}-$(OnnxRuntimeVersion).aar app/libs/onnxruntime-mobile.aar
|
|
$(Build.SourcesDirectory)/java/gradlew --no-daemon clean connectedDebugAndroidTest --stacktrace
|
|
displayName: Run E2E test using Emulator
|
|
workingDirectory: $(Build.BinariesDirectory)
|
|
|
|
- template: use-android-emulator.yml
|
|
parameters:
|
|
stop: true
|
|
|
|
- script: |
|
|
set -e -x
|
|
cd android_test/android
|
|
appcenter test run espresso \
|
|
--app "AI-Frameworks/ORT-Mobile-Android" \
|
|
--devices $(app_center_android_test_devices) \
|
|
--app-path ./app/build/outputs/apk/debug/app-debug.apk \
|
|
--test-series "master" \
|
|
--locale "en_US" \
|
|
--build-dir ./app/build/outputs/apk/androidTest/debug \
|
|
--token $(app_center_api_token)
|
|
displayName: Run E2E tests using App Center
|
|
workingDirectory: $(Build.BinariesDirectory)
|
|
|
|
- template: component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|
|
|
|
- task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3
|
|
displayName: 'Clean Agent Directories'
|
|
condition: always()
|