azure-pipelines.rx.yml 8.5 KB

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