azure-pipelines-test.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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: 3.1.100
  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 Core SDK 2.1"
  32. condition: eq(variables['ImageName'], 'ubuntu-latest')
  33. inputs:
  34. packageType: sdk
  35. version: '2.1.805'
  36. - task: UseDotNet@2
  37. displayName: "Update DotNet"
  38. inputs:
  39. packageType: sdk
  40. version: ${{ parameters.DotNetSdkVersion }}
  41. - task: SonarCloudPrepare@1
  42. displayName: 'Prepare analysis on SonarCloud'
  43. condition: eq(variables['ImageName'], 'ubuntu-latest')
  44. enabled: false
  45. inputs:
  46. SonarCloud: 'Sonarcloud for Jellyfin'
  47. organization: 'jellyfin'
  48. projectKey: 'jellyfin_jellyfin'
  49. - task: DotNetCoreCLI@2
  50. displayName: 'Run CLI Tests'
  51. inputs:
  52. command: "test"
  53. projects: ${{ parameters.TestProjects }}
  54. arguments: '--configuration Release --collect:"XPlat Code Coverage" --settings tests/coverletArgs.runsettings --verbosity minimal "-p:GenerateDocumentationFile=False"'
  55. publishTestResults: true
  56. testRunTitle: $(Agent.JobName)
  57. workingDirectory: "$(Build.SourcesDirectory)"
  58. - task: SonarCloudAnalyze@1
  59. displayName: 'Run Code Analysis'
  60. condition: eq(variables['ImageName'], 'ubuntu-latest')
  61. enabled: false
  62. - task: SonarCloudPublish@1
  63. displayName: 'Publish Quality Gate Result'
  64. condition: eq(variables['ImageName'], 'ubuntu-latest')
  65. enabled: false
  66. - task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
  67. condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # !! THIS is for V1 only V2 will/should support merging
  68. displayName: 'Run ReportGenerator'
  69. enabled: false
  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. enabled: false
  79. inputs:
  80. codeCoverageTool: "cobertura"
  81. #summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' # !!THIS IS FOR V2
  82. summaryFileLocation: "$(Agent.TempDirectory)/merged/**.xml"
  83. pathToSources: $(Build.SourcesDirectory)
  84. failIfCoverageEmpty: true