azure-pipelines-test.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. parameters:
  2. - name: ImageNames
  3. type: object
  4. default:
  5. Linux: "ubuntu-latest"
  6. Windows: "windows-latest"
  7. macOS: "macos-latest"
  8. - name: TestProjects
  9. type: string
  10. default: "tests/**/*Tests.csproj"
  11. - name: DotNetSdkVersion
  12. type: string
  13. default: 6.0.x
  14. jobs:
  15. - job: Test
  16. displayName: Test
  17. strategy:
  18. matrix:
  19. ${{ each imageName in parameters.ImageNames }}:
  20. ${{ imageName.key }}:
  21. ImageName: ${{ imageName.value }}
  22. pool:
  23. vmImage: "$(ImageName)"
  24. steps:
  25. - checkout: self
  26. clean: true
  27. submodules: true
  28. persistCredentials: false
  29. # This is required for the SonarCloud analyzer
  30. - task: UseDotNet@2
  31. displayName: "Install .NET SDK 5.x"
  32. condition: eq(variables['ImageName'], 'ubuntu-latest')
  33. inputs:
  34. packageType: sdk
  35. version: '5.x'
  36. - task: UseDotNet@2
  37. displayName: "Update DotNet"
  38. inputs:
  39. packageType: sdk
  40. version: ${{ parameters.DotNetSdkVersion }}
  41. includePreviewVersions: true
  42. - task: SonarCloudPrepare@1
  43. displayName: 'Prepare analysis on SonarCloud'
  44. condition: eq(variables['ImageName'], 'ubuntu-latest')
  45. enabled: false
  46. inputs:
  47. SonarCloud: 'Sonarcloud for Jellyfin'
  48. organization: 'jellyfin'
  49. projectKey: 'jellyfin_jellyfin'
  50. - task: DotNetCoreCLI@2
  51. displayName: 'Run CLI Tests'
  52. inputs:
  53. command: "test"
  54. projects: ${{ parameters.TestProjects }}
  55. arguments: '--configuration Release --collect:"XPlat Code Coverage" --settings tests/coverletArgs.runsettings --verbosity minimal'
  56. publishTestResults: true
  57. testRunTitle: $(Agent.JobName)
  58. workingDirectory: "$(Build.SourcesDirectory)"
  59. - task: SonarCloudAnalyze@1
  60. displayName: 'Run Code Analysis'
  61. condition: eq(variables['ImageName'], 'ubuntu-latest')
  62. enabled: false
  63. - task: SonarCloudPublish@1
  64. displayName: 'Publish Quality Gate Result'
  65. condition: eq(variables['ImageName'], 'ubuntu-latest')
  66. enabled: false
  67. - task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
  68. condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # !! THIS is for V1 only V2 will/should support merging
  69. displayName: 'Run ReportGenerator'
  70. inputs:
  71. reports: "$(Agent.TempDirectory)/**/coverage.cobertura.xml"
  72. targetdir: "$(Agent.TempDirectory)/merged/"
  73. reporttypes: "Cobertura"
  74. ## V2 is already in the repository but it does not work "wrong number of segments" YAML error.
  75. - task: PublishCodeCoverageResults@1
  76. condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # !! THIS is for V1 only V2 will/should support merging
  77. displayName: 'Publish Code Coverage'
  78. inputs:
  79. codeCoverageTool: "cobertura"
  80. #summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' # !!THIS IS FOR V2
  81. summaryFileLocation: "$(Agent.TempDirectory)/merged/**.xml"
  82. pathToSources: $(Build.SourcesDirectory)
  83. failIfCoverageEmpty: true
  84. - task: PublishPipelineArtifact@1
  85. displayName: 'Publish OpenAPI Artifact'
  86. condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
  87. inputs:
  88. targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json"
  89. artifactName: 'OpenAPI Spec'