86 строки
2.9 KiB
YAML
86 строки
2.9 KiB
YAML
# packaging pipeline for onnxruntime-extensions Android AAR package
|
|
|
|
jobs:
|
|
- job: AndroidPackaging
|
|
pool:
|
|
vmImage: "macOS-13"
|
|
timeoutInMinutes: 150
|
|
variables:
|
|
buildConfig: Release
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
disableDownloadFromRegistry: true
|
|
versionSpec: "3.9"
|
|
addToPath: true
|
|
architecture: "x64"
|
|
displayName: "Use Python 3.9"
|
|
|
|
- task: JavaToolInstaller@0
|
|
displayName: Use jdk 17
|
|
inputs:
|
|
versionSpec: "17"
|
|
jdkArchitectureOption: "x64"
|
|
jdkSourceOption: "PreInstalled"
|
|
|
|
- script: brew install coreutils ninja
|
|
displayName: Install coreutils and ninja
|
|
|
|
- template: templates/install-appcenter.yml
|
|
|
|
- script: |
|
|
python ./tools/gen_selectedops.py ./tools/android/package_ops.config
|
|
displayName: "Generate selected ops CMake file"
|
|
|
|
- bash: |
|
|
set -e -x
|
|
|
|
python ./tools/android/build_aar.py \
|
|
--output_dir $(Build.BinariesDirectory)/android_aar \
|
|
--config $(buildConfig) \
|
|
-- \
|
|
--one_cmake_extra_define OCOS_ENABLE_SELECTED_OPLIST=ON
|
|
|
|
VERSION=$(cat ./version.txt)
|
|
AAR_PATH="$(Build.BinariesDirectory)/android_aar/aar_out/$(buildConfig)/com/microsoft/onnxruntime/onnxruntime-extensions-android/${VERSION}/onnxruntime-extensions-android-${VERSION}.aar"
|
|
|
|
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
|
|
set +x
|
|
echo "##vso[task.setvariable variable=ORT_EXTENSIONS_AAR_PATH]${AAR_PATH}"
|
|
displayName: Build onnxruntime-extensions AAR package
|
|
|
|
- template: templates/run-with-android-emulator-steps.yml
|
|
parameters:
|
|
steps:
|
|
|
|
- bash: |
|
|
set -e -x
|
|
|
|
cp -r $(Build.SourcesDirectory)/java/src/test/android $(Build.BinariesDirectory)/android_test
|
|
|
|
cd $(Build.BinariesDirectory)/android_test
|
|
|
|
./gradlew connectedDebugAndroidTest --no-daemon -DortExtensionsAarLocalPath="${ORT_EXTENSIONS_AAR_PATH}"
|
|
displayName: Build and run onnxruntime-extensions Android test with Android Emulator
|
|
|
|
- bash: |
|
|
set -e -x
|
|
|
|
AAR_DIR=$(dirname "${ORT_EXTENSIONS_AAR_PATH}")
|
|
ARTIFACTS_STAGING_DIR="$(Build.ArtifactStagingDirectory)"
|
|
|
|
cp ${ORT_EXTENSIONS_AAR_PATH} ${ARTIFACTS_STAGING_DIR}
|
|
cp ${AAR_DIR}/*-javadoc.jar ${ARTIFACTS_STAGING_DIR}
|
|
cp ${AAR_DIR}/*-sources.jar ${ARTIFACTS_STAGING_DIR}
|
|
cp ${AAR_DIR}/*.pom ${ARTIFACTS_STAGING_DIR}
|
|
|
|
displayName: "Assemble artifacts"
|
|
|
|
- publish: "$(Build.ArtifactStagingDirectory)"
|
|
artifact: onnxruntime-extensions-android-aar
|
|
displayName: "Publish artifacts"
|
|
|
|
- template: templates/component-governance-component-detection-steps.yml
|
|
parameters :
|
|
condition : 'succeeded'
|