From 1e7849c2c8a71d2d1a771bae05fce1ab6e573360 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Thu, 16 Mar 2023 21:43:18 +0800 Subject: [PATCH] Add compilation cache in iOS pipeline (#15070) ### Description ### Motivation and Context iOS pipeline duration could be reduced to 20 more minutes from 90 more minutes https://dev.azure.com/onnxruntime/onnxruntime/_build/results?buildId=921577&view=results ### Ref https://ccache.dev/manual/4.8.html#_c_modules --- .../azure-pipelines/mac-ios-ci-pipeline.yml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml index fe0cfdb686..d885ef0ed2 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml @@ -4,13 +4,41 @@ jobs: vmImage: 'macOS-12' variables: MACOSX_DEPLOYMENT_TARGET: '10.14' + CCACHE_DIR: $(Pipeline.Workspace)/ccache + TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)] timeoutInMinutes: 150 steps: + - script: | + brew install ccache + echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec" + displayName: Install ccache + + - task: Cache@2 + inputs: + key: ' "$(TODAY)" | ccache | protocol | "$(Build.SourceVersion)" ' + path: $(CCACHE_DIR) + restoreKeys: | + "$(TODAY)" | ccache | protocol + displayName: ccache protocol + - 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: Install protobuf + - script: | + ccache -s + ccache -z + displayName: Show Cache stats and Clear protolbuf stats + + - task: Cache@2 + inputs: + key: ' "$(TODAY)" | ccache | onnxruntime | "$(Build.SourceVersion)" ' + path: $(CCACHE_DIR) + restoreKeys: | + "$(TODAY)" | ccache | onnxruntime + displayName: ccache MacOS Build + - script: | sudo xcode-select --switch /Applications/Xcode_13.1.app/Contents/Developer python3 $(Build.SourcesDirectory)/tools/ci_build/build.py \ @@ -29,3 +57,14 @@ jobs: --path_to_protoc_exe $(Build.BinariesDirectory)/protobuf_install/bin/protoc \ --parallel displayName: (CPU, CoreML, XNNPACK EPs) Build onnxruntime for iOS x86_64 and run tests using simulator + env: + CC: clang + CXX: clang++ + CCACHE_CPP2: 1 + CCACHE_DEPEND: 1 + CCACHE_SLOPPINESS: modules + + - script: | + ccache -s + ccache -z + displayName: Show Cache stats