4
4
5
5
name : $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
6
6
7
- variables :
8
- MyRunNumber : $[counter('MyRunNumber', 52201)]
9
-
7
+ parameters :
10
8
# Set this to 'true' to build the libtorch-* packages as part of main branch CI and
11
9
# push them to the artifacts feed of the Azure CI project
12
- BuildLibTorchPackages : true
13
- PushPackagesToFeed : false
10
+ - name : BuildLibTorchPackages
11
+ type : boolean
12
+ default : false
13
+ - name : PushPackagesToFeed
14
+ type : boolean
15
+ default : false
16
+
17
+ variables :
18
+ MyRunNumber : $[counter('MyRunNumber', 52201)]
19
+ LinuxPrepScript : |
20
+ ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
21
+ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D
22
+ sudo apt-get -y update
23
+ sudo apt-get -y install cmake clang git libunwind8 curl libomp-dev libomp5 wget
24
+ wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
25
+ sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb
26
+ sudo apt-get update; sudo apt-get install -y apt-transport-https && sudo apt-get update
27
+ ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
14
28
15
29
resources :
16
30
containers :
29
43
# This reports the GLIB_ and GLIBCXX_ dependencies on the system which ends up getting baked into
30
44
# the generated libTorchSharp.so (and partly determines which Linux systems that binary will
31
45
# be usable on), then installs clang-7.0 (LibTorch likes this for building C++ 14), then installs .NET 6.0
32
- prepScript :
33
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX) &&
34
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D &&
35
- sudo apt-get -y update &&
36
- sudo apt-get -y install cmake clang git libunwind8 curl libomp-dev libomp5 &&
37
- wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb &&
38
- sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb &&
39
- sudo apt-get update; sudo apt-get install -y apt-transport-https && sudo apt-get update &&
40
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
46
+ prepScript : ${{ variables.LinuxPrepScript }}
41
47
buildScript : dotnet build /p:SkipCuda=true -c
42
48
testScript : dotnet test /p:SkipCuda=true --blame test/TorchSharpTest/TorchSharpTest.csproj -c
43
49
pool :
88
94
# ###############################################################################
89
95
- job : Linux_Native_Build_For_Packages
90
96
# ###############################################################################
91
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'kickBuild'))
97
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
98
+ condition : false
92
99
variables :
93
100
BuildConfig : Release
94
101
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -107,23 +114,13 @@ jobs:
107
114
version : 6.0.402
108
115
installationPath : $(Agent.ToolsDirectory)/dotnet
109
116
110
- - script :
111
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX) &&
112
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D &&
113
- sudo apt-get -y update &&
114
- sudo apt-get -y install cmake clang git libunwind8 curl libomp-dev libomp5 &&
115
- wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb &&
116
- sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb &&
117
- sudo apt-get update; sudo apt-get install -y apt-transport-https && sudo apt-get update &&
118
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
117
+ - script : ${{ variables.LinuxPrepScript }}
119
118
displayName : Install dependencies
120
119
121
120
- script : dotnet build -c $(BuildConfig) src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=linux /t:Build /p:IncludeLibTorchCpuPackages=true
122
- condition : eq(variables['BuildLibTorchPackages'], 'true')
123
121
displayName : Download libtorch native binaries
124
122
125
123
- script : dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=linux /t:Build /p:IncludeLibTorchCudaPackages=true
126
- condition : eq(variables['BuildLibTorchPackages'], 'true')
127
124
displayName : Download libtorch native CUDA binaries
128
125
129
126
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
@@ -141,7 +138,8 @@ jobs:
141
138
# ###############################################################################
142
139
- job : Windows_Native_Build_For_Packages
143
140
# ###############################################################################
144
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'kickBuild'))
141
+ - {{ if ne(variables['BuildLibTorchPackages'], 'true') }}
142
+ condition : false
145
143
variables :
146
144
BuildConfig : Release
147
145
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -152,7 +150,6 @@ jobs:
152
150
vmImage : ' windows-latest'
153
151
154
152
steps :
155
-
156
153
- task : UseDotNet@2
157
154
displayName : ' Use .NET Core sdk'
158
155
inputs :
@@ -161,14 +158,11 @@ jobs:
161
158
installationPath : $(Agent.ToolsDirectory)/dotnet
162
159
163
160
- script : dotnet build -c $(BuildConfig) src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /t:Build /p:IncludeLibTorchCpuPackages=true
164
- condition : eq(variables['BuildLibTorchPackages'], 'true')
165
161
displayName : Download libtorch native binaries
166
162
167
163
- script : dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /t:Build /p:IncludeLibTorchCudaPackages=true
168
- condition : eq(variables['BuildLibTorchPackages'], 'true')
169
164
displayName : Download libtorch native CUDA binaries
170
165
171
-
172
166
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
173
167
displayName : Build Windows
174
168
@@ -184,7 +178,8 @@ jobs:
184
178
# ################################################################################
185
179
- job : MacOS_x64_Native_Build_For_Packages
186
180
# ################################################################################
187
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'))
181
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
182
+ condition : false
188
183
variables :
189
184
BuildConfig : Release
190
185
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -195,7 +190,6 @@ jobs:
195
190
vmImage : ' macos-latest'
196
191
steps :
197
192
- script : dotnet build -c $(BuildConfig) src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=mac /t:Build /p:IncludeLibTorchCpuPackages=true
198
- condition : eq(variables['BuildLibTorchPackages'], 'true')
199
193
displayName : Download libtorch native binaries
200
194
201
195
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
@@ -213,7 +207,8 @@ jobs:
213
207
# ################################################################################
214
208
- job : MacOS_arm64_Native_Build_For_Packages
215
209
# ################################################################################
216
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'))
210
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
211
+ condition : false
217
212
variables :
218
213
BuildConfig : Release
219
214
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -242,7 +237,8 @@ jobs:
242
237
# ###############################################################################
243
238
- job : Build_TorchSharp_And_libtorch_cpu_Packages
244
239
# ###############################################################################
245
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'))
240
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
241
+ condition : false
246
242
dependsOn :
247
243
- Linux_Native_Build_For_Packages
248
244
- Windows_Native_Build_For_Packages
@@ -416,7 +412,8 @@ jobs:
416
412
# Only run if BuildLibTorchPackages is true
417
413
- job : Build_libtorch_cuda_win_Packages
418
414
# ###############################################################################
419
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'kickBuild'), eq(variables['BuildLibTorchPackages'], 'true'))
415
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
416
+ condition : false
420
417
dependsOn :
421
418
- Windows_Native_Build_For_Packages
422
419
variables :
@@ -471,7 +468,8 @@ jobs:
471
468
# ###############################################################################
472
469
- job : Build_libtorch_cuda_linux_Packages
473
470
# ###############################################################################
474
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'kickBuild'), eq(variables['BuildLibTorchPackages'], 'true'))
471
+ - {{ if ne(parameters['BuildLibTorchPackages'], 'true') }}
472
+ condition : false
475
473
dependsOn :
476
474
- Linux_Native_Build_For_Packages
477
475
variables :
@@ -492,15 +490,7 @@ jobs:
492
490
version : 6.x
493
491
installationPath : $(Agent.ToolsDirectory)/dotnet
494
492
495
- - script :
496
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX) &&
497
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D &&
498
- sudo apt-get -y update &&
499
- sudo apt-get -y install cmake clang git libunwind8 curl libomp-dev libomp5 &&
500
- wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb &&
501
- sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb &&
502
- sudo apt-get update; sudo apt-get install -y apt-transport-https && sudo apt-get update &&
503
- ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
493
+ - script : ${{ variables.LinuxPrepScript }}
504
494
displayName : Install dependencies
505
495
506
496
# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can
@@ -545,7 +535,10 @@ jobs:
545
535
# ###############################################################################
546
536
- job : CodeSign_Core
547
537
# ###############################################################################
548
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'))
538
+ - {{ if and(eq(parameters['BuildLibTorchPackages'], 'true'), eq(parameters['PushPackagesToFeed'], true)) }}
539
+ condition : and(ne(variables['system.pullrequest.isfork'], true))
540
+ - {{ else }}
541
+ condition : false
549
542
dependsOn :
550
543
- Build_TorchSharp_And_libtorch_cpu_Packages
551
544
variables :
@@ -593,7 +586,10 @@ jobs:
593
586
# ###############################################################################
594
587
- job : CodeSign_Extras
595
588
# ###############################################################################
596
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['BuildLibTorchPackages'], 'true'))
589
+ - {{ if and(eq(parameters['BuildLibTorchPackages'], 'true'), eq(parameters['PushPackagesToFeed'], true)) }}
590
+ condition : and(ne(variables['system.pullrequest.isfork'], true))
591
+ - {{ else }}
592
+ condition : false
597
593
dependsOn :
598
594
- Build_libtorch_cuda_win_Packages
599
595
- Build_libtorch_cuda_linux_Packages
@@ -667,7 +663,10 @@ jobs:
667
663
# ###############################################################################
668
664
- job : Push_TorchSharp_And_libtorch_cpu_Packages
669
665
# ###############################################################################
670
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['PushPackagesToFeed'], true))
666
+ - {{ if and(eq(parameters['BuildLibTorchPackages'], 'true'), eq(parameters['PushPackagesToFeed'], true)) }}
667
+ condition : eq(variables['system.pullrequest.isfork'], false))
668
+ - {{ else }}
669
+ condition : false
671
670
672
671
dependsOn :
673
672
- Build_TorchSharp_And_libtorch_cpu_Packages
@@ -769,6 +768,10 @@ jobs:
769
768
# Only run if BuildLibTorchPackages is true
770
769
- job : Push_libtorch_cuda_win_Packages
771
770
# ###############################################################################
771
+ - {{ if and(eq(parameters['BuildLibTorchPackages'], 'true'), eq(parameters['PushPackagesToFeed'], true)) }}
772
+ condition : eq(variables['system.pullrequest.isfork'], false))
773
+ - {{ else }}
774
+ condition : false
772
775
condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['BuildLibTorchPackages'], 'true'), eq(variables['PushPackagesToFeed'], true))
773
776
dependsOn :
774
777
- Build_libtorch_cuda_win_Packages
@@ -854,7 +857,10 @@ jobs:
854
857
# ###############################################################################
855
858
- job : Push_libtorch_cuda_linux_Packages
856
859
# ###############################################################################
857
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['BuildLibTorchPackages'], 'true'), eq(variables['PushPackagesToFeed'], true))
860
+ - {{ if and(eq(parameters['BuildLibTorchPackages'], 'true'), eq(parameters['PushPackagesToFeed'], true)) }}
861
+ condition : eq(variables['system.pullrequest.isfork'], false))
862
+ - {{ else }}
863
+ condition : false
858
864
dependsOn :
859
865
- Build_libtorch_cuda_linux_Packages
860
866
- CodeSign_Extras
0 commit comments