azure-pipelines.rx.yml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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-latest
  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 8.0.x SDK
  34. inputs:
  35. version: 8.0.x
  36. performMultiLevelLookup: true
  37. # We need .NET 7.0 and 6.0 to be able to run all tests.
  38. # For .NET 7.0, the runtime package is sufficient because we don't need to build anything.
  39. # That doesn't work for 6.0, because we need the desktop framework, and the only way to
  40. # get that into a build agent seems to be to install the SDK.
  41. - task: UseDotNet@2
  42. displayName: Use .NET 7.0 runtime
  43. inputs:
  44. version: '7.0.x'
  45. packageType: runtime
  46. - task: UseDotNet@2
  47. displayName: Use .NET 6.0 SDK
  48. inputs:
  49. version: '6.0.x'
  50. - task: DotNetCoreCLI@2
  51. inputs:
  52. command: custom
  53. custom: tool
  54. arguments: install --tool-path . nbgv
  55. displayName: Install NBGV tool
  56. - script: nbgv cloud -a -p Rx.NET/Source
  57. displayName: Set Version
  58. - task: MSBuild@1
  59. displayName: Build System.Reactive.sln
  60. inputs:
  61. solution: Rx.NET/Source/System.Reactive.sln
  62. msbuildArguments: /restore /t:build /p:CreatePackage=true /p:NoPackageAnalysis=true /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
  63. configuration: $(BuildConfiguration)
  64. maximumCpuCount: false
  65. - task: NuGetCommand@2
  66. displayName: Pack compatibility package
  67. inputs:
  68. command: custom
  69. arguments: pack Rx.NET/Source/facades/System.Reactive.Compatibility.nuspec -Version $(NBGV_NuGetPackageVersion) -MinClientVersion 2.12 -NoPackageAnalysis -outputdirectory $(Build.ArtifactStagingDirectory)\artifacts
  70. - task: DotNetCoreCLI@2
  71. inputs:
  72. command: custom
  73. custom: tool
  74. arguments: install --tool-path . dotnet-reportgenerator-globaltool
  75. displayName: Install ReportGenerator tool
  76. - task: DotNetCoreCLI@2
  77. inputs:
  78. command: test
  79. projects: Rx.NET/Source/tests/Tests.System.Reactive/*.csproj
  80. arguments: -c $(BuildConfiguration) --filter "TestCategory!=SkipCI" --settings Rx.NET/Source/CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
  81. displayName: Run Unit Tests
  82. - task: DotNetCoreCLI@2
  83. inputs:
  84. command: test
  85. projects: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj
  86. arguments: -c $(BuildConfiguration)
  87. displayName: Run Api Approvals Tests
  88. - script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura"
  89. displayName: Create reports
  90. - task: PublishCodeCoverageResults@1
  91. displayName: 'Publish code coverage'
  92. inputs:
  93. codeCoverageTool: Cobertura
  94. summaryFileLocation: $(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports/Cobertura.xml
  95. - publish: Rx.NET/Source/build
  96. artifact: config
  97. displayName: Publish signing config
  98. - publish: $(Build.ArtifactStagingDirectory)\artifacts
  99. displayName: Publish artifacts
  100. artifact: BuildPackages
  101. - publish: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api
  102. displayName: Publish test artifiacts
  103. artifact: ApprovalsTests
  104. condition: always()
  105. - stage: IntegrationTests
  106. jobs:
  107. - job: Linux
  108. pool:
  109. vmImage: ubuntu-latest
  110. variables:
  111. BuildConfiguration: Release
  112. BuildPlatform: Any CPU
  113. DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  114. steps:
  115. - task: UseDotNet@2
  116. inputs:
  117. version: 8.0.x
  118. - task: UseDotNet@2
  119. displayName: Use .NET 7.0 SDK
  120. inputs:
  121. version: '7.0.x'
  122. packageType: runtime
  123. - task: UseDotNet@2
  124. displayName: Use .NET 6.0 SDK
  125. inputs:
  126. version: '6.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 net8.0 --filter "TestCategory!=SkipCI"
  153. displayName: Run 8.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 net7.0 --filter "TestCategory!=SkipCI"
  159. displayName: Run 7.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 net6.0 --filter "TestCategory!=SkipCI"
  165. displayName: Run 6.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. inputs:
  176. version: 8.0.x
  177. performMultiLevelLookup: true
  178. - task: UseDotNet@2
  179. displayName: Use .NET 7.0 SDK
  180. inputs:
  181. version: '7.0.x'
  182. - task: UseDotNet@2
  183. displayName: Use .NET 6.0 SDK
  184. inputs:
  185. version: '6.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: DotNetCoreCLI@2
  227. inputs:
  228. command: custom
  229. custom: tool
  230. arguments: install --tool-path . SignClient
  231. displayName: Install SignTool tool
  232. - pwsh: |
  233. .\SignClient "Sign" `
  234. --baseDirectory "$(Pipeline.Workspace)\BuildPackages" `
  235. --input "**/*.nupkg" `
  236. --config "$(Pipeline.Workspace)\config\signclient.json" `
  237. --user "$(SignClientUser)" `
  238. --secret "$(SignClientSecret)" `
  239. --name "Rx.NET" `
  240. --description "Rx.NET" `
  241. --descriptionUrl "https://github.com/dotnet/reactive"
  242. displayName: Sign packages
  243. - publish: $(Pipeline.Workspace)/BuildPackages
  244. displayName: Publish Signed Packages
  245. artifact: SignedPackages