2020-01-13 08:22:52 -07:00
|
|
|
parameters:
|
2020-04-12 10:20:37 -07:00
|
|
|
- name: ImageNames
|
|
|
|
type: object
|
|
|
|
default:
|
|
|
|
Linux: "ubuntu-latest"
|
|
|
|
Windows: "windows-latest"
|
|
|
|
macOS: "macos-latest"
|
|
|
|
- name: TestProjects
|
|
|
|
type: string
|
|
|
|
default: "tests/**/*Tests.csproj"
|
|
|
|
- name: DotNetSdkVersion
|
|
|
|
type: string
|
2021-02-09 19:02:02 -07:00
|
|
|
default: 5.0.103
|
2020-01-13 08:22:52 -07:00
|
|
|
|
|
|
|
jobs:
|
2020-04-12 10:20:37 -07:00
|
|
|
- job: Test
|
|
|
|
displayName: Test
|
2020-01-13 08:22:52 -07:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
${{ each imageName in parameters.ImageNames }}:
|
|
|
|
${{ imageName.key }}:
|
|
|
|
ImageName: ${{ imageName.value }}
|
|
|
|
pool:
|
|
|
|
vmImage: "$(ImageName)"
|
|
|
|
steps:
|
|
|
|
- checkout: self
|
|
|
|
clean: true
|
|
|
|
submodules: true
|
|
|
|
persistCredentials: false
|
|
|
|
|
2020-04-12 16:36:42 -07:00
|
|
|
# This is required for the SonarCloud analyzer
|
|
|
|
- task: UseDotNet@2
|
2020-11-20 07:52:10 -07:00
|
|
|
displayName: "Install .NET SDK 5.x"
|
2020-04-21 14:55:19 -07:00
|
|
|
condition: eq(variables['ImageName'], 'ubuntu-latest')
|
2020-04-12 16:36:42 -07:00
|
|
|
inputs:
|
|
|
|
packageType: sdk
|
2020-11-20 07:52:10 -07:00
|
|
|
version: '5.x'
|
2020-04-12 16:36:42 -07:00
|
|
|
|
2020-01-13 08:22:52 -07:00
|
|
|
- task: UseDotNet@2
|
|
|
|
displayName: "Update DotNet"
|
|
|
|
inputs:
|
|
|
|
packageType: sdk
|
|
|
|
version: ${{ parameters.DotNetSdkVersion }}
|
|
|
|
|
2020-04-12 16:36:42 -07:00
|
|
|
- task: SonarCloudPrepare@1
|
|
|
|
displayName: 'Prepare analysis on SonarCloud'
|
2020-04-21 14:55:19 -07:00
|
|
|
condition: eq(variables['ImageName'], 'ubuntu-latest')
|
2020-06-06 22:33:10 -07:00
|
|
|
enabled: false
|
2020-04-12 16:36:42 -07:00
|
|
|
inputs:
|
|
|
|
SonarCloud: 'Sonarcloud for Jellyfin'
|
|
|
|
organization: 'jellyfin'
|
|
|
|
projectKey: 'jellyfin_jellyfin'
|
|
|
|
|
2020-01-13 08:22:52 -07:00
|
|
|
- task: DotNetCoreCLI@2
|
2020-04-12 10:20:37 -07:00
|
|
|
displayName: 'Run CLI Tests'
|
2020-01-13 08:22:52 -07:00
|
|
|
inputs:
|
|
|
|
command: "test"
|
|
|
|
projects: ${{ parameters.TestProjects }}
|
2020-10-02 06:07:48 -07:00
|
|
|
arguments: '--configuration Release --collect:"XPlat Code Coverage" --settings tests/coverletArgs.runsettings --verbosity minimal'
|
2020-01-13 08:22:52 -07:00
|
|
|
publishTestResults: true
|
|
|
|
testRunTitle: $(Agent.JobName)
|
|
|
|
workingDirectory: "$(Build.SourcesDirectory)"
|
|
|
|
|
2020-04-12 16:36:42 -07:00
|
|
|
- task: SonarCloudAnalyze@1
|
|
|
|
displayName: 'Run Code Analysis'
|
2020-04-21 14:55:19 -07:00
|
|
|
condition: eq(variables['ImageName'], 'ubuntu-latest')
|
2020-06-06 22:33:10 -07:00
|
|
|
enabled: false
|
2020-04-12 16:36:42 -07:00
|
|
|
|
|
|
|
- task: SonarCloudPublish@1
|
|
|
|
displayName: 'Publish Quality Gate Result'
|
2020-04-21 14:55:19 -07:00
|
|
|
condition: eq(variables['ImageName'], 'ubuntu-latest')
|
2020-06-06 22:33:10 -07:00
|
|
|
enabled: false
|
2020-04-12 16:36:42 -07:00
|
|
|
|
2020-01-13 08:22:52 -07:00
|
|
|
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@4
|
|
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # !! THIS is for V1 only V2 will/should support merging
|
2020-04-12 10:20:37 -07:00
|
|
|
displayName: 'Run ReportGenerator'
|
2020-01-13 08:22:52 -07:00
|
|
|
inputs:
|
2020-01-15 03:27:38 -07:00
|
|
|
reports: "$(Agent.TempDirectory)/**/coverage.cobertura.xml"
|
|
|
|
targetdir: "$(Agent.TempDirectory)/merged/"
|
|
|
|
reporttypes: "Cobertura"
|
2020-01-13 08:22:52 -07:00
|
|
|
|
|
|
|
## V2 is already in the repository but it does not work "wrong number of segments" YAML error.
|
|
|
|
- task: PublishCodeCoverageResults@1
|
|
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) # !! THIS is for V1 only V2 will/should support merging
|
2020-04-12 10:20:37 -07:00
|
|
|
displayName: 'Publish Code Coverage'
|
2020-01-13 08:22:52 -07:00
|
|
|
inputs:
|
2020-01-15 03:27:38 -07:00
|
|
|
codeCoverageTool: "cobertura"
|
2020-01-13 08:22:52 -07:00
|
|
|
#summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' # !!THIS IS FOR V2
|
2020-01-15 03:27:38 -07:00
|
|
|
summaryFileLocation: "$(Agent.TempDirectory)/merged/**.xml"
|
|
|
|
pathToSources: $(Build.SourcesDirectory)
|
|
|
|
failIfCoverageEmpty: true
|
2020-09-03 12:51:38 -07:00
|
|
|
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
displayName: 'Publish OpenAPI Artifact'
|
|
|
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
|
|
|
inputs:
|
2021-03-01 12:03:15 -07:00
|
|
|
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net5.0/openapi.json"
|
2020-09-03 12:51:38 -07:00
|
|
|
artifactName: 'OpenAPI Spec'
|