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 : false
13
- PushPackagesToFeed : false
10
+ - name : BuildLibTorchPackages
11
+ type : boolean
12
+ default : false
13
+ - name : PushPackagesToFeed
14
+ type : boolean
15
+ default : false
16
+ # Set which source branch to build libtorch-* packages.
17
+ # The build-libtorch jobs are only run if the source branch is the same as this value.
18
+ # The default is 'main' branch.
19
+ - name : SourceBranchName
20
+ type : string
21
+ default : ' main'
22
+
23
+ variables :
24
+ MyRunNumber : $[counter('MyRunNumber', 52201)]
25
+ LinuxPrepScript : |
26
+ ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
27
+ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D
28
+ sudo apt-get -y update
29
+ sudo apt-get -y install cmake clang git libunwind8 curl libomp-dev libomp5 wget
30
+ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
31
+ sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb
32
+ sudo apt-get update; sudo apt-get install -y apt-transport-https && sudo apt-get update
33
+ ldd --version && (/sbin/ldconfig -p | grep stdc++) && (strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep LIBCXX)
14
34
15
35
resources :
16
36
containers :
@@ -20,7 +40,7 @@ resources:
20
40
# https://github.com/dotnet/versions/blob/main/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-main.json
21
41
22
42
- container : UbuntuContainer
23
- image : mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22 .04-mlnet-20240216051055-578f026
43
+ image : mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-20 .04-20240708213715-dcf0bb9
24
44
25
45
jobs :
26
46
- template : /build/ci/job-template.yml
29
49
# This reports the GLIB_ and GLIBCXX_ dependencies on the system which ends up getting baked into
30
50
# the generated libTorchSharp.so (and partly determines which Linux systems that binary will
31
51
# 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)
52
+ prepScript : ${{ variables.LinuxPrepScript }}
41
53
buildScript : dotnet build /p:SkipCuda=true -c
42
54
testScript : dotnet test /p:SkipCuda=true --blame test/TorchSharpTest/TorchSharpTest.csproj -c
43
55
pool :
88
100
# ###############################################################################
89
101
- job : Linux_Native_Build_For_Packages
90
102
# ###############################################################################
91
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
103
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
92
104
variables :
93
105
BuildConfig : Release
94
106
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -104,26 +116,18 @@ jobs:
104
116
displayName : ' Use .NET Core sdk'
105
117
inputs :
106
118
packageType : sdk
107
- version : 6.x
119
+ version : 6.0.402
108
120
installationPath : $(Agent.ToolsDirectory)/dotnet
109
121
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)
122
+ - script : ${{ variables.LinuxPrepScript }}
119
123
displayName : Install dependencies
120
124
121
125
- 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' )
126
+ condition : eq('${{ parameters. BuildLibTorchPackages }}', true)
123
127
displayName : Download libtorch native binaries
124
128
125
129
- 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' )
130
+ condition : eq('${{ parameters. BuildLibTorchPackages }}', true)
127
131
displayName : Download libtorch native CUDA binaries
128
132
129
133
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
@@ -141,7 +145,7 @@ jobs:
141
145
# ###############################################################################
142
146
- job : Windows_Native_Build_For_Packages
143
147
# ###############################################################################
144
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
148
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
145
149
variables :
146
150
BuildConfig : Release
147
151
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -152,7 +156,6 @@ jobs:
152
156
vmImage : ' windows-latest'
153
157
154
158
steps :
155
-
156
159
- task : UseDotNet@2
157
160
displayName : ' Use .NET Core sdk'
158
161
inputs :
@@ -161,15 +164,14 @@ jobs:
161
164
installationPath : $(Agent.ToolsDirectory)/dotnet
162
165
163
166
- 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
167
displayName : Download libtorch native binaries
166
168
167
169
- 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' )
170
+ condition : eq('${{ parameters. BuildLibTorchPackages }}', true)
169
171
displayName : Download libtorch native CUDA binaries
170
172
171
-
172
173
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
174
+ condition : eq('${{ parameters.BuildLibTorchPackages }}', true)
173
175
displayName : Build Windows
174
176
175
177
- script : dotnet build -c $(BuildConfig) src/TorchVision/TorchVision.csproj /p:SkipCuda=true /p:SkipTests=true
@@ -184,7 +186,7 @@ jobs:
184
186
# ################################################################################
185
187
- job : MacOS_x64_Native_Build_For_Packages
186
188
# ################################################################################
187
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
189
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
188
190
variables :
189
191
BuildConfig : Release
190
192
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -195,7 +197,7 @@ jobs:
195
197
vmImage : ' macos-latest'
196
198
steps :
197
199
- 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' )
200
+ condition : eq('${{ parameters. BuildLibTorchPackages }}', true)
199
201
displayName : Download libtorch native binaries
200
202
201
203
- script : dotnet build -c $(BuildConfig) src/TorchSharp/TorchSharp.csproj /p:SkipCuda=true /p:SkipTests=true
@@ -213,7 +215,7 @@ jobs:
213
215
# ################################################################################
214
216
- job : MacOS_arm64_Native_Build_For_Packages
215
217
# ################################################################################
216
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
218
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
217
219
variables :
218
220
BuildConfig : Release
219
221
OfficialBuildId : $(BUILD.BUILDNUMBER)
@@ -242,7 +244,7 @@ jobs:
242
244
# ###############################################################################
243
245
- job : Build_TorchSharp_And_libtorch_cpu_Packages
244
246
# ###############################################################################
245
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
247
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
246
248
dependsOn :
247
249
- Linux_Native_Build_For_Packages
248
250
- Windows_Native_Build_For_Packages
@@ -416,7 +418,7 @@ jobs:
416
418
# Only run if BuildLibTorchPackages is true
417
419
- job : Build_libtorch_cuda_win_Packages
418
420
# ###############################################################################
419
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '), eq(variables[' BuildLibTorchPackages'], ' true' ))
421
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '), eq('${{ parameters. BuildLibTorchPackages }}', true))
420
422
dependsOn :
421
423
- Windows_Native_Build_For_Packages
422
424
variables :
@@ -471,7 +473,7 @@ jobs:
471
473
# ###############################################################################
472
474
- job : Build_libtorch_cuda_linux_Packages
473
475
# ###############################################################################
474
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '), eq(variables[' BuildLibTorchPackages'], ' true' ))
476
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '), eq('${{ parameters. BuildLibTorchPackages }}', true))
475
477
dependsOn :
476
478
- Linux_Native_Build_For_Packages
477
479
variables :
@@ -492,15 +494,7 @@ jobs:
492
494
version : 6.x
493
495
installationPath : $(Agent.ToolsDirectory)/dotnet
494
496
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)
497
+ - script : ${{ variables.LinuxPrepScript }}
504
498
displayName : Install dependencies
505
499
506
500
# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can
@@ -545,7 +539,7 @@ jobs:
545
539
# ###############################################################################
546
540
- job : CodeSign_Core
547
541
# ###############################################################################
548
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '))
542
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '))
549
543
dependsOn :
550
544
- Build_TorchSharp_And_libtorch_cpu_Packages
551
545
variables :
@@ -593,7 +587,7 @@ jobs:
593
587
# ###############################################################################
594
588
- job : CodeSign_Extras
595
589
# ###############################################################################
596
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main '), eq(variables['BuildLibTorchPackages'], ' true' ))
590
+ condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }} '), eq('${{ parameters.PushPackagesToFeed }}', true))
597
591
dependsOn :
598
592
- Build_libtorch_cuda_win_Packages
599
593
- Build_libtorch_cuda_linux_Packages
@@ -667,8 +661,7 @@ jobs:
667
661
# ###############################################################################
668
662
- job : Push_TorchSharp_And_libtorch_cpu_Packages
669
663
# ###############################################################################
670
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['PushPackagesToFeed'], true))
671
-
664
+ condition : and(eq('${{ parameters.PushPackagesToFeed }}', true), ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}'))
672
665
dependsOn :
673
666
- Build_TorchSharp_And_libtorch_cpu_Packages
674
667
- CodeSign_Core
@@ -769,7 +762,7 @@ jobs:
769
762
# Only run if BuildLibTorchPackages is true
770
763
- job : Push_libtorch_cuda_win_Packages
771
764
# ###############################################################################
772
- condition : and(ne(variables['system.pullrequest.isfork'] , true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['BuildLibTorchPackages'], ' true' ), eq (variables['PushPackagesToFeed '], true))
765
+ condition : and(eq('${{ parameters.BuildLibTorchPackages }}' , true), eq('${{ parameters.PushPackagesToFeed }}', true), ne (variables['system.pullrequest.isfork '], true))
773
766
dependsOn :
774
767
- Build_libtorch_cuda_win_Packages
775
768
- CodeSign_Extras
@@ -854,7 +847,7 @@ jobs:
854
847
# ###############################################################################
855
848
- job : Push_libtorch_cuda_linux_Packages
856
849
# ###############################################################################
857
- condition : and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], 'main'), eq(variables['BuildLibTorchPackages'], ' true' ), eq (variables['PushPackagesToFeed '], true))
850
+ condition : and(eq('${{ parameters.BuildLibTorchPackages }}', ' true' ), eq('${{ parameters.PushPackagesToFeed }}', true), ne (variables['system.pullrequest.isfork '], true))
858
851
dependsOn :
859
852
- Build_libtorch_cuda_linux_Packages
860
853
- CodeSign_Extras
0 commit comments