azure-pipelines.rx.yml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
  62. # The System.Reactive.MakeRefAssemblies project just builds the reference assemblies that go into
  63. # the System.Reactive package's ref folder, so we don't want a NuGet package for System.Reactive.MakeRefAssemblies
  64. # itself. However, for some reason setting IsPackable to false causes build failures, so instead, we just let the
  65. # build create a nupkg and snupkg for that project, and then delete them here.
  66. - pwsh: |
  67. rm $(Build.ArtifactStagingDirectory)\artifacts\System.Reactive.MakeRefAssemblies.*
  68. displayName: Remove MakeRefAssemblies artifacts
  69. - task: DotNetCoreCLI@2
  70. inputs:
  71. command: custom
  72. custom: tool
  73. arguments: install --tool-path . dotnet-reportgenerator-globaltool
  74. displayName: Install ReportGenerator tool
  75. - task: DotNetCoreCLI@2
  76. inputs:
  77. command: test
  78. projects: Rx.NET/Source/tests/Tests.System.Reactive/*.csproj
  79. arguments: -c $(BuildConfiguration) --no-build --filter "TestCategory!=SkipCI" --settings Rx.NET/Source/CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
  80. displayName: Run Unit Tests
  81. - task: DotNetCoreCLI@2
  82. inputs:
  83. command: test
  84. projects: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj
  85. arguments: -c $(BuildConfiguration)
  86. displayName: Run Api Approvals Tests
  87. - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura"
  88. displayName: Create reports
  89. - task: PublishCodeCoverageResults@1
  90. displayName: 'Publish code coverage'
  91. inputs:
  92. codeCoverageTool: Cobertura
  93. summaryFileLocation: $(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports/Cobertura.xml
  94. - publish: Rx.NET/Source/build
  95. artifact: config
  96. displayName: Publish signing config
  97. - publish: $(Build.ArtifactStagingDirectory)\artifacts
  98. displayName: Publish artifacts
  99. artifact: BuildPackages
  100. - publish: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api
  101. displayName: Publish test artifiacts
  102. artifact: ApprovalsTests
  103. condition: always()
  104. - stage: IntegrationTests
  105. jobs:
  106. - job: Linux
  107. pool:
  108. vmImage: ubuntu-latest
  109. variables:
  110. BuildConfiguration: Release
  111. BuildPlatform: Any CPU
  112. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  113. steps:
  114. - task: UseDotNet@2
  115. displayName: Use .NET Core 10.x SDK
  116. inputs:
  117. version: 10.x
  118. includePreviewVersions: true
  119. - task: UseDotNet@2
  120. displayName: Use .NET 9.0 SDK
  121. inputs:
  122. version: '9.0.x'
  123. - task: UseDotNet@2
  124. displayName: Use .NET 8.0 runtime
  125. inputs:
  126. version: '8.0.x'
  127. packageType: runtime
  128. - task: DotNetCoreCLI@2
  129. inputs:
  130. command: custom
  131. custom: tool
  132. arguments: install --tool-path . nbgv
  133. displayName: Install NBGV tool
  134. - script: ./nbgv cloud -a -p Rx.NET/Source
  135. displayName: Set Version
  136. - task: DownloadPipelineArtifact@2
  137. displayName: Download Build Artifacts
  138. inputs:
  139. artifactName: BuildPackages
  140. targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
  141. - task: DotNetCoreCLI@2
  142. displayName: Update Rx
  143. inputs:
  144. command: custom
  145. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  146. custom: restore
  147. arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
  148. - task: DotNetCoreCLI@2
  149. inputs:
  150. command: test
  151. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  152. arguments: -c $(BuildConfiguration) -f net9.0 --filter "TestCategory!=SkipCI"
  153. displayName: Run 9.0 Tests on Linux
  154. - task: DotNetCoreCLI@2
  155. inputs:
  156. command: test
  157. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  158. arguments: -c $(BuildConfiguration) -f net9.0 --filter "TestCategory!=SkipCI"
  159. displayName: Run 9.0 Tests on Linux
  160. - task: DotNetCoreCLI@2
  161. inputs:
  162. command: test
  163. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
  164. arguments: -c $(BuildConfiguration) -f net8.0 --filter "TestCategory!=SkipCI"
  165. displayName: Run 8.0 Tests on Linux
  166. - job: WindowsDesktop
  167. pool:
  168. vmImage: windows-latest
  169. variables:
  170. BuildConfiguration: Release
  171. BuildPlatform: Any CPU
  172. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  173. steps:
  174. - task: UseDotNet@2
  175. displayName: Use .NET Core 10.x SDK
  176. inputs:
  177. version: 10.x
  178. includePreviewVersions: true
  179. - task: UseDotNet@2
  180. displayName: Use .NET 9.0 SDK
  181. inputs:
  182. version: 9.0.x
  183. performMultiLevelLookup: true
  184. - task: UseDotNet@2
  185. displayName: Use .NET 8.0 SDK
  186. inputs:
  187. version: '8.0.x'
  188. - task: DotNetCoreCLI@2
  189. inputs:
  190. command: custom
  191. custom: tool
  192. arguments: install --tool-path . nbgv
  193. displayName: Install NBGV tool
  194. - script: nbgv cloud -a -p Rx.NET/Source
  195. displayName: Set Version
  196. - task: DownloadPipelineArtifact@2
  197. displayName: Download Build Artifacts
  198. inputs:
  199. artifactName: BuildPackages
  200. targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
  201. - task: DotNetCoreCLI@2
  202. displayName: Update Rx
  203. inputs:
  204. command: custom
  205. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
  206. custom: restore
  207. arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
  208. - task: DotNetCoreCLI@2
  209. inputs:
  210. command: test
  211. projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
  212. arguments: -c $(BuildConfiguration) --filter "TestCategory!=SkipCI"
  213. displayName: Run Tests on Window Desktop
  214. - stage: CodeSign
  215. condition: and(succeeded('IntegrationTests'), not(eq(variables['build.reason'], 'PullRequest')))
  216. jobs:
  217. - deployment: CodeSign
  218. displayName: Code Signing
  219. pool:
  220. vmImage: windows-latest
  221. environment: Code Sign
  222. variables:
  223. - group: SignClient Credentials
  224. strategy:
  225. runOnce:
  226. deploy:
  227. steps:
  228. - task: UseDotNet@2
  229. displayName: Use .NET 8.0.x SDK
  230. inputs:
  231. version: 8.0.x
  232. performMultiLevelLookup: true
  233. - task: DotNetCoreCLI@2
  234. displayName: Install SignTool tool
  235. inputs:
  236. command: custom
  237. custom: tool
  238. arguments: install --tool-path . sign --version 0.9.1-beta.24406.1
  239. # Run the signing command
  240. - task: AzureCLI@2
  241. inputs:
  242. azureSubscription: 'Rx.NET Sign Service Connection'
  243. scriptType: pscore
  244. scriptLocation: inlineScript
  245. inlineScript: |
  246. .\sign code azure-key-vault `
  247. "**/*.nupkg" `
  248. --base-directory "$(Pipeline.Workspace)\BuildPackages" `
  249. --publisher-name "Reactive Extensions for .NET (.NET Foundation)" `
  250. --description "Rx.NET" `
  251. --description-url "https://github.com/dotnet/reactive" `
  252. --azure-key-vault-url "$(SignKeyVaultUrl)" `
  253. --azure-key-vault-certificate "$(SignKeyVaultCertificateName)"
  254. displayName: Sign packages
  255. - publish: $(Pipeline.Workspace)/BuildPackages
  256. displayName: Publish Signed Packages
  257. artifact: SignedPackages