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