mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-06 04:28:32 +00:00
Add script to get iOS simulator device info so we don't need to use hardcoded specifiers which may or may not refer to a valid simulator device. Add use-xcode-version step to a packaging pipeline so it uses a consistent version of Xcode.
120 lines
3.7 KiB
YAML
120 lines
3.7 KiB
YAML
parameters:
|
|
- name: buildType
|
|
displayName: |-
|
|
Type of build.
|
|
"release": A release build to be published for an official ONNX Runtime release.
|
|
"normal": A normal build. This can be published as a pre-release build for validation prior to release.
|
|
type: string
|
|
values:
|
|
- release
|
|
- normal
|
|
default: normal
|
|
|
|
name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format
|
|
|
|
stages:
|
|
- stage: IosPackaging_SetCommonVariables
|
|
dependsOn: []
|
|
|
|
variables:
|
|
skipComponentGovernanceDetection: true
|
|
|
|
jobs:
|
|
- job: j
|
|
displayName: "Set common variables"
|
|
|
|
pool:
|
|
vmImage: "macOS-13"
|
|
|
|
timeoutInMinutes: 5
|
|
|
|
steps:
|
|
- bash: |
|
|
set -e
|
|
|
|
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}"
|
|
|
|
case "${BUILD_TYPE}" in
|
|
("release")
|
|
VERSION="${BASE_VERSION}" ;;
|
|
("normal")
|
|
VERSION="${DEV_VERSION}" ;;
|
|
(*)
|
|
echo "Invalid build type: ${BUILD_TYPE}"; exit 1 ;;
|
|
esac
|
|
|
|
# Do not output ##vso[] commands with `set -x` or they may be parsed again and include a trailing quote.
|
|
set +x
|
|
|
|
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}"
|
|
}
|
|
|
|
set_var "ORT_POD_VERSION" "${VERSION}"
|
|
displayName: "Set common variables"
|
|
name: SetCommonVariables
|
|
|
|
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
|
parameters:
|
|
packageVariant: Mobile
|
|
|
|
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
|
parameters:
|
|
packageVariant: Full
|
|
|
|
- template: templates/stages/mac-ios-packaging-build-stage.yml
|
|
parameters:
|
|
packageVariant: Training
|
|
|
|
- stage: IosPackaging_TestPackageSwift_Full
|
|
dependsOn:
|
|
- IosPackaging_SetCommonVariables
|
|
- IosPackaging_Build_Full
|
|
|
|
jobs:
|
|
- job: j
|
|
displayName: "Test Package.swift with full package"
|
|
|
|
pool:
|
|
vmImage: "macOS-13"
|
|
|
|
variables:
|
|
xcodeVersion: "14.3"
|
|
ortPodVersion: $[stageDependencies.IosPackaging_SetCommonVariables.j.outputs['SetCommonVariables.ORT_POD_VERSION']]
|
|
skipComponentGovernanceDetection: true
|
|
|
|
timeoutInMinutes: 10
|
|
|
|
steps:
|
|
- template: templates/use-xcode-version.yml
|
|
parameters:
|
|
xcodeVersion: ${{ variables.xcodeVersion }}
|
|
|
|
- download: current
|
|
artifact: ios_packaging_artifacts_full
|
|
displayName: "Download full build artifacts"
|
|
|
|
- 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"
|
|
|
|
# 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
|
|
|
|
SIMULATOR_DEVICE_ID=$(set -o pipefail; python3 tools/ci_build/github/apple/get_simulator_device_info.py | jq --raw-output '.device_udid')
|
|
|
|
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,id=${SIMULATOR_DEVICE_ID}'
|
|
rm swift/pod-archive-onnxruntime-c-$(ortPodVersion).zip
|
|
displayName: "Test Package.swift usage"
|