microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
.pipelines/ios_packaging.yml
176lines · 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: 180 |
| 17 | |
| 18 | steps: |
| 19 | - template: templates/use-xcode-version.yml |
| 20 | |
| 21 | - task: UsePythonVersion@0 |
| 22 | inputs: |
| 23 | disableDownloadFromRegistry: true |
| 24 | versionSpec: "3.9" |
| 25 | addToPath: true |
| 26 | architecture: "x64" |
| 27 | |
| 28 | - script: | |
| 29 | python -m pip install cmake |
| 30 | displayName: "Install CMake" |
| 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 | -- \ |
| 48 | --one_cmake_extra_define OCOS_ENABLE_SELECTED_OPLIST=ON |
| 49 | displayName: "Build xcframework" |
| 50 | |
| 51 | - script: | |
| 52 | cat $(Build.BinariesDirectory)/xcframework_out/xcframework_info.json |
| 53 | displayName: 'List xcframework_info.json file contents' |
| 54 | |
| 55 | - script: | |
| 56 | python ./tools/ios/assemble_pod_package.py \ |
| 57 | --staging-dir $(Build.BinariesDirectory)/pod_staging \ |
| 58 | --xcframework-output-dir $(Build.BinariesDirectory)/xcframework_out \ |
| 59 | --pod-version ${ORT_EXTENSIONS_POD_VERSION} |
| 60 | displayName: "Assemble pod" |
| 61 | |
| 62 | - script: | |
| 63 | pod lib lint |
| 64 | displayName: "Lint pod" |
| 65 | workingDirectory: $(Build.BinariesDirectory)/pod_staging |
| 66 | |
| 67 | - script: | |
| 68 | ORT_EXTENSIONS_LOCAL_POD_PATH=$(Build.BinariesDirectory)/pod_staging \ |
| 69 | pod install |
| 70 | displayName: "Install pods for OrtExtensionsUsage" |
| 71 | workingDirectory: $(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage |
| 72 | |
| 73 | - script: | |
| 74 | set -e |
| 75 | |
| 76 | SIMULATOR_DEVICE_INFO=$(python ./tools/ios/get_simulator_device_info.py) |
| 77 | |
| 78 | echo "Simulator device info:" |
| 79 | echo "${SIMULATOR_DEVICE_INFO}" |
| 80 | |
| 81 | SIMULATOR_DEVICE_ID=$(jq --raw-output '.device_udid' <<< "${SIMULATOR_DEVICE_INFO}") |
| 82 | |
| 83 | # Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote. |
| 84 | set +x |
| 85 | echo "##vso[task.setvariable variable=ORT_EXTENSIONS_SIMULATOR_DEVICE_ID]${SIMULATOR_DEVICE_ID}" |
| 86 | displayName: "Get simulator device info" |
| 87 | |
| 88 | - script: | |
| 89 | xcrun simctl bootstatus ${ORT_EXTENSIONS_SIMULATOR_DEVICE_ID} -b |
| 90 | displayName: "Wait for simulator device to boot" |
| 91 | |
| 92 | - script: | |
| 93 | xcrun xcodebuild \ |
| 94 | -sdk iphonesimulator \ |
| 95 | -configuration Debug \ |
| 96 | -parallel-testing-enabled NO \ |
| 97 | -workspace $(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage/OrtExtensionsUsage.xcworkspace \ |
| 98 | -scheme OrtExtensionsUsage \ |
| 99 | -destination "platform=iOS Simulator,id=${ORT_EXTENSIONS_SIMULATOR_DEVICE_ID}" \ |
| 100 | test CODE_SIGNING_ALLOWED=NO |
| 101 | displayName: "Build and test OrtExtensionsUsage" |
| 102 | |
| 103 | - script: | |
| 104 | xcrun xcodebuild \ |
| 105 | -configuration Debug \ |
| 106 | -parallel-testing-enabled NO \ |
| 107 | -workspace $(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage/OrtExtensionsUsage.xcworkspace \ |
| 108 | -scheme OrtExtensionsMacOSUsage \ |
| 109 | -destination "platform=macos" \ |
| 110 | test CODE_SIGNING_ALLOWED=NO |
| 111 | displayName: "Build and test OrtExtensionsUsage for MacOS" |
| 112 | |
| 113 | - task: InstallAppleCertificate@2 |
| 114 | inputs: |
| 115 | certSecureFile: '$(ios_signing_certificate_name)' |
| 116 | certPwd: '$(ios_signing_certificate_password)' |
| 117 | keychain: 'temp' |
| 118 | name: installSigningCertificate |
| 119 | displayName: "Install ORT Mobile Test Signing Certificate" |
| 120 | |
| 121 | - task: InstallAppleProvisioningProfile@1 |
| 122 | inputs: |
| 123 | provProfileSecureFile: '$(ios_provision_profile_name)' |
| 124 | removeProfile: true |
| 125 | name: installProvisioningProfile |
| 126 | displayName: "Install ORT Mobile Test Provisioning Profile" |
| 127 | |
| 128 | - script: | |
| 129 | xcrun xcodebuild \ |
| 130 | -sdk iphoneos \ |
| 131 | -configuration Debug \ |
| 132 | -workspace $(Build.SourcesDirectory)/test/ios/OrtExtensionsUsage/OrtExtensionsUsage.xcworkspace \ |
| 133 | -scheme OrtExtensionsUsage \ |
| 134 | -derivedDataPath $(Build.BinariesDirectory)/appcenter_test_derived_data \ |
| 135 | build-for-testing \ |
| 136 | CODE_SIGN_STYLE=Manual \ |
| 137 | "CODE_SIGN_IDENTITY=$(installSigningCertificate.signingIdentity)" \ |
| 138 | PROVISIONING_PROFILE= \ |
| 139 | "PROVISIONING_PROFILE_SPECIFIER=$(installProvisioningProfile.provisioningProfileName)" |
| 140 | displayName: "Build appcenter test" |
| 141 | |
| 142 | - script: | |
| 143 | appcenter test run xcuitest \ |
| 144 | --app "AI-Frameworks/ORT-Ext-Mobile-iOS-Testapp" \ |
| 145 | --devices "AI-Frameworks/apple-test-device-set" \ |
| 146 | --test-series "master" \ |
| 147 | --locale "en_US" \ |
| 148 | --build-dir $(Build.BinariesDirectory)/appcenter_test_derived_data/Build/Products/Debug-iphoneos \ |
| 149 | --token $(app_center_api_token) |
| 150 | displayName: "Run appcenter test" |
| 151 | |
| 152 | - script: | |
| 153 | set -e -x |
| 154 | |
| 155 | POD_STAGING_DIR="$(Build.BinariesDirectory)/pod_staging" |
| 156 | ARTIFACTS_STAGING_DIR="$(Build.ArtifactStagingDirectory)" |
| 157 | POD_NAME="onnxruntime-extensions-c" |
| 158 | POD_ARCHIVE_BASENAME="pod-archive-${POD_NAME}-${ORT_EXTENSIONS_POD_VERSION}.zip" |
| 159 | PODSPEC_BASENAME="${POD_NAME}.podspec" |
| 160 | |
| 161 | pushd ${POD_STAGING_DIR} |
| 162 | |
| 163 | # assemble the files in the artifacts staging directory |
| 164 | zip -vry ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} * --exclude ${PODSPEC_BASENAME} |
| 165 | cp ${PODSPEC_BASENAME} ${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME} |
| 166 | |
| 167 | popd |
| 168 | displayName: "Assemble artifacts" |
| 169 | |
| 170 | - publish: "$(Build.ArtifactStagingDirectory)" |
| 171 | artifact: ios_packaging_artifacts |
| 172 | displayName: "Publish artifacts" |
| 173 | |
| 174 | - template: templates/component-governance-component-detection-steps.yml |
| 175 | parameters : |
| 176 | condition : 'succeeded' |
| 177 | |