microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/ios_packaging.yml
128lines · modecode
| 1 | # packaging pipeline for iOS CocoaPods package |
| 2 | |
| 3 | parameters: |
| 4 | - name: IsReleaseBuild |
| 5 | displayName: "Is this is a release build?" |
| 6 | type: boolean |
| 7 | default: false |
| 8 | |
| 9 | jobs: |
| 10 | - job: IosPackaging |
| 11 | displayName: "iOS Packaging" |
| 12 | |
| 13 | pool: |
| 14 | vmImage: "macOS-12" |
| 15 | |
| 16 | timeoutInMinutes: 120 |
| 17 | |
| 18 | steps: |
| 19 | - task: UsePythonVersion@0 |
| 20 | inputs: |
| 21 | versionSpec: "3.9" |
| 22 | addToPath: true |
| 23 | architecture: "x64" |
| 24 | |
| 25 | # iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0 |
| 26 | - script: | |
| 27 | python -m pip install cmake==3.25.0 |
| 28 | displayName: "Install CMake 3.25.0" |
| 29 | |
| 30 | - template: templates/set-package-version-variable-step.yml |
| 31 | parameters: |
| 32 | IsReleaseBuild: ${{ parameters.IsReleaseBuild }} |
| 33 | PackageVersionVariableName: ORT_EXTENSIONS_POD_VERSION |
| 34 | |
| 35 | - script: | |
| 36 | python ./tools/gen_selectedops.py ./tools/ios/package_ops.config |
| 37 | displayName: "Generate selected ops CMake file" |
| 38 | |
| 39 | - script: | |
| 40 | python ./tools/ios/build_xcframework.py \ |
| 41 | --output-dir $(Build.BinariesDirectory)/xcframework_out \ |
| 42 | --config Release \ |
| 43 | --cmake-extra-defines OCOS_ENABLE_SELECTED_OPLIST=ON |
| 44 | displayName: "Build xcframework" |
| 45 | |
| 46 | - script: | |
| 47 | python ./tools/ios/assemble_pod_package.py \ |
| 48 | --staging-dir $(Build.BinariesDirectory)/pod_staging \ |
| 49 | --xcframework-output-dir $(Build.BinariesDirectory)/xcframework_out \ |
| 50 | --pod-version ${ORT_EXTENSIONS_POD_VERSION} |
| 51 | displayName: "Assemble pod" |
| 52 | |
| 53 | - script: | |
| 54 | pod lib lint |
| 55 | displayName: "Lint pod" |
| 56 | workingDirectory: $(Build.BinariesDirectory)/pod_staging |
| 57 | |
| 58 | - script: | |
| 59 | ORT_EXTENSIONS_LOCAL_POD_PATH=$(Build.BinariesDirectory)/pod_staging \ |
| 60 | pod install |
| 61 | displayName: "Install pods for OrtExtensionsUsage" |
| 62 | workingDirectory: $(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage |
| 63 | |
| 64 | - template: templates/run-with-ios-simulator-steps.yml |
| 65 | parameters: |
| 66 | steps: |
| 67 | - template: templates/xcode-build-and-test-step.yml |
| 68 | parameters: |
| 69 | xcWorkspacePath: '$(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage/OrtExtensionsUsage.xcworkspace' |
| 70 | scheme: 'OrtExtensionsUsage' |
| 71 | |
| 72 | - task: InstallAppleCertificate@2 |
| 73 | inputs: |
| 74 | certSecureFile: '$(ios_signing_certificate_name)' |
| 75 | certPwd: '$(ios_signing_certificate_password)' |
| 76 | keychain: 'temp' |
| 77 | displayName: "Install ORT Mobile Test Signing Certificate" |
| 78 | |
| 79 | - task: InstallAppleProvisioningProfile@1 |
| 80 | inputs: |
| 81 | provProfileSecureFile: '$(ios_provision_profile_name)' |
| 82 | removeProfile: true |
| 83 | displayName: "Install ORT Mobile Test Provisioning Profile" |
| 84 | |
| 85 | - task: Xcode@5 |
| 86 | inputs: |
| 87 | actions: 'build-for-testing' |
| 88 | configuration: 'Debug' |
| 89 | xcWorkspacePath: '$(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage/OrtExtensionsUsage.xcworkspace' |
| 90 | sdk: 'iphoneos' |
| 91 | scheme: 'OrtExtensionsUsage' |
| 92 | signingOption: 'manual' |
| 93 | signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' |
| 94 | provisioningProfileName: 'iOS Team Provisioning Profile' |
| 95 | args: '-derivedDataPath $(Build.BinariesDirectory)/appcenter_test_derived_data' |
| 96 | displayName: "Build appcenter test" |
| 97 | |
| 98 | - script: | |
| 99 | appcenter test run xcuitest \ |
| 100 | --app "AI-Frameworks/ORT-Ext-Mobile-iOS-Testapp" \ |
| 101 | --devices "AI-Frameworks/apple-test-device-set" \ |
| 102 | --test-series "master" \ |
| 103 | --locale "en_US" \ |
| 104 | --build-dir $(Build.BinariesDirectory)/appcenter_test_derived_data/Build/Products/Debug-iphoneos \ |
| 105 | --token $(app_center_api_token) |
| 106 | displayName: "Run appcenter test" |
| 107 | |
| 108 | - script: | |
| 109 | set -e -x |
| 110 | |
| 111 | POD_STAGING_DIR="$(Build.BinariesDirectory)/pod_staging" |
| 112 | ARTIFACTS_STAGING_DIR="$(Build.ArtifactStagingDirectory)" |
| 113 | POD_NAME="onnxruntime-extensions-c" |
| 114 | POD_ARCHIVE_BASENAME="pod-archive-${POD_NAME}-${ORT_EXTENSIONS_POD_VERSION}.zip" |
| 115 | PODSPEC_BASENAME="${POD_NAME}.podspec" |
| 116 | |
| 117 | pushd ${POD_STAGING_DIR} |
| 118 | |
| 119 | # assemble the files in the artifacts staging directory |
| 120 | zip -r ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} * --exclude ${PODSPEC_BASENAME} |
| 121 | cp ${PODSPEC_BASENAME} ${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME} |
| 122 | |
| 123 | popd |
| 124 | displayName: "Assemble artifacts" |
| 125 | |
| 126 | - publish: "$(Build.ArtifactStagingDirectory)" |
| 127 | artifact: ios_packaging_artifacts |
| 128 | displayName: "Publish artifacts" |
| 129 | |