da91b4fa4c
Switch to cobertura for code coverage Switch to dotnet test for tests Add matrix run for different platforms Add extra variables for easier maintenance
69 lines
2.5 KiB
YAML
69 lines
2.5 KiB
YAML
parameters:
|
|
- 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
|
|
default: 3.1.100
|
|
|
|
jobs:
|
|
- job: MainTest
|
|
displayName: Main Test
|
|
strategy:
|
|
matrix:
|
|
${{ each imageName in parameters.ImageNames }}:
|
|
${{ imageName.key }}:
|
|
ImageName: ${{ imageName.value }}
|
|
maxParallel: 3
|
|
pool:
|
|
vmImage: "$(ImageName)"
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
submodules: true
|
|
persistCredentials: false
|
|
|
|
- task: UseDotNet@2
|
|
displayName: "Update DotNet"
|
|
inputs:
|
|
packageType: sdk
|
|
version: ${{ parameters.DotNetSdkVersion }}
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Run .NET Core CLI tests
|
|
inputs:
|
|
command: "test"
|
|
projects: ${{ parameters.TestProjects }}
|
|
arguments: "--configuration Release --collect:\"XPlat Code Coverage\" --settings tests/coverletArgs.runsettings --verbosity minimal \"-p:GenerateDocumentationFile=False\""
|
|
publishTestResults: true
|
|
testRunTitle: $(Agent.JobName)
|
|
workingDirectory: "$(Build.SourcesDirectory)"
|
|
|
|
|
|
- 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
|
|
displayName: ReportGenerator (merge)
|
|
inputs:
|
|
reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
|
|
targetdir: '$(Agent.TempDirectory)/merged/'
|
|
reporttypes: 'Cobertura'
|
|
|
|
## 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
|
|
displayName: Publish Code Coverage
|
|
inputs:
|
|
codeCoverageTool: 'cobertura'
|
|
#summaryFileLocation: '$(Agent.TempDirectory)/**/coverage.cobertura.xml' # !!THIS IS FOR V2
|
|
summaryFileLocation: '$(Agent.TempDirectory)/merged/**.xml'
|
|
pathToSources: $(Build.SourcesDirectory) # Optional
|
|
#reportDirectory: # Optional
|
|
#additionalCodeCoverageFiles: # Optional
|
|
failIfCoverageEmpty: true # Optional
|