-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
89 lines (70 loc) · 3.03 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
version: '5.1.0'
counter: $[counter(variables['version'], 0)]
sourceVersion: ''
assemblyVersion: $(version).$(counter)
ciVersion: $(version)-CI.$(counter)
infoVersion: ''
steps:
- powershell: Write-Host "##vso[task.setvariable variable=sourceVersion;]$('$(Build.SourceVersion)'.SubString(0,7))"
displayName: 'Calculate short git hash'
- powershell: Write-Host "##vso[task.setvariable variable=infoVersion;]$('$(assemblyVersion)-$(sourceVersion)')"
displayName: 'Calculate informational version'
- script: dotnet build --configuration $(buildConfiguration) /p:Version="$(assemblyVersion)" /p:InformationalVersion="$(infoVersion)"
displayName: 'dotnet build $(buildConfiguration)'
- script: .\setupdb.cmd
displayName: 'Setup LocalDB for Tests'
- script: dotnet test --configuration $(buildConfiguration) --no-build --filter Category!=MSSQL --logger "trx;LogFileName=TestResults.trx" --logger "nunit;LogFileName=TestResults.xml" /p:CollectCoverage=true /p:CoverletOutput=TestResults\Coverage\coverage.cobertura.xml /p:CoverletOutputFormat=cobertura /p:Exclude="[NUnit.*]*"
displayName: 'Unit Tests & Coverage'
- script: dotnet test --configuration $(buildConfiguration) --no-build --filter Category=MSSQL
displayName: 'MSSQL Tests'
- script: .\teardowndb.cmd
displayName: 'Teardown LocalDB'
- script: dotnet tool install dotnet-reportgenerator-globaltool --tool-path tools
displayName: 'Install Report Generator Tool'
- script: tools\reportgenerator.exe "-reports:$(Build.SourcesDirectory)\test\**\TestResults\Coverage\coverage.cobertura.net5.0.xml" "-targetdir:$(Build.SourcesDirectory)\Coverage" -reporttypes:"HtmlInline_AzurePipelines;Cobertura"
displayName: 'Coverage Report'
- task: DotNetCoreCLI@2
displayName: Create CI Package
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
nobuild: true
packDirectory: '$(Build.ArtifactStagingDirectory)/CI'
versioningScheme : off
buildProperties: 'Version=$(ciVersion)'
verbosityPack: Normal
- task: DotNetCoreCLI@2
displayName: Create Release Package
inputs:
command: pack
packagesToPack: 'src/**/*.csproj'
nobuild: true
packDirectory: '$(Build.ArtifactStagingDirectory)/Public'
versioningScheme: off
buildProperties: 'Version=$(version)'
verbosityPack: Normal
- task: PublishBuildArtifacts@1
displayName: 'Publish NuGet Package Artifacts'
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'packages'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: 'test/**/TestResults.xml'
mergeTestResults: true
failTaskOnFailedTests: true
testRunTitle: 'Unit Tests'
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)\Coverage\Cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)\Coverage'