mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-22 19:23:30 +00:00
### Description ### Motivation and Context Make the compilation cache steps easy to use and maintain Reduce cache storage.
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
# It's used for compilation with cache in Mac Host.
|
|
|
|
parameters:
|
|
- name: WithCache
|
|
displayName: Build with Cache
|
|
type: boolean
|
|
default: false
|
|
|
|
- name: BuildStep
|
|
type: stepList
|
|
|
|
# if WithCahe is false, the following parameters are not used.
|
|
- name: Today
|
|
type: string
|
|
default: ""
|
|
|
|
- name: AdditionalKey
|
|
type: string
|
|
default: ""
|
|
|
|
- name: CacheDir
|
|
type: string
|
|
default: ""
|
|
|
|
- name: ChangeEveryCommit
|
|
type: boolean
|
|
default: true
|
|
|
|
steps:
|
|
- script: |
|
|
which ccache || brew install ccache
|
|
echo "##vso[task.prependpath]/usr/local/opt/ccache/libexec"
|
|
mkdir -p "${{ parameters.CacheDir }}"
|
|
displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc
|
|
condition: eq(${{ parameters.WithCache }}, true)
|
|
|
|
- task: Cache@2
|
|
inputs:
|
|
${{ if eq(parameters.ChangeEveryCommit, true) }}:
|
|
# If it's a merge build, the run will read the cache generated by main build.
|
|
${{if eq(variables['Build.SourceBranchName'], 'merge')}}:
|
|
key: ' "$(TODAY)" | ccache | merge '
|
|
${{else}}:
|
|
key: ' "${{parameters.Today}}" | ${{parameters.AdditionalKey}} | "$(Build.SourceVersion)" '
|
|
restoreKeys: |
|
|
"${{parameters.Today}}" | ${{parameters.AdditionalKey}}
|
|
${{ else }}:
|
|
key: ' ${{parameters.AdditionalKey}} '
|
|
restoreKeys: |
|
|
${{parameters.AdditionalKey}}
|
|
path: ${{ parameters.CacheDir }}
|
|
displayName: ccache task
|
|
condition: eq(${{ parameters.WithCache }}, true)
|
|
|
|
- ${{ parameters.BuildStep }}
|
|
|
|
- ${{ if eq(parameters.WithCache, true) }}:
|
|
- template: check-cache-stats.yml
|
|
parameters:
|
|
CacheDir: ${{ parameters.CacheDir }}
|