mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
### Description Pre built QNN Android package ### Future Work 1. Setting up CI with Browserstack- onnxruntime_tests and Android test 2. ESRP Release to Maven
130 lines
4 KiB
YAML
130 lines
4 KiB
YAML
parameters:
|
|
- name: buildConfig
|
|
displayName: Configuration to build
|
|
type: string
|
|
default: 'Release'
|
|
|
|
- name: buildSettings
|
|
displayName: Path to the build setting file
|
|
type: string
|
|
default: ''
|
|
|
|
- name: includedOpsConfig
|
|
displayName: Path to the included ops config file
|
|
type: string
|
|
default: ''
|
|
|
|
- name: artifactName
|
|
displayName: Artifact Name
|
|
type: string
|
|
default: ''
|
|
|
|
- name: job_name_suffix
|
|
displayName: Job name
|
|
type: string
|
|
default: ''
|
|
|
|
- name: publish_executables
|
|
# The executables will only be published if the publish_executables is set to "1"
|
|
displayName: Publish executables such as onnxruntime_perf_test, ...
|
|
type: string
|
|
default: '0'
|
|
|
|
- name: pool_name
|
|
displayName: Pool name
|
|
type: string
|
|
default: 'onnxruntime-Ubuntu2204-AMD-CPU'
|
|
|
|
- name: packageName
|
|
displayName: Package Name
|
|
type: string
|
|
default: 'onnxruntime-android'
|
|
- name: enable_code_sign
|
|
displayName: Use GPG to sign the jars
|
|
type: boolean
|
|
|
|
jobs:
|
|
- job: Android_Java_API_AAR_Packaging_${{ parameters.job_name_suffix }}
|
|
timeoutInMinutes: 120
|
|
workspace:
|
|
clean: all
|
|
pool: ${{parameters.pool_name}}
|
|
|
|
variables:
|
|
artifacts_directory: $(Build.BinariesDirectory)/.artifacts
|
|
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: none
|
|
|
|
- task: CmdLine@2
|
|
displayName: Create artifacts directory
|
|
inputs:
|
|
script: |
|
|
# Create a folder for artifacts
|
|
mkdir -p $(artifacts_directory)
|
|
workingDirectory: $(Build.BinariesDirectory)
|
|
|
|
#TODO: use a different docker file since this job doesn't need to rely on manylinux
|
|
- template: get-docker-image-steps.yml
|
|
parameters:
|
|
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_cpu
|
|
Context: tools/ci_build/github/linux/docker
|
|
DockerBuildArgs: "--build-arg BUILD_UID=$( id -u )"
|
|
Repository: onnxruntimecpubuild
|
|
|
|
- template: set-version-number-variables-step.yml
|
|
|
|
- template: use-android-ndk.yml
|
|
|
|
- ${{ if contains(parameters.packageName, 'qnn') }}:
|
|
- template: jobs/download_linux_qnn_sdk.yml
|
|
|
|
- task: CmdLine@2
|
|
displayName: Build Android AAR Packages
|
|
inputs:
|
|
script: |
|
|
set -e -x
|
|
NDK_HOME=$(realpath $ANDROID_NDK_HOME)
|
|
mkdir $(Build.BinariesDirectory)/.build_settings
|
|
cp ${{parameters.buildSettings}} $(Build.BinariesDirectory)/.build_settings/build_settings.json
|
|
[ -f "${{parameters.includedOpsConfig}}" ] && \
|
|
cp ${{parameters.includedOpsConfig}} $(Build.BinariesDirectory)/.build_settings/include_ops_and_types.config
|
|
|
|
# Mount qnn volume if building qnn android package
|
|
if [[ ${{ parameters.packageName }} == *qnn* ]]; then
|
|
QNN_VOLUME="--volume $(QnnSDKRootDir):/qnn_home"
|
|
USE_QNN="1"
|
|
else
|
|
QNN_VOLUME=""
|
|
USE_QNN="0"
|
|
fi
|
|
docker run --rm \
|
|
--volume $(Build.SourcesDirectory):/onnxruntime_src \
|
|
--volume $(Build.BinariesDirectory):/build \
|
|
--volume $ANDROID_HOME:/android_home \
|
|
--volume $NDK_HOME:/ndk_home \
|
|
--volume $(artifacts_directory):/home/onnxruntimedev/.artifacts \
|
|
--volume $(Build.BinariesDirectory)/.build_settings:/home/onnxruntimedev/.build_settings \
|
|
$QNN_VOLUME \
|
|
-e NIGHTLY_BUILD \
|
|
-e BUILD_BUILDNUMBER \
|
|
-e BUILD_CONFIG=${{parameters.buildConfig}} \
|
|
-e ORT_VERSION=$(OnnxRuntimeVersion) \
|
|
-e PUBLISH_EXECUTABLES=${{parameters.publish_executables}} \
|
|
-e PACKAGE_NAME=${{parameters.packageName}} \
|
|
onnxruntimecpubuild \
|
|
/bin/bash /onnxruntime_src/tools/ci_build/github/android/build_aar_and_copy_artifacts.sh $USE_QNN
|
|
workingDirectory: $(Build.SourcesDirectory)
|
|
|
|
|
|
- ${{ if eq(parameters['enable_code_sign'], 'true') }}:
|
|
- template: jar-maven-signing-linux.yml
|
|
parameters:
|
|
JarFileDirectory: '$(artifacts_directory)'
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
inputs:
|
|
pathtoPublish: '$(artifacts_directory)'
|
|
artifactName: '${{parameters.artifactName}}'
|