onnxruntime/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml
Jian Chen b4fe98ac2e
Update to MacOS-12 (#14924)
### Description
<!-- Describe your changes. -->


Update to MacOS-12
### Motivation and Context

Fixed
[AB#13233](https://aiinfra.visualstudio.com/6a833879-cd9b-44a4-a9de-adc2d818f13c/_workitems/edit/13233)
2023-03-09 10:18:14 -08:00

131 lines
4.1 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-12'
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
- 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_13.1.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'