microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/android_packaging.yml
85lines · modecode
| 1 | # packaging pipeline for onnxruntime-extensions Android AAR package |
| 2 | |
| 3 | jobs: |
| 4 | - job: AndroidPackaging |
| 5 | pool: |
| 6 | vmImage: "macOS-13" |
| 7 | timeoutInMinutes: 150 |
| 8 | variables: |
| 9 | buildConfig: Release |
| 10 | steps: |
| 11 | - task: UsePythonVersion@0 |
| 12 | inputs: |
| 13 | disableDownloadFromRegistry: true |
| 14 | versionSpec: "3.9" |
| 15 | addToPath: true |
| 16 | architecture: "x64" |
| 17 | displayName: "Use Python 3.9" |
| 18 | |
| 19 | - task: JavaToolInstaller@0 |
| 20 | displayName: Use jdk 17 |
| 21 | inputs: |
| 22 | versionSpec: "17" |
| 23 | jdkArchitectureOption: "x64" |
| 24 | jdkSourceOption: "PreInstalled" |
| 25 | |
| 26 | - script: brew install coreutils ninja |
| 27 | displayName: Install coreutils and ninja |
| 28 | |
| 29 | - template: templates/install-appcenter.yml |
| 30 | |
| 31 | - script: | |
| 32 | python ./tools/gen_selectedops.py ./tools/android/package_ops.config |
| 33 | displayName: "Generate selected ops CMake file" |
| 34 | |
| 35 | - bash: | |
| 36 | set -e -x |
| 37 | |
| 38 | python ./tools/android/build_aar.py \ |
| 39 | --output_dir $(Build.BinariesDirectory)/android_aar \ |
| 40 | --config $(buildConfig) \ |
| 41 | -- \ |
| 42 | --one_cmake_extra_define OCOS_ENABLE_SELECTED_OPLIST=ON |
| 43 | |
| 44 | VERSION=$(cat ./version.txt) |
| 45 | AAR_PATH="$(Build.BinariesDirectory)/android_aar/aar_out/$(buildConfig)/com/microsoft/onnxruntime/onnxruntime-extensions-android/${VERSION}/onnxruntime-extensions-android-${VERSION}.aar" |
| 46 | |
| 47 | # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. |
| 48 | set +x |
| 49 | echo "##vso[task.setvariable variable=ORT_EXTENSIONS_AAR_PATH]${AAR_PATH}" |
| 50 | displayName: Build onnxruntime-extensions AAR package |
| 51 | |
| 52 | - template: templates/run-with-android-emulator-steps.yml |
| 53 | parameters: |
| 54 | steps: |
| 55 | |
| 56 | - bash: | |
| 57 | set -e -x |
| 58 | |
| 59 | cp -r $(Build.SourcesDirectory)/java/src/test/android $(Build.BinariesDirectory)/android_test |
| 60 | |
| 61 | cd $(Build.BinariesDirectory)/android_test |
| 62 | |
| 63 | ./gradlew connectedDebugAndroidTest --no-daemon -DortExtensionsAarLocalPath="${ORT_EXTENSIONS_AAR_PATH}" |
| 64 | displayName: Build and run onnxruntime-extensions Android test with Android Emulator |
| 65 | |
| 66 | - bash: | |
| 67 | set -e -x |
| 68 | |
| 69 | AAR_DIR=$(dirname "${ORT_EXTENSIONS_AAR_PATH}") |
| 70 | ARTIFACTS_STAGING_DIR="$(Build.ArtifactStagingDirectory)" |
| 71 | |
| 72 | cp ${ORT_EXTENSIONS_AAR_PATH} ${ARTIFACTS_STAGING_DIR} |
| 73 | cp ${AAR_DIR}/*-javadoc.jar ${ARTIFACTS_STAGING_DIR} |
| 74 | cp ${AAR_DIR}/*-sources.jar ${ARTIFACTS_STAGING_DIR} |
| 75 | cp ${AAR_DIR}/*.pom ${ARTIFACTS_STAGING_DIR} |
| 76 | |
| 77 | displayName: "Assemble artifacts" |
| 78 | |
| 79 | - publish: "$(Build.ArtifactStagingDirectory)" |
| 80 | artifact: onnxruntime-extensions-android-aar |
| 81 | displayName: "Publish artifacts" |
| 82 | |
| 83 | - template: templates/component-governance-component-detection-steps.yml |
| 84 | parameters : |
| 85 | condition : 'succeeded' |
| 86 | |