onnxruntime/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml

121 lines
4.4 KiB
YAML

parameters:
- name: IsReleaseBuild
displayName: Is this a release build? Set this parameter to true if you are doing an Onnx Runtime release.
type: boolean
default: false
- name: ShouldUploadArchives
displayName: Should the package archives be uploaded? The archives will always be uploaded for a release build.
type: boolean
default: false
name: "$(Date:yyyyMMdd)$(Rev:rrr)" # build number format
jobs:
- job: IosPackaging
displayName: "iOS Packaging"
pool:
vmImage: "macOS-10.15"
timeoutInMinutes: 90
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.9"
addToPath: true
architecture: "x64"
- script: |
pip install -r tools/ci_build/github/apple/ios_packaging.requirements.txt
displayName: "Install Python requirements"
- bash: |
BASE_VERSION=$(cat VERSION_NUMBER)
IS_RELEASE_BUILD=$(echo "${{ parameters.IsReleaseBuild }}" | tr "[:upper:]" "[:lower:]")
SHOULD_UPLOAD_ARCHIVES=$(echo "${{ parameters.ShouldUploadArchives }}" | tr "[:upper:]" "[:lower:]")
if [[ "${IS_RELEASE_BUILD}" == "true" ]]; then
VERSION=${BASE_VERSION}
# always upload archives for a release build
SHOULD_UPLOAD_ARCHIVES="true"
else
VERSION="${BASE_VERSION}-dev+$(Build.BuildNumber)"
fi
set_var() {
local VAR_NAME=${1:?}
local VAR_VALUE=${2:?}
echo "##vso[task.setvariable variable=${VAR_NAME}]${VAR_VALUE}"
echo "${VAR_NAME}: ${VAR_VALUE}"
}
set_var "ORT_POD_VERSION" "${VERSION}"
set_var "ORT_SHOULD_UPLOAD_ARCHIVES" "${SHOULD_UPLOAD_ARCHIVES}"
displayName: "Set variables"
- script: |
python tools/ci_build/github/apple/build_ios_framework.py \
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
--include_ops_by_config tools/ci_build/github/android/mobile_package.required_operators.config \
tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json
displayName: "Build iOS framework"
- 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"
displayName: "Test iOS framework"
- script: |
python tools/ci_build/github/apple/c/assemble_c_pod_package.py \
--staging-dir "$(Build.BinariesDirectory)/staging/onnxruntime-mobile-c" \
--pod-version ${ORT_POD_VERSION} \
--framework-info-file "$(Build.BinariesDirectory)/ios_framework/framework_info.json" \
--framework-dir "$(Build.BinariesDirectory)/ios_framework/framework_out/onnxruntime.framework"
displayName: "Assemble onnxruntime-mobile-c pod files"
- script: |
pod lib lint --verbose
workingDirectory: "$(Build.BinariesDirectory)/staging/onnxruntime-mobile-c"
displayName: "Check onnxruntime-mobile-c pod"
- script: |
python tools/ci_build/github/apple/objectivec/assemble_objc_pod_package.py \
--staging-dir "$(Build.BinariesDirectory)/staging/onnxruntime-mobile-objc" \
--pod-version ${ORT_POD_VERSION} \
--framework-info-file "$(Build.BinariesDirectory)/ios_framework/framework_info.json"
displayName: "Assemble onnxruntime-mobile-objc pod files"
- script: |
pod lib lint --verbose \
--include-podspecs="$(Build.BinariesDirectory)/staging/onnxruntime-mobile-c/onnxruntime-mobile-c.podspec"
workingDirectory: "$(Build.BinariesDirectory)/staging/onnxruntime-mobile-objc"
displayName: "Check onnxruntime-mobile-objc pod"
- bash: |
set -e
gem install jazzy
jazzy --config objectivec/docs/jazzy_config.yaml \
--output "$(Build.BinariesDirectory)/staging/objc_api_docs" \
--module-version ${ORT_POD_VERSION}
displayName: "Generate Objective-C API docs"
- 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"
- publish: "$(Build.ArtifactStagingDirectory)"
artifact: ios_packaging_artifacts
displayName: "Publish artifacts"