Skip to content

Commit a46a28b

Browse files
author
Changming Sun
authored
Windows CI changes(#2650)
1 parent 18bdde3 commit a46a28b

15 files changed

+546
-120
lines changed

cmake/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ if(NOT WIN32)
100100
message(WARNING "Instrument is only supported on Windows now")
101101
set(onnxruntime_ENABLE_INSTRUMENT OFF)
102102
endif()
103+
else()
104+
check_cxx_compiler_flag(/d2FH4- HAS_D2FH4)
105+
if (HAS_D2FH4)
106+
message("Enabling /d2FH4-")
107+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /d2FH4-")
108+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2FH4-")
109+
endif()
103110
endif()
104111

105112
if(onnxruntime_USE_OPENMP)

tools/ci_build/github/azure-pipelines/azure-pipelines-py-packaging.yml

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ jobs:
122122
- template: templates/clean-agent-build-directory-step.yml
123123

124124
- job: Windows_py_Wheels
125-
workspace:
126-
clean: all
127-
pool: Win-CPU
128-
timeoutInMinutes: 120
125+
pool: 'Win-CPU-2019'
129126
strategy:
130127
matrix:
131128
Python35:
@@ -135,38 +132,68 @@ jobs:
135132
Python37:
136133
python.version: '3.7'
137134
variables:
138-
buildDirectory: '$(Build.SourcesDirectory)\build'
139-
steps:
140-
- task: CondaEnvironment@1
141-
inputs:
142-
createCustomEnvironment: true
143-
environmentName: 'py$(python.version)'
144-
packageSpecs: 'python=$(python.version)'
145-
cleanEnvironment: true
135+
OrtPackageId: 'Microsoft.ML.OnnxRuntime'
136+
MsbuildArguments: '-maxcpucount'
137+
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
138+
EnvSetupScript: setup_env.bat
139+
buildArch: x64
140+
setVcvars: true
141+
BuildConfig: 'Release'
142+
timeoutInMinutes: 60
143+
workspace:
144+
clean: all
145+
steps:
146+
- task: UsePythonVersion@0
147+
inputs:
148+
versionSpec: $(python.version)
149+
addToPath: true
150+
architecture: 'x64'
151+
- template: templates/set-test-data-variables-step.yml
146152

147-
- task: BatchScript@1
148-
displayName: 'Run build script'
149-
inputs:
150-
filename: 'build.bat'
151-
arguments: ' --build_dir $(buildDirectory) --config Release --use_openmp --build_wheel'
152-
workingFolder: "$(Build.SourcesDirectory)"
153+
- task: BatchScript@1
154+
displayName: 'setup env'
155+
inputs:
156+
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\$(EnvSetupScript)'
157+
modifyEnvironment: true
158+
workingFolder: '$(Build.BinariesDirectory)'
153159

154-
- task: CopyFiles@2
155-
displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)'
156-
inputs:
157-
SourceFolder: '$(buildDirectory)'
158-
Contents: '**\dist\*.whl'
159-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
160+
- script: |
161+
python -m pip install -q pyopenssl setuptools wheel numpy
162+
163+
workingDirectory: '$(Build.BinariesDirectory)'
164+
displayName: 'Install python modules'
160165
161-
- task: PublishBuildArtifacts@1
162-
displayName: 'Publish Artifact: ONNXRuntime python wheel'
163-
inputs:
164-
ArtifactName: onnxruntime
166+
- task: PythonScript@0
167+
displayName: 'Download test data'
168+
inputs:
169+
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\github\download_test_data.py'
170+
arguments: --test_data_url $(TestDataUrl) --build_dir $(Build.BinariesDirectory)
171+
workingDirectory: $(Build.BinariesDirectory)
165172

166-
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
167-
displayName: 'Component Detection'
173+
- task: PythonScript@0
174+
displayName: 'BUILD'
175+
inputs:
176+
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
177+
arguments: '--config $(BuildConfig) --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_generator "Visual Studio 16 2019" --build_wheel --use_automl --enable_onnx_tests --parallel'
178+
workingDirectory: '$(Build.BinariesDirectory)'
179+
180+
- task: CopyFiles@2
181+
displayName: 'Copy Python Wheel to: $(Build.ArtifactStagingDirectory)'
182+
inputs:
183+
SourceFolder: '$(Build.BinariesDirectory)\$(BuildConfig)'
184+
Contents: '**\dist\*.whl'
185+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
168186

169-
- template: templates/clean-agent-build-directory-step.yml
187+
- task: PublishBuildArtifacts@1
188+
displayName: 'Publish Artifact: ONNXRuntime python wheel'
189+
inputs:
190+
ArtifactName: onnxruntime
191+
192+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
193+
displayName: 'Component Detection'
194+
condition: succeeded()
195+
196+
- template: templates/clean-agent-build-directory-step.yml
170197

171198
- job: Windows_py_GPU_Wheels
172199
workspace:
@@ -185,13 +212,11 @@ jobs:
185212
Python37:
186213
python.version: '3.7'
187214
steps:
188-
- task: CondaEnvironment@1
189-
inputs:
190-
createCustomEnvironment: true
191-
environmentName: 'py$(python.version)'
192-
packageSpecs: 'python=$(python.version)'
193-
cleanEnvironment: true
194-
215+
- task: UsePythonVersion@0
216+
inputs:
217+
versionSpec: $(python.version)
218+
addToPath: true
219+
architecture: 'x64'
195220
- task: BatchScript@1
196221
displayName: 'Setup VS2017 env vars'
197222
inputs:

tools/ci_build/github/azure-pipelines/nuget/cpu-esrp-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ schedules:
1515
jobs:
1616
- template: templates/cpu.yml
1717
parameters:
18-
AgentPool : $(AgentPoolWin)
18+
AgentPool : 'Win-CPU-2019'
1919
DoEsrp: 'true'
2020
DoCompliance: 'true'
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Defined as pipeline variables
22
# variables:
3-
# AgentPoolWin : 'Win-CPU'
43
# AgentPoolLinux : 'Linux-CPU'
54
# AgentPoolMacOS : 'macOS-10.13'
65

76
jobs:
87
- template: templates/cpu.yml
98
parameters:
10-
AgentPool : $(AgentPoolWin)
9+
AgentPool : 'Win-CPU-2019'
1110
DoEsrp: 'false'

tools/ci_build/github/azure-pipelines/nuget/templates/cpu.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Defined as pipeline variables
22
# variables:
3-
# AgentPoolWin : 'Win-CPU'
43
# AgentPoolLinux : 'Linux-CPU'
54
# AgentPoolMacOS : 'macOS-10.13'
65

@@ -9,11 +8,11 @@ parameters:
98
DoCompliance: 'false'
109

1110
jobs:
12-
- template: ../../templates/win-ci.yml
11+
- template: ../../templates/win-ci-2019.yml
1312
parameters:
14-
AgentPool : $(AgentPoolWin)
13+
AgentPool : 'Win-CPU-2019'
1514
JobName: 'Windows_CI_Dev'
16-
BuildCommand: '$(Build.SourcesDirectory)\tools\ci_build\build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_openmp --build_shared_lib --build_csharp --enable_onnx_tests --use_telemetry'
15+
BuildCommand: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_openmp --build_shared_lib --enable_onnx_tests --use_telemetry --cmake_generator "Visual Studio 16 2019"'
1716
DoDebugBuild: 'false'
1817
DoNugetPack : 'true'
1918
DoCompliance: ${{ parameters.DoCompliance }}
@@ -24,11 +23,11 @@ jobs:
2423
mkdir $(Build.ArtifactStagingDirectory)\testdata
2524
copy $(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo\custom_op_library.* $(Build.ArtifactStagingDirectory)\testdata
2625
27-
- template: ../../templates/win-x86-ci.yml
26+
- template: ../../templates/win-x86-ci-2019.yml
2827
parameters:
29-
AgentPool : $(AgentPoolWin)
28+
AgentPool : 'Win-CPU-2019'
3029
JobName: 'Windows_CI_Dev_x86'
31-
BuildCommand: '$(Build.SourcesDirectory)\tools\ci_build\build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --cmake_path $(Build.BinariesDirectory)\cmake\bin\cmake.exe --ctest_path $(Build.BinariesDirectory)\cmake\bin\ctest.exe --use_openmp --build_shared_lib --build_csharp --enable_onnx_tests --x86 --use_telemetry'
30+
BuildCommand: '--build_dir $(Build.BinariesDirectory) --skip_submodule_sync --use_openmp --build_shared_lib --enable_onnx_tests --x86 --use_telemetry --cmake_generator "Visual Studio 16 2019"'
3231
DoDebugBuild: 'false'
3332
DoNugetPack : 'true'
3433
DoCompliance: 'false'
@@ -103,7 +102,7 @@ jobs:
103102
- job: NuGet_Packaging
104103
workspace:
105104
clean: all
106-
pool: $(AgentPoolWin)
105+
pool: 'Win-CPU-2019'
107106
dependsOn:
108107
- Windows_CI_Dev
109108
- Windows_CI_Dev_x86
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
steps:
2-
- task: SDLNativeRules@2
3-
displayName: 'Run the PREfast SDL Native Rules for MSBuild'
4-
inputs:
5-
userProvideBuildInfo: 'auto'
6-
continueOnError: true
7-
82
- task: CredScan@2
93
displayName: 'Run CredScan'
104
inputs:
@@ -17,7 +11,19 @@ steps:
1711
arguments: 'analyze $(Build.BinariesDirectory)\RelWithDebInfo\*.dll --recurse --verbose'
1812
continueOnError: true
1913

20-
- task: PublishSecurityAnalysisLogs@2
14+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-prefast.SDLNativeRules@2
15+
displayName: 'Run the PREfast SDL Native Rules for MSBuild'
16+
continueOnError: true
17+
18+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-report.SdtReport@1
19+
displayName: 'Create Security Analysis Report'
20+
inputs:
21+
BinSkim: true
22+
BinSkimBreakOn: WarningAbove
23+
CredScan: true
24+
SDLNativeRules: true
25+
26+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
2127
displayName: 'Publish Security Analysis Logs'
2228
continueOnError: true
2329

0 commit comments

Comments
 (0)