onnxruntime/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml
Jian Chen fa68ae2def
Update pool to MacOS-13 (#17361)
### Description
See https://github.com/microsoft/onnxruntime-extensions/pull/476
and https://github.com/actions/runner-images/issues/7671

### 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. -->

### Current issue
- [ ] For default xcode 15.2, that come with the MacOS-13, We Need to
update the boost container header boost/container_hash/hash.hpp version
to pass the build
- [x] For xcode 14.2 The Build passed but the `Run React Native Detox
Android e2e Test` Failed.
Possible flaky test, https://github.com/microsoft/onnxruntime/pull/21969
- [x] For xcode 14.3.1 We encountered following issue in `Build React
Native Detox iOS e2e Tests`
```
ld: file not found: /Applications/Xcode_14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
Applied following code to the eof in both ios/Podfile and fixed the
issue
```
post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
            end
        end
    end
end
```


- [x] https://github.com/facebook/react-native/issues/32483

Applying changes to ios/Pofile
```
pre_install do |installer|
  # Custom pre-install script or commands
  puts "Running pre-install script..."

  # Recommended fix for https://github.com/facebook/react-native/issues/32483
  # from https://github.com/facebook/react-native/issues/32483#issuecomment-966784501
  system("sed -i '' 's/typedef uint8_t clockid_t;//' \"${SRCROOT}/Pods/RCT-Folly/folly/portability/Time.h\"")
end
```

- [ ] Detox environment setting up exceeded time out of 120000ms during
iso e2e test


### dependent 

- [x] https://github.com/microsoft/onnxruntime/pull/21159

---------

Co-authored-by: Changming Sun <chasun@microsoft.com>
2024-09-17 10:07:30 -07:00

91 lines
2.5 KiB
YAML

parameters:
- name: artifactName
displayName: Artifact Name
type: string
default: ''
- name: job_name_suffix
displayName: job name
type: string
default: ''
- name: packageName
displayName: Package Name
type: string
default: 'onnxruntime-android'
jobs:
- job: Final_AAR_Testing_Android_${{ parameters.job_name_suffix }}
workspace:
clean: all
pool:
vmImage: 'macOS-13'
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 17
inputs:
versionSpec: '17'
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-android.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()