onnxruntime/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml
Patrice Vignola 3e4a471f36
Cherry-pick 7 changes into 1.14.1 (#14762)
This cherry picks the following 7 changes into 1.14.1:


1b7f65437e

b539c364ee

12d91173c4

ff3aed8540

3d79b1f06e

c0d2472ede

e9ec4c098b

---------

Signed-off-by: Cliff Woolley <jwoolley@nvidia.com>
Co-authored-by: Sheil Kumar <smk2007@gmail.com>
Co-authored-by: Ye Wang <52801275+wangyems@users.noreply.github.com>
Co-authored-by: Ubuntu <wy@v100-2.0cdb2e52twzevn1i4fi45bylyg.jx.internal.cloudapp.net>
Co-authored-by: Lei Zhang <zhang.huanning@hotmail.com>
Co-authored-by: Misha Chornyi <99709299+mc-nv@users.noreply.github.com>
Co-authored-by: Cliff Woolley <jwoolley@nvidia.com>
Co-authored-by: cao lei <jslhcl@gmail.com>
Co-authored-by: Lei Cao <leca@microsoft.com>
Co-authored-by: Tianlei Wu <tlwu@microsoft.com>
Co-authored-by: Vincent Wang <wangwchpku@outlook.com>
Co-authored-by: Jian Chen <cjian@microsoft.com>
2023-02-23 11:00:29 -08:00

133 lines
4.2 KiB
YAML

parameters:
- name: AdditionalBuildFlags
displayName: Additional build flags for build.py
type: string
default: ''
# Must be 1 or 0
- name: AllowReleasedOpsetOnly
displayName: Whether unreleased onnx opsets are allowed
type: number
default: 1
values:
- 1
- 0
- name: BuildForAllArchs
displayName: Build for all CPU ARCHs
type: boolean
- name: WithCache
displayName: Build with Cache
type: boolean
default: false
jobs:
- job: MacOS_C_API_Packaging_CPU_x64
workspace:
clean: all
variables:
MACOSX_DEPLOYMENT_TARGET: '10.14'
ALLOW_RELEASED_ONNX_OPSET_ONLY: ${{ parameters.AllowReleasedOpsetOnly }}
CCACHE_DIR: $(Pipeline.Workspace)/ccache
TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)]
pool:
vmImage: 'macOS-11'
timeoutInMinutes: 300
steps:
- checkout: self
clean: true
submodules: none
- task: UsePythonVersion@0
# Use python 3.8 to avoid build some of the required packages
displayName: Use Python 3.8
inputs:
versionSpec: 3.8
- task: NodeTool@0
inputs:
versionSpec: '16.x'
- template: set-version-number-variables-step.yml
- template: set-up-gradle-wrapper-step.yml
- script: |
brew install ccache
echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec"
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc
condition: eq(${{ parameters.WITHCACHE }}, true)
- task: Cache@2
inputs:
key: ' "$(TODAY)" | ccache | protocol | "$(Build.SourceVersion)" '
path: $(CCACHE_DIR)
restoreKeys: |
"$(TODAY)" | ccache | protocol
displayName: ccache protocol
condition: eq(${{ parameters.WITHCACHE }}, true)
- script: |
set -e -x
pushd .
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -d $(Build.SourcesDirectory)/cmake/deps.txt -p $(Build.BinariesDirectory)/installed
popd
export PATH=$(Build.BinariesDirectory)/installed/bin:$PATH
export ONNX_ML=1
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
displayName: 'Install dependencies'
- script: |
ccache -s
ccache -z
displayName: Show Cache stats and Clear protolbuf stats.
condition: eq(${{ parameters.WITHCACHE }}, true)
- task: Cache@2
inputs:
key: ' "$(TODAY)" | ccache | onnxruntime | "$(Build.SourceVersion)" '
path: $(CCACHE_DIR)
restoreKeys: |
"$(TODAY)" | ccache | onnxruntime
displayName: ccache MacOS Build
condition: eq(${{ parameters.WITHCACHE }}, true)
- ${{ if eq(parameters.BuildForAllArchs, true) }}:
- template: mac-packaging.yml
parameters :
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
MacosArch: arm64
BuildJava: true
BuildNodejs: true
- ${{ if eq(parameters.BuildForAllArchs, true) }}:
- template: mac-packaging.yml
parameters :
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
MacosArch: universal2
BuildJava: false
BuildNodejs: false
- template: mac-packaging.yml
parameters :
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml
MacosArch: x86_64
BuildJava: true
BuildNodejs: true
- script: |
ccache -s
ccache -z
displayName: Show Cache stats
condition: eq(${{ parameters.WITHCACHE }}, true)
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'onnxruntime-osx'
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'