forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows CI build steps template (microsoft#17263)
### Description 1. New windows ci build steps template. 2. Remove useless variables. ### Motivation and Context 1. Make it easier to apply build cache to all windows CIs. 2. Other team's devs only need to take care of build options ###Comparision Before: https://github.com/microsoft/onnxruntime/blob/9f21f694cf939a960f5b516ba5ff9675fc3ec6d1/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml#L19-L82 After: https://github.com/microsoft/onnxruntime/blob/b4c1f2261bbc282139e46c0d68520f65940883f3/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml#L35-L54
- Loading branch information
Showing
4 changed files
with
124 additions
and
77 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
tools/ci_build/github/azure-pipelines/templates/jobs/win-ci-build-steps.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
parameters: | ||
- name: WithCache | ||
displayName: Build with Cache | ||
type: boolean | ||
default: false | ||
|
||
- name: Today | ||
type: string | ||
default: "" | ||
|
||
- name: CacheDir | ||
type: string | ||
default: "$(Agent.TempDirectory)/ort_ccache" | ||
|
||
- name: AdditionalKey | ||
type: string | ||
default: "" | ||
|
||
# it is used to pass additional arguments to build.py | ||
- name: BuildPyArguments | ||
type: string | ||
default: "" | ||
|
||
# it is used to pass msbuild arguments to VSBuild@1 | ||
- name: MsbuildArguments | ||
type: string | ||
default: "" | ||
|
||
# it is used to pass platform arguments to VSBuild@1 | ||
- name: Platform | ||
type: string | ||
default: "x64" | ||
|
||
# it is used to pass configuration arguments to VSBuild@1 | ||
- name: BuildConfig | ||
type: string | ||
|
||
# it is used to pass msbuildArchitecture arguments to VSBuild@1 | ||
- name: BuildArch | ||
type: string | ||
|
||
- name: CacheArg | ||
type: string | ||
default: '/p:CLToolExe=cl.exe /p:CLToolPath=C:\ProgramData\chocolatey\bin /p:TrackFileAccess=false /p:UseMultiToolTask=true /p:DebugInformationFormat=OldStyle' | ||
|
||
steps: | ||
- ${{ if eq(parameters.WithCache, true) }}: | ||
- task: Cache@2 | ||
inputs: | ||
${{if eq(variables['Build.SourceBranchName'], 'merge')}}: | ||
key: ' "$(TODAY)" | ${{parameters.AdditionalKey}} | merge ' | ||
${{else}}: | ||
key: '"$(TODAY)" | onnxruntime | ${{parameters.AdditionalKey}} | $(Build.SourceVersion) ' | ||
path: ${{parameters.CacheDir}} | ||
restoreKeys: | | ||
"$(TODAY)" | onnxruntime | ${{parameters.AdditionalKey}} | ||
displayName: Cache Task | ||
|
||
- task: PythonScript@0 | ||
displayName: 'Generate cmake config' | ||
inputs: | ||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' | ||
${{ if eq(parameters.WithCache, true) }}: | ||
arguments: '${{parameters.BuildPyArguments}} --use_cache' | ||
${{ else }}: | ||
arguments: '${{parameters.BuildPyArguments}}' | ||
workingDirectory: '$(Build.BinariesDirectory)' | ||
|
||
- task: VSBuild@1 | ||
displayName: 'Build' | ||
inputs: | ||
solution: '$(Build.BinariesDirectory)\${{parameters.BuildConfig}}\onnxruntime.sln' | ||
platform: ${{parameters.Platform}} | ||
configuration: ${{parameters.BuildConfig}} | ||
${{ if eq(parameters.WithCache, true) }}: | ||
msbuildArgs: '${{parameters.MsbuildArguments}} ${{parameters.CacheArg}}' | ||
${{ else }}: | ||
arguments: '${{parameters.CMakeArguments}}' | ||
msbuildArchitecture: ${{parameters.BuildArch}} | ||
maximumCpuCount: true | ||
logProjectEvents: false | ||
workingFolder: '$(Build.BinariesDirectory)\${{parameters.BuildConfig}}' | ||
createLogFile: true | ||
env: | ||
CCACHE_DIR: ${{parameters.CacheDir}} | ||
|
||
- ${{ if eq(parameters.WithCache, true) }}: | ||
- powershell: | | ||
ccache -sv | ||
ccache -z | ||
displayName: cache stat | ||
env: | ||
CCACHE_DIR: ${{parameters.CacheDir}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters