azure-pipelines.rx.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. trigger:
  2. branches:
  3. include:
  4. - main
  5. - rel/*
  6. paths:
  7. include:
  8. - Rx.NET/Source/*
  9. - .editorconfig
  10. - azure-pipelines.rx.yml
  11. pr:
  12. branches:
  13. include:
  14. - main
  15. - rel/*
  16. paths:
  17. include:
  18. - Rx.NET/Source/*
  19. - .editorconfig
  20. - azure-pipelines.rx.yml
  21. stages:
  22. - stage: Build
  23. jobs:
  24. - job: Build
  25. pool:
  26. vmImage: windows-2025
  27. variables:
  28. BuildConfiguration: Release
  29. BuildPlatform: Any CPU
  30. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  31. steps:
  32. - task: UseDotNet@2
  33. displayName: Use .NET Core 10.x SDK
  34. inputs:
  35. version: 10.x
  36. includePreviewVersions: true
  37. # We need .NET 8.0 and 9.0 to be able to run all tests.
  38. # We can't just use the runtime package because we need the desktop framework,
  39. # and the only way to get that into a build agent seems to be to install the SDK.
  40. - task: UseDotNet@2
  41. displayName: Use .NET 9.0 SDK
  42. inputs:
  43. version: '9.0.x'
  44. - task: UseDotNet@2
  45. displayName: Use .NET 8.0 SDK
  46. inputs:
  47. version: '8.0.x'
  48. - task: DotNetCoreCLI@2
  49. inputs:
  50. command: custom
  51. custom: tool
  52. arguments: install --tool-path . nbgv
  53. displayName: Install NBGV tool
  54. - script: nbgv cloud -a -p Rx.NET/Source
  55. displayName: Set Version
  56. - task: DotNetCoreCLI@2
  57. displayName: Build System.Reactive.sln
  58. inputs:
  59. command: build
  60. projects: Rx.NET/Source/System.Reactive.sln
  61. arguments: -c $(BuildConfiguration) -p:CreatePackage=true -p:NoPackageAnalysis=true -p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
  62. - task: NuGetCommand@2
  63. displayName: Pack compatibility package
  64. inputs:
  65. command: custom
  66. arguments: pack Rx.NET/Source/facades/System.Reactive.Compatibility.nuspec -Version $(NBGV_NuGetPackageVersion) -MinClientVersion 2.12 -NoPackageAnalysis -outputdirectory $(Build.ArtifactStagingDirectory)\artifacts
  67. - task: DotNetCoreCLI@2
  68. inputs:
  69. command: custom
  70. custom: tool
  71. arguments: install --tool-path . dotnet-reportgenerator-globaltool
  72. displayName: Install ReportGenerator tool
  73. - task: DotNetCoreCLI@2
  74. inputs:
  75. command: test
  76. projects: Rx.NET/Source/tests/Tests.System.Reactive/*.csproj
  77. arguments: -c $(BuildConfiguration) --no-build --filter "TestCategory!=SkipCI" --settings Rx.NET/Source/CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
  78. displayName: Run Unit Tests
  79. - task: DotNetCoreCLI@2
  80. inputs:
  81. command: test
  82. projects: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj
  83. arguments: -c $(BuildConfiguration)
  84. displayName: Run Api Approvals Tests
  85. - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura"
  86. displayName: Create reports
  87. - task: PublishCodeCoverageResults@1
  88. displayName: 'Publish code coverage'
  89. inputs:
  90. codeCoverageTool: Cobertura
  91. summaryFileLocation: $(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports/Cobertura.xml
  92. - publish: Rx.NET/Source/build
  93. artifact: config
  94. displayName: Publish signing config
  95. - publish: $(Build.ArtifactStagingDirectory)\artifacts
  96. displayName: Publish artifacts
  97. artifact: BuildPackages
  98. - publish: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api
  99. displayName: Publish test artifiacts
  100. artifact: ApprovalsTests
  101. condition: always()
  102. - stage: IntegrationTests
  103. jobs:
  104. - job: Linux
  105. pool:
  106. vmImage: ubuntu-latest
  107. variables:
  108. BuildConfiguration: Release
  109. BuildPlatform: Any CPU
  110. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  111. steps:
  112. - task: UseDotNet@2
  113. displayName: Use .NET Core 10.x SDK
  114. inputs:
  115. version: 10.x
  116. includePreviewVersions: true
  117. - task: UseDotNet@2
  118. displayName: Use .NET 9.0 SDK
  119. inputs:
  120. version: '9.0.x'
  121. - task: UseDotNet@2
  122. displayName: Use .NET 8.0 runtime
  123. inputs:
  124. version: '8.0.x'
  125. packageType: runtime
  126. - task: DotNetCoreCLI@2
  127. inputs:
  128. command: custom
  129. custom: tool
  130. arguments: install --tool-path . nbgv
  131. displayName: Install NBGV tool
  132. - script: ./nbgv cloud -a -p Rx.NET/Source
  133. displayName: Set Version
  134. - task: DownloadPipelineArtifact@2
  135. displayName: Download Build Artifacts
  136. inputs:
  137. artifactName: BuildPackages
  138. targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
  139. - task: DotNetCoreCLI@2
  140. displayName: Update Rx
  141. inputs:
  142. command: custom
  143. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  144. custom: restore
  145. arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
  146. - task: DotNetCoreCLI@2
  147. inputs:
  148. command: test
  149. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  150. arguments: -c $(BuildConfiguration) -f net9.0 --filter "TestCategory!=SkipCI"
  151. displayName: Run 9.0 Tests on Linux
  152. - task: DotNetCoreCLI@2
  153. inputs:
  154. command: test
  155. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  156. arguments: -c $(BuildConfiguration) -f net9.0 --filter "TestCategory!=SkipCI"
  157. displayName: Run 9.0 Tests on Linux
  158. - task: DotNetCoreCLI@2
  159. inputs:
  160. command: test
  161. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  162. arguments: -c $(BuildConfiguration) -f net8.0 --filter "TestCategory!=SkipCI"
  163. displayName: Run 8.0 Tests on Linux
  164. - job: WindowsDesktop
  165. pool:
  166. vmImage: windows-latest
  167. variables:
  168. BuildConfiguration: Release
  169. BuildPlatform: Any CPU
  170. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  171. steps:
  172. - task: UseDotNet@2
  173. displayName: Use .NET Core 10.x SDK
  174. inputs:
  175. version: 10.x
  176. includePreviewVersions: true
  177. - task: UseDotNet@2
  178. displayName: Use .NET 9.0 SDK
  179. inputs:
  180. version: 9.0.x
  181. performMultiLevelLookup: true
  182. - task: UseDotNet@2
  183. displayName: Use .NET 8.0 SDK
  184. inputs:
  185. version: '8.0.x'
  186. - task: DotNetCoreCLI@2
  187. inputs:
  188. command: custom
  189. custom: tool
  190. arguments: install --tool-path . nbgv
  191. displayName: Install NBGV tool
  192. - script: nbgv cloud -a -p Rx.NET/Source
  193. displayName: Set Version
  194. - task: DownloadPipelineArtifact@2
  195. displayName: Download Build Artifacts
  196. inputs:
  197. artifactName: BuildPackages
  198. targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
  199. - task: DotNetCoreCLI@2
  200. displayName: Update Rx
  201. inputs:
  202. command: custom
  203. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
  204. custom: restore
  205. arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
  206. - task: DotNetCoreCLI@2
  207. inputs:
  208. command: test
  209. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
  210. arguments: -c $(BuildConfiguration) --filter "TestCategory!=SkipCI"
  211. displayName: Run Tests on Window Desktop
  212. - stage: CodeSign
  213. condition: and(succeeded('IntegrationTests'), not(eq(variables['build.reason'], 'PullRequest')))
  214. jobs:
  215. - deployment: CodeSign
  216. displayName: Code Signing
  217. pool:
  218. vmImage: windows-latest
  219. environment: Code Sign
  220. variables:
  221. - group: SignClient Credentials
  222. strategy:
  223. runOnce:
  224. deploy:
  225. steps:
  226. - task: UseDotNet@2
  227. displayName: Use .NET 8.0.x SDK
  228. inputs:
  229. version: 8.0.x
  230. performMultiLevelLookup: true
  231. - task: DotNetCoreCLI@2
  232. displayName: Install SignTool tool
  233. inputs:
  234. command: custom
  235. custom: tool
  236. arguments: install --tool-path . sign --version 0.9.1-beta.24406.1
  237. # Run the signing command
  238. - task: AzureCLI@2
  239. inputs:
  240. azureSubscription: 'Rx.NET Sign Service Connection'
  241. scriptType: pscore
  242. scriptLocation: inlineScript
  243. inlineScript: |
  244. .\sign code azure-key-vault `
  245. "**/*.nupkg" `
  246. --base-directory "$(Pipeline.Workspace)\BuildPackages" `
  247. --publisher-name "Reactive Extensions for .NET (.NET Foundation)" `
  248. --description "Rx.NET" `
  249. --description-url "https://github.com/dotnet/reactive" `
  250. --azure-key-vault-url "$(SignKeyVaultUrl)" `
  251. --azure-key-vault-certificate "$(SignKeyVaultCertificateName)"
  252. displayName: Sign packages
  253. - publish: $(Pipeline.Workspace)/BuildPackages
  254. displayName: Publish Signed Packages
  255. artifact: SignedPackages