onnxruntime/tools/ci_build/github/azure-pipelines/templates/win-ci.yml
Xiang Zhang 3e7aaf8fa1 User/xianz/telemetry (#2458)
* enabme telemetry

* enable telemetry

* set enable telemetry as default

* for debugging

* remove log and set disable telemetry as default back

* delete private file while testing

* resolve comment: mainly add license header, rename macro and update docs

* rewording in privacy.md
2019-12-03 23:34:53 -08:00

220 lines
8.6 KiB
YAML

parameters:
DoDebugBuild: 'true'
DoCompliance: 'false'
BuildCommand: ''
JobName: 'Windows_CI_Dev'
DoNugetPack: 'false'
NuPackScript : ''
ArtifactName: 'drop-nuget'
DoEsrp: 'false'
DoTestCoverage: 'false'
BuildArch: 'x64'
SetVcvars: 'false'
msbuildArchitecture: 'amd64'
MsbuildArguments: '/m'
EnvSetupScript: 'setup_env.bat'
CudaVersion: ''
AgentPool: 'Win-CPU'
AgentDemands: []
OrtPackageId: Microsoft.ML.OnnxRuntime
jobs:
- job: ${{ parameters.JobName }}
timeoutInMinutes: 120
workspace:
clean: all
pool:
name: ${{ parameters.AgentPool }}
demands: ${{ parameters.AgentDemands }}
variables:
buildDirectory: '$(Build.BinariesDirectory)'
BuildCommand: ${{ parameters.BuildCommand }}
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
DotNetExe: 'dotnet.exe'
CUDA_VERSION: ${{ parameters.CudaVersion }}
steps:
- powershell: |
if($env:TELEMETRYGUID)
{
$length = $env:TELEMETRYGUID.length
$fileContent = "#define ENABLE_TELEMETRY`n#define TraceLoggingOptionMicrosoftTelemetry() \
TraceLoggingOptionGroup("+$env:TELEMETRYGUID.substring(1, $length-2)+")"
New-Item -Path "$(Build.SourcesDirectory)\include\onnxruntime\core\platform\windows\TraceLoggingConfigPrivate.h" -ItemType "file" -Value "$fileContent" -Force
}
displayName: 'Create TraceLoggingConfigPrivate.h For WinML Telemetry'
- template: set-test-data-variables-step.yml
- template: windows-build-tools-setup-steps.yml
parameters:
EnvSetupScript: ${{ parameters.EnvSetupScript }}
buildArch: ${{ parameters.msbuildArchitecture }}
setVcvars: ${{ parameters.SetVcvars }}
# Copy CUDA props files if needed
- ${{ if eq(parameters['CudaVersion'], '10.0') }}:
- task: PowerShell@1
displayName: 'Set CUDA path'
inputs:
scriptName: 'tools/ci_build/github/windows/set_cuda_path.ps1'
arguments: '-CudaMsbuildPath C:\local\cudaMsbuildIntegration-10.0.130-win10 -CudaVersion ${{ parameters.CudaVersion }}'
- task: CmdLine@1
displayName: 'Download test data and generate cmake config'
inputs:
filename: '$(Build.BinariesDirectory)\packages\python\python.exe'
arguments: '$(BuildCommand) --update --config Debug RelWithDebInfo'
workingDirectory: "$(Build.BinariesDirectory)"
# Build Debug Mode
- ${{ if eq(parameters['DoDebugBuild'], 'true') }}:
- task: DotNetCoreCLI@2
displayName: 'Restore nuget packages for debug build'
inputs:
command: restore
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
configuration: 'Debug'
arguments: '--configuration Debug -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId}}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: VSBuild@1
displayName: 'Build Debug'
inputs:
solution: '$(Build.BinariesDirectory)\Debug\onnxruntime.sln'
platform: 'x64'
configuration: 'Debug'
msbuildArgs: ${{ parameters.MsbuildArguments }}
msbuildArchitecture: 'x64'
maximumCpuCount: true
logProjectEvents: true
workingFolder: '$(Build.BinariesDirectory)\Debug'
createLogFile: true
- task: BatchScript@1
displayName: 'Test Debug'
inputs:
filename: '$(Build.BinariesDirectory)\packages\python\python.exe'
arguments: '$(BuildCommand) --test --config Debug'
workingFolder: '$(Build.BinariesDirectory)'
- task: DotNetCoreCLI@2
displayName: 'Build C# Debug'
inputs:
command: build
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
configuration: 'Debug'
arguments: '--configuration Debug -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId}}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
# Run test coverage report
- ${{ if eq(parameters['DoTestCoverage'], 'true') }}:
- template: windows-code-coverage-steps.yml
parameters:
OpenCppCoverageExe: '$(Build.BinariesDirectory)\OpenCppCoverage\OpenCppCoverage.exe'
# Build RelWithDebInfo -- this variable required to build C#
- script: |
@echo ##vso[task.setvariable variable=Configuration]RelWithDebInfo
- task: DotNetCoreCLI@2
displayName: 'Restore nuget packages for RelWithDebInfo build'
inputs:
command: restore
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
configuration: 'RelWithDebInfo'
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId}}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: VSBuild@1
displayName: 'Build RelWithDebInfo'
inputs:
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
platform: 'x64'
configuration: 'RelWithDebInfo'
msbuildArgs: ${{ parameters.MsbuildArguments }}
msbuildArchitecture: 'x64'
maximumCpuCount: true
logProjectEvents: true
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
createLogFile: true
- task: BatchScript@1
displayName: 'Test RelWithDebInfo'
inputs:
filename: '$(Build.BinariesDirectory)\packages\python\python.exe'
arguments: '$(BuildCommand) --test --config RelWithDebInfo'
workingFolder: "$(Build.BinariesDirectory)"
- task: DotNetCoreCLI@2
displayName: 'Build C# RelWithDebInfo'
inputs:
command: build
projects: '$(Build.SourcesDirectory)\csharp\OnnxRuntime.CSharp.sln'
configuration: 'RelWithDebInfo'
arguments: '--configuration RelWithDebInfo -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId}}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: DotNetCoreCLI@2
displayName: 'Test C# RelWithDebInfo'
inputs:
command: test
projects: '$(Build.SourcesDirectory)\csharp\test\Microsoft.ML.OnnxRuntime.Tests\Microsoft.ML.OnnxRuntime.Tests.csproj'
configuration: 'RelWithDebInfo'
arguments: '--no-build --configuration RelWithDebInfo -p:Platform="Any CPU" -p:OrtPackageId=${{ parameters.OrtPackageId}}'
workingDirectory: '$(Build.SourcesDirectory)\csharp'
- task: PublishTestResults@2
displayName: 'Publish unit test results'
inputs:
testResultsFiles: '**\*.results.xml'
searchFolder: '$(Build.BinariesDirectory)'
testRunTitle: 'Unit Test Run'
condition: succeededOrFailed()
# Nuget packaging if needed
- ${{ if eq(parameters['DoNugetPack'], 'true') }}:
- task: BatchScript@1
displayName: 'Setup VS2017 env vars'
inputs:
filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
arguments: ${{ parameters.msbuildArchitecture }}
modifyEnvironment: true
# Esrp signing
- template: esrp_dll.yml
parameters:
FolderPath: '$(Build.BinariesDirectory)\RelWithDebInfo'
DisplayName: 'ESRP - Sign Native dlls'
DoEsrp: ${{ parameters.DoEsrp }}
- template: esrp_dll.yml
parameters:
FolderPath: '$(Build.SourcesDirectory)\csharp\src\Microsoft.ML.OnnxRuntime\bin\RelWithDebInfo'
DisplayName: 'ESRP - Sign C# dlls'
DoEsrp: ${{ parameters.DoEsrp }}
- script: |
${{ parameters.NuPackScript }}
workingDirectory: '$(Build.SourcesDirectory)\csharp'
displayName: 'Create NuGet Package'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact: drop-nuget'
inputs:
artifactName: ${{ parameters.ArtifactName }}
targetPath: '$(Build.ArtifactStagingDirectory)'
# Remove CUDA props files after build
- ${{ if eq(parameters['CudaVersion'], '10.0') }}:
- task: PowerShell@1
displayName: 'Clean up CUDA props files'
inputs:
scriptName: 'tools/ci_build/github/windows/clean_up_cuda_prop_files.ps1'
arguments: '-CudaVersion ${{ parameters.CudaVersion }}'
# Compliance tasks require logs from Debug Build
- ${{ if eq(parameters['DoCompliance'], 'true') }}:
- template: compliance.yml
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: 'Component Detection'
condition: succeeded()
- template: clean-agent-build-directory-step.yml