mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-29 23:06:41 +00:00
[ios] Enable training package in packaging pipeline (#16683)
Build iOS training package in packaging pipeline. Refactor iOS packaging pipeline to build different package variants in parallel.
This commit is contained in:
parent
6e895fe70a
commit
fc1f463ff1
6 changed files with 289 additions and 236 deletions
|
|
@ -6,7 +6,7 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
USAGE_TEXT="Usage: ${0} <binaries staging directory> <artifacts staging directory> <ORT pod version> <whether to upload the package archives, 'true' or 'false'>"
|
||||
USAGE_TEXT="Usage: ${0} <binaries staging directory> <artifacts staging directory> <ORT pod name> <ORT pod version>"
|
||||
|
||||
abspath() {
|
||||
local INPUT_PATH=${1:?"Expected path as the first argument."}
|
||||
|
|
@ -17,39 +17,16 @@ abspath() {
|
|||
BINARIES_STAGING_DIR=$(abspath "${1:?${USAGE_TEXT}}")
|
||||
# staging directory for build artifacts (destination)
|
||||
ARTIFACTS_STAGING_DIR=$(abspath "${2:?${USAGE_TEXT}}")
|
||||
ORT_POD_VERSION=${3:?${USAGE_TEXT}}
|
||||
SHOULD_UPLOAD_ARCHIVES=${4:?${USAGE_TEXT}}
|
||||
POD_NAME=${3:?${USAGE_TEXT}}
|
||||
ORT_POD_VERSION=${4:?${USAGE_TEXT}}
|
||||
|
||||
STORAGE_ACCOUNT_NAME="onnxruntimepackages"
|
||||
STORAGE_ACCOUNT_CONTAINER_NAME='$web'
|
||||
STORAGE_URL_PREFIX=$(az storage account show --name ${STORAGE_ACCOUNT_NAME} --query "primaryEndpoints.web" --output tsv)
|
||||
POD_ARCHIVE_BASENAME="pod-archive-${POD_NAME}-${ORT_POD_VERSION}.zip"
|
||||
PODSPEC_BASENAME="${POD_NAME}.podspec"
|
||||
|
||||
assemble_and_upload_pod() {
|
||||
local POD_NAME=${1:?"Expected pod name as first argument."}
|
||||
local POD_ARCHIVE_BASENAME="pod-archive-${POD_NAME}-${ORT_POD_VERSION}.zip"
|
||||
local PODSPEC_BASENAME="${POD_NAME}.podspec"
|
||||
pushd "${BINARIES_STAGING_DIR}/${POD_NAME}"
|
||||
|
||||
pushd ${BINARIES_STAGING_DIR}/${POD_NAME}
|
||||
# assemble the files in the artifacts staging directory
|
||||
zip -r "${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME}" ./* --exclude "${PODSPEC_BASENAME}"
|
||||
cp "${PODSPEC_BASENAME}" "${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME}"
|
||||
|
||||
# assemble the files in the artifacts staging directory
|
||||
zip -r ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} * --exclude ${PODSPEC_BASENAME}
|
||||
cp ${PODSPEC_BASENAME} ${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME}
|
||||
|
||||
if [[ "${SHOULD_UPLOAD_ARCHIVES}" == "true" ]]; then
|
||||
# upload the pod archive and set the podspec source to the pod archive URL
|
||||
az storage blob upload \
|
||||
--account-name ${STORAGE_ACCOUNT_NAME} --container-name ${STORAGE_ACCOUNT_CONTAINER_NAME} \
|
||||
--file ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} --name ${POD_ARCHIVE_BASENAME} \
|
||||
--if-none-match "*"
|
||||
|
||||
sed -i "" -e "s|file:///http_source_placeholder|${STORAGE_URL_PREFIX}${POD_ARCHIVE_BASENAME}|" \
|
||||
${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME}
|
||||
fi
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
assemble_and_upload_pod "onnxruntime-mobile-c"
|
||||
assemble_and_upload_pod "onnxruntime-mobile-objc"
|
||||
assemble_and_upload_pod "onnxruntime-c"
|
||||
assemble_and_upload_pod "onnxruntime-objc"
|
||||
popd
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
"--use_xcode",
|
||||
"--build_apple_framework",
|
||||
"--use_coreml",
|
||||
"--use_xnnpack",
|
||||
"--skip_tests",
|
||||
"--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF",
|
||||
"--apple_deploy_target=12.0",
|
||||
"--use_xnnpack"
|
||||
"--apple_deploy_target=12.0"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
"--use_xcode",
|
||||
"--enable_training_apis",
|
||||
"--build_apple_framework",
|
||||
"--use_coreml",
|
||||
"--use_xnnpack",
|
||||
"--skip_tests",
|
||||
"--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF",
|
||||
"--apple_deploy_target=12.0"
|
||||
|
|
|
|||
30
tools/ci_build/github/apple/upload_pod_archive_and_update_podspec.sh
Executable file
30
tools/ci_build/github/apple/upload_pod_archive_and_update_podspec.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Note: This script is intended to be called from the iOS CocoaPods package release pipeline or a similar context.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
USAGE_TEXT="Usage: ${0} <path to pod archive> <path to podspec>"
|
||||
|
||||
abspath() {
|
||||
local INPUT_PATH=${1:?"Expected path as the first argument."}
|
||||
echo "$(cd "$(dirname "${INPUT_PATH}")" && pwd)/$(basename "${INPUT_PATH}")"
|
||||
}
|
||||
|
||||
POD_ARCHIVE_PATH=$(abspath "${1:?${USAGE_TEXT}}")
|
||||
PODSPEC_PATH=$(abspath "${2:?${USAGE_TEXT}}")
|
||||
|
||||
POD_ARCHIVE_BASENAME=$(basename "${POD_ARCHIVE_PATH}")
|
||||
|
||||
STORAGE_ACCOUNT_NAME="onnxruntimepackages"
|
||||
STORAGE_ACCOUNT_CONTAINER_NAME="\$web"
|
||||
STORAGE_URL_PREFIX=$(az storage account show --name ${STORAGE_ACCOUNT_NAME} --query "primaryEndpoints.web" --output tsv)
|
||||
|
||||
# upload the pod archive and set the podspec source to the pod archive URL
|
||||
az storage blob upload \
|
||||
--account-name ${STORAGE_ACCOUNT_NAME} --container-name ${STORAGE_ACCOUNT_CONTAINER_NAME} \
|
||||
--file "${POD_ARCHIVE_PATH}" --name "${POD_ARCHIVE_BASENAME}" \
|
||||
--if-none-match "*"
|
||||
|
||||
sed -i "" -e "s|file:///http_source_placeholder|${STORAGE_URL_PREFIX}${POD_ARCHIVE_BASENAME}|" "${PODSPEC_PATH}"
|
||||
|
|
@ -1,235 +1,117 @@
|
|||
parameters:
|
||||
- name: BuildType
|
||||
- name: buildType
|
||||
displayName: |-
|
||||
Type of build.
|
||||
"release": A release build to be published for an official ONNX Runtime release.
|
||||
"prerelease": A pre-release build to be published for validation prior to release.
|
||||
"normal": A normal build not for publication.
|
||||
"normal": A normal build. This can be published as a pre-release build for validation prior to release.
|
||||
type: string
|
||||
values:
|
||||
- release
|
||||
- prerelease
|
||||
- normal
|
||||
default: normal
|
||||
|
||||
name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format
|
||||
|
||||
jobs:
|
||||
- job: IosPackaging
|
||||
displayName: "iOS Packaging"
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
|
||||
stages:
|
||||
- stage: IosPackaging_SetCommonVariables
|
||||
dependsOn: []
|
||||
|
||||
variables:
|
||||
xcodeVersion: "14.3"
|
||||
skipComponentGovernanceDetection: true
|
||||
|
||||
timeoutInMinutes: 300
|
||||
jobs:
|
||||
- job: j
|
||||
displayName: "Set common variables"
|
||||
|
||||
steps:
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: '$(ios_signing_certificate_name)'
|
||||
certPwd: '$(ios_signing_certificate_password)'
|
||||
keychain: 'temp'
|
||||
deleteCert: true
|
||||
displayName: 'Install ORT Mobile Test Signing Certificate'
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: '$(ios_provision_profile_name)'
|
||||
removeProfile: true
|
||||
displayName: 'Install ORT Mobile Test Provisioning Profile'
|
||||
timeoutInMinutes: 5
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.9"
|
||||
addToPath: true
|
||||
architecture: "x64"
|
||||
steps:
|
||||
- bash: |
|
||||
set -e
|
||||
|
||||
- template: templates/use-xcode-version.yml
|
||||
parameters:
|
||||
xcodeVersion: ${{ variables.xcodeVersion }}
|
||||
BUILD_TYPE="${{ parameters.buildType }}"
|
||||
BASE_VERSION="$(cat ./VERSION_NUMBER)"
|
||||
SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)"
|
||||
DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}"
|
||||
|
||||
- template: templates/install-appcenter.yml
|
||||
case "${BUILD_TYPE}" in
|
||||
("release")
|
||||
VERSION="${BASE_VERSION}" ;;
|
||||
("normal")
|
||||
VERSION="${DEV_VERSION}" ;;
|
||||
(*)
|
||||
echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;;
|
||||
esac
|
||||
|
||||
- script: |
|
||||
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
|
||||
displayName: "Install Python requirements"
|
||||
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
|
||||
set +x
|
||||
|
||||
- bash: |
|
||||
set -e
|
||||
set_var() {
|
||||
local VAR_NAME=${1:?}
|
||||
local VAR_VALUE=${2:?}
|
||||
echo "##vso[task.setvariable variable=${VAR_NAME};isoutput=true;isreadonly=true]${VAR_VALUE}"
|
||||
echo "${VAR_NAME}: ${VAR_VALUE}"
|
||||
}
|
||||
|
||||
BUILD_TYPE="${{ parameters.BuildType }}"
|
||||
BASE_VERSION="$(cat ./VERSION_NUMBER)"
|
||||
SHORT_COMMIT_HASH="$(git rev-parse --short HEAD)"
|
||||
DEV_VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber).${SHORT_COMMIT_HASH}"
|
||||
set_var "ORT_POD_VERSION" "${VERSION}"
|
||||
displayName: "Set common variables"
|
||||
name: SetCommonVariables
|
||||
|
||||
case "${BUILD_TYPE}" in
|
||||
("release")
|
||||
VERSION="${BASE_VERSION}"; SHOULD_UPLOAD_ARCHIVES="true" ;;
|
||||
("prerelease")
|
||||
VERSION="${DEV_VERSION}"; SHOULD_UPLOAD_ARCHIVES="true" ;;
|
||||
("normal")
|
||||
VERSION="${DEV_VERSION}"; SHOULD_UPLOAD_ARCHIVES="false" ;;
|
||||
(*)
|
||||
echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;;
|
||||
esac
|
||||
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
||||
parameters:
|
||||
packageVariant: Mobile
|
||||
|
||||
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
|
||||
set +x
|
||||
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
||||
parameters:
|
||||
packageVariant: Full
|
||||
|
||||
set_var() {
|
||||
local VAR_NAME=${1:?}
|
||||
local VAR_VALUE=${2:?}
|
||||
echo "##vso[task.setvariable variable=${VAR_NAME}]${VAR_VALUE}"
|
||||
echo "${VAR_NAME}: ${VAR_VALUE}"
|
||||
}
|
||||
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
||||
parameters:
|
||||
packageVariant: Training
|
||||
|
||||
set_var "ORT_POD_VERSION" "${VERSION}"
|
||||
set_var "ORT_SHOULD_UPLOAD_ARCHIVES" "${SHOULD_UPLOAD_ARCHIVES}"
|
||||
displayName: "Set variables"
|
||||
- stage: IosPackaging_TestPackageSwift_Full
|
||||
dependsOn:
|
||||
- IosPackaging_SetCommonVariables
|
||||
- IosPackaging_Build_Full
|
||||
|
||||
- script: |
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
|
||||
displayName: "Build Host Protoc"
|
||||
jobs:
|
||||
- job: j
|
||||
displayName: "Test Package.swift with full package"
|
||||
|
||||
# create and test mobile pods
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/build_and_assemble_ios_pods.py \
|
||||
--build-dir "$(Build.BinariesDirectory)/ios_framework_mobile" \
|
||||
--staging-dir "$(Build.BinariesDirectory)/staging" \
|
||||
--pod-version "${ORT_POD_VERSION}" \
|
||||
--test \
|
||||
--variant Mobile \
|
||||
--build-settings-file tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json \
|
||||
--include-ops-by-config tools/ci_build/github/android/mobile_package.required_operators.config \
|
||||
-b="--path_to_protoc_exe" -b "$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
|
||||
displayName: "[Mobile] Build iOS framework and assemble pod package files"
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/test_ios_packages.py \
|
||||
--fail_if_cocoapods_missing \
|
||||
--framework_info_file "$(Build.BinariesDirectory)/ios_framework_mobile/framework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework_mobile/framework_out" \
|
||||
--variant Mobile \
|
||||
--test_project_stage_dir "$(Build.BinariesDirectory)/app_center_test_mobile" \
|
||||
--prepare_test_project_only
|
||||
displayName: "[Mobile] Assemble test project for App Center"
|
||||
variables:
|
||||
xcodeVersion: "14.3"
|
||||
ortPodVersion: $[stageDependencies.IosPackaging_SetCommonVariables.j.outputs['SetCommonVariables.ORT_POD_VERSION']]
|
||||
skipComponentGovernanceDetection: true
|
||||
|
||||
- task: Xcode@5
|
||||
inputs:
|
||||
actions: 'build-for-testing'
|
||||
configuration: 'Debug'
|
||||
xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test_mobile/ios_package_test/ios_package_test.xcworkspace'
|
||||
sdk: 'iphoneos'
|
||||
scheme: 'ios_package_test'
|
||||
xcodeVersion: 'specifyPath'
|
||||
xcodeDeveloperDir: '/Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer'
|
||||
signingOption: 'manual'
|
||||
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
|
||||
provisioningProfileName: 'iOS Team Provisioning Profile'
|
||||
args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test_mobile/ios_package_test/DerivedData'
|
||||
workingDirectory: '$(Build.BinariesDirectory)/app_center_test_mobile/ios_package_test/'
|
||||
displayName: '[Mobile] Build iphone arm64 tests'
|
||||
timeoutInMinutes: 10
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
appcenter test run xcuitest \
|
||||
--app "AI-Frameworks/ORT-Mobile-iOS" \
|
||||
--devices $(app_center_test_devices) \
|
||||
--test-series "master" \
|
||||
--locale "en_US" \
|
||||
--build-dir $(Build.BinariesDirectory)/app_center_test_mobile/ios_package_test/DerivedData/Build/Products/Debug-iphoneos \
|
||||
--token $(app_center_api_token)
|
||||
displayName: "[Mobile] Run E2E tests on App Center"
|
||||
steps:
|
||||
- template: templates/use-xcode-version.yml
|
||||
parameters:
|
||||
xcodeVersion: ${{ variables.xcodeVersion }}
|
||||
|
||||
# create and test full pods
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/build_and_assemble_ios_pods.py \
|
||||
--build-dir "$(Build.BinariesDirectory)/ios_framework_full" \
|
||||
--staging-dir "$(Build.BinariesDirectory)/staging" \
|
||||
--pod-version "${ORT_POD_VERSION}" \
|
||||
--test \
|
||||
--variant Full \
|
||||
--build-settings-file tools/ci_build/github/apple/default_full_ios_framework_build_settings.json \
|
||||
-b="--path_to_protoc_exe" -b "$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
|
||||
displayName: "[Full] Build iOS framework and assemble pod package files"
|
||||
- download: current
|
||||
artifact: ios_packaging_artifacts_full
|
||||
displayName: "Download full build artifacts"
|
||||
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/test_ios_packages.py \
|
||||
--fail_if_cocoapods_missing \
|
||||
--framework_info_file "$(Build.BinariesDirectory)/ios_framework_full/framework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework_full/framework_out" \
|
||||
--variant Full \
|
||||
--test_project_stage_dir "$(Build.BinariesDirectory)/app_center_test_full" \
|
||||
--prepare_test_project_only
|
||||
displayName: "[Full] Assemble test project for App Center"
|
||||
- script: |
|
||||
set -e -x
|
||||
shasum -a 256 "$(Pipeline.Workspace)/ios_packaging_artifacts_full/pod-archive-onnxruntime-c-$(ortPodVersion).zip"
|
||||
displayName: "Print ORT iOS Pod checksum"
|
||||
|
||||
- task: Xcode@5
|
||||
inputs:
|
||||
actions: 'build-for-testing'
|
||||
configuration: 'Debug'
|
||||
xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test_full/ios_package_test/ios_package_test.xcworkspace'
|
||||
sdk: 'iphoneos'
|
||||
scheme: 'ios_package_test'
|
||||
signingOption: 'manual'
|
||||
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
|
||||
provisioningProfileName: 'iOS Team Provisioning Profile'
|
||||
args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/DerivedData'
|
||||
workingDirectory: $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/
|
||||
displayName: '[Full] Build iphone arm64 tests'
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
appcenter test run xcuitest \
|
||||
--app "AI-Frameworks/ORT-Mobile-iOS" \
|
||||
--devices $(app_center_test_devices) \
|
||||
--test-series "master" \
|
||||
--locale "en_US" \
|
||||
--build-dir $(Build.BinariesDirectory)/app_center_test_full/ios_package_test/DerivedData/Build/Products/Debug-iphoneos \
|
||||
--token $(app_center_api_token)
|
||||
displayName: "[Full] Run E2E tests on App Center"
|
||||
|
||||
- task: AzureCLI@2
|
||||
inputs:
|
||||
azureSubscription: 'AIInfraBuildOnnxRuntimeOSS'
|
||||
scriptType: 'bash'
|
||||
scriptLocation: 'scriptPath'
|
||||
scriptPath: 'tools/ci_build/github/apple/assemble_ios_packaging_artifacts.sh'
|
||||
arguments: >-
|
||||
"$(Build.BinariesDirectory)/staging"
|
||||
"$(Build.ArtifactStagingDirectory)"
|
||||
"$(ORT_POD_VERSION)"
|
||||
"$(ORT_SHOULD_UPLOAD_ARCHIVES)"
|
||||
displayName: "Assemble artifacts"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
ls -R "$(Build.ArtifactStagingDirectory)"
|
||||
displayName: "List staged artifacts"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
shasum -a 256 "$(Build.ArtifactStagingDirectory)/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip"
|
||||
displayName: "Print ORT iOS Pod checksum"
|
||||
|
||||
|
||||
# copy the pod archive to a path relative to Package.swift and set the env var required by Package.swift to use that.
|
||||
# xcodebuild will implicitly use Package.swift and build/run the .testTarget (tests in swift/onnxTests).
|
||||
# once that's done cleanup the copy of the pod zip file
|
||||
- script: |
|
||||
set -e -x
|
||||
cp "$(Build.ArtifactStagingDirectory)/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip" swift/
|
||||
export ORT_IOS_POD_LOCAL_PATH="swift/pod-archive-onnxruntime-c-${ORT_POD_VERSION}.zip"
|
||||
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
|
||||
rm swift/pod-archive-onnxruntime-c-*.zip
|
||||
displayName: "Test Package.swift usage"
|
||||
|
||||
- publish: "$(Build.ArtifactStagingDirectory)"
|
||||
artifact: ios_packaging_artifacts
|
||||
displayName: "Publish artifacts"
|
||||
|
||||
- template: templates/component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
# copy the pod archive to a path relative to Package.swift and set the env var required by Package.swift to use that.
|
||||
# xcodebuild will implicitly use Package.swift and build/run the .testTarget (tests in swift/onnxTests).
|
||||
# once that's done cleanup the copy of the pod zip file
|
||||
- script: |
|
||||
set -e -x
|
||||
cp "$(Pipeline.Workspace)/ios_packaging_artifacts_full/pod-archive-onnxruntime-c-$(ortPodVersion).zip" swift/
|
||||
export ORT_IOS_POD_LOCAL_PATH="swift/pod-archive-onnxruntime-c-$(ortPodVersion).zip"
|
||||
xcodebuild test -scheme onnxruntime -destination 'platform=iOS Simulator,name=iPhone 14'
|
||||
rm swift/pod-archive-onnxruntime-c-$(ortPodVersion).zip
|
||||
displayName: "Test Package.swift usage"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,162 @@
|
|||
parameters:
|
||||
- name: packageVariant
|
||||
type: string
|
||||
values:
|
||||
- Mobile
|
||||
- Full
|
||||
- Training
|
||||
|
||||
stages:
|
||||
- stage: IosPackaging_Build_${{ parameters.packageVariant }}
|
||||
dependsOn:
|
||||
- IosPackaging_SetCommonVariables
|
||||
|
||||
jobs:
|
||||
- job: j
|
||||
displayName: "Build iOS package for variant: ${{ parameters.packageVariant}}"
|
||||
|
||||
pool:
|
||||
vmImage: "macOS-13"
|
||||
|
||||
variables:
|
||||
xcodeVersion: "14.3"
|
||||
ortPodVersion: $[stageDependencies.IosPackaging_SetCommonVariables.j.outputs['SetCommonVariables.ORT_POD_VERSION']]
|
||||
|
||||
${{ if eq(parameters.packageVariant, 'Mobile') }}:
|
||||
buildSettingsFile: "tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json"
|
||||
optionalIncludeOpsByConfigOption: "--include-ops-by-config tools/ci_build/github/android/mobile_package.required_operators.config"
|
||||
cPodName: onnxruntime-mobile-c
|
||||
objcPodName: onnxruntime-mobile-objc
|
||||
|
||||
${{ if eq(parameters.packageVariant, 'Full') }}:
|
||||
buildSettingsFile: "tools/ci_build/github/apple/default_full_ios_framework_build_settings.json"
|
||||
cPodName: onnxruntime-c
|
||||
objcPodName: onnxruntime-objc
|
||||
|
||||
${{ if eq(parameters.packageVariant, 'Training') }}:
|
||||
buildSettingsFile: "tools/ci_build/github/apple/default_training_ios_framework_build_settings.json"
|
||||
cPodName: onnxruntime-training-c
|
||||
objcPodName: onnxruntime-training-objc
|
||||
|
||||
timeoutInMinutes: 120
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
if [[ -z "$(ortPodVersion)" ]]; then
|
||||
echo "ORT pod version is unspecified. Make sure that the IosPackaging_SetCommonVariables stage has run."
|
||||
exit 1
|
||||
fi
|
||||
displayName: 'Ensure version is set'
|
||||
|
||||
- task: InstallAppleCertificate@2
|
||||
inputs:
|
||||
certSecureFile: '$(ios_signing_certificate_name)'
|
||||
certPwd: '$(ios_signing_certificate_password)'
|
||||
keychain: 'temp'
|
||||
deleteCert: true
|
||||
displayName: 'Install ORT Mobile Test Signing Certificate'
|
||||
|
||||
- task: InstallAppleProvisioningProfile@1
|
||||
inputs:
|
||||
provProfileSecureFile: '$(ios_provision_profile_name)'
|
||||
removeProfile: true
|
||||
displayName: 'Install ORT Mobile Test Provisioning Profile'
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: "3.9"
|
||||
addToPath: true
|
||||
architecture: "x64"
|
||||
|
||||
- template: ../use-xcode-version.yml
|
||||
parameters:
|
||||
xcodeVersion: ${{ variables.xcodeVersion }}
|
||||
|
||||
- template: ../install-appcenter.yml
|
||||
|
||||
- script: |
|
||||
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
|
||||
displayName: "Install Python requirements"
|
||||
|
||||
- script: |
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
|
||||
displayName: "Build Host Protoc"
|
||||
|
||||
# create and test mobile pods
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/build_and_assemble_ios_pods.py \
|
||||
--build-dir "$(Build.BinariesDirectory)/ios_framework" \
|
||||
--staging-dir "$(Build.BinariesDirectory)/staging" \
|
||||
--pod-version "$(ortPodVersion)" \
|
||||
--test \
|
||||
--variant ${{ parameters.packageVariant }} \
|
||||
--build-settings-file "${{ variables.buildSettingsFile }}" \
|
||||
${{ variables.optionalIncludeOpsByConfigOption }} \
|
||||
-b="--path_to_protoc_exe=$(Build.BinariesDirectory)/protobuf_install/bin/protoc"
|
||||
displayName: "Build iOS framework and assemble pod package files"
|
||||
|
||||
- script: |
|
||||
python tools/ci_build/github/apple/test_ios_packages.py \
|
||||
--fail_if_cocoapods_missing \
|
||||
--framework_info_file "$(Build.BinariesDirectory)/ios_framework/framework_info.json" \
|
||||
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" \
|
||||
--variant ${{ parameters.packageVariant }} \
|
||||
--test_project_stage_dir "$(Build.BinariesDirectory)/app_center_test" \
|
||||
--prepare_test_project_only
|
||||
displayName: "Assemble test project for App Center"
|
||||
|
||||
- task: Xcode@5
|
||||
inputs:
|
||||
actions: 'build-for-testing'
|
||||
configuration: 'Debug'
|
||||
xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test/ios_package_test/ios_package_test.xcworkspace'
|
||||
sdk: 'iphoneos'
|
||||
scheme: 'ios_package_test'
|
||||
xcodeVersion: 'specifyPath'
|
||||
xcodeDeveloperDir: '/Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer'
|
||||
signingOption: 'manual'
|
||||
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
|
||||
provisioningProfileName: 'iOS Team Provisioning Profile'
|
||||
args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test/ios_package_test/DerivedData'
|
||||
workingDirectory: '$(Build.BinariesDirectory)/app_center_test/ios_package_test/'
|
||||
displayName: 'Build App Center iPhone arm64 tests'
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
appcenter test run xcuitest \
|
||||
--app "AI-Frameworks/ORT-Mobile-iOS" \
|
||||
--devices $(app_center_test_devices) \
|
||||
--test-series "master" \
|
||||
--locale "en_US" \
|
||||
--build-dir $(Build.BinariesDirectory)/app_center_test/ios_package_test/DerivedData/Build/Products/Debug-iphoneos \
|
||||
--token $(app_center_api_token)
|
||||
displayName: "Run E2E tests on App Center"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
|
||||
for POD_NAME in "${{ variables.cPodName}}" "${{ variables.objcPodName }}";
|
||||
do
|
||||
./tools/ci_build/github/apple/assemble_ios_packaging_artifacts.sh \
|
||||
"$(Build.BinariesDirectory)/staging" \
|
||||
"$(Build.ArtifactStagingDirectory)" \
|
||||
"${POD_NAME}" \
|
||||
"$(ortPodVersion)"
|
||||
done
|
||||
|
||||
# copy over helper script for use in release pipeline
|
||||
cp tools/ci_build/github/apple/upload_pod_archive_and_update_podspec.sh "$(Build.ArtifactStagingDirectory)"
|
||||
displayName: "Assemble artifacts"
|
||||
|
||||
- script: |
|
||||
set -e -x
|
||||
ls -R "$(Build.ArtifactStagingDirectory)"
|
||||
displayName: "List staged artifacts"
|
||||
|
||||
- publish: "$(Build.ArtifactStagingDirectory)"
|
||||
artifact: "ios_packaging_artifacts_${{ lower(parameters.packageVariant) }}"
|
||||
displayName: "Publish artifacts"
|
||||
|
||||
- template: ../component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
Loading…
Reference in a new issue