-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
108 lines (95 loc) · 3.06 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
trigger:
branches:
include:
- main
- master
- develop
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
isMaster: $[eq(variables['Build.SourceBranch'], 'refs/heads/master')]
# disable.coverage.autogenerate: 'true'
steps:
- script: echo Directories - $(Build.SourcesDirectory) - $(Agent.TempDirectory)
- script: printenv
- task: SonarQubePrepare@5
displayName: 'SonarQube Preapare'
condition: eq(variables.isMaster, 'true')
inputs:
SonarQube: 'Azure 2023 VM SonarQube'
scannerMode: 'MSBuild'
projectKey: 'DotnetCoreLogger'
projectName: 'DotnetCoreLogger'
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'restore'
projects: "**/*.csproj"
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'WebApp Core Test'
inputs:
command: test
projects: 'WebApp.Core.Test/WebApp.Core.Test.csproj'
arguments: '
--configuration $(buildConfiguration)
--no-build
--no-restore
--logger "trx;LogFileName=testresults.trx"
/p:CollectCoverage=true
/p:CoverletOutputFormat=cobertura
/p:CoverletOutput=./TestResults/
/p:Threshold=0
/p:ThresholdType=line
/p:Exclude="[WebApp.Sql]*%2c[WebApp.Service]*"
'
- script: |
cd $(Build.SourcesDirectory)
dir
# - task: reportgenerator@5
# inputs:
# reports: $(Build.SourcesDirectory)\**\TestResults\coverage.cobertura.xml
# targetdir: $(Build.SourcesDirectory)\coveragereport
# reporttypes: 'HTML;HtmlInline_AzurePipelines;Badges;Cobertura'
# assemblyfilters: '-*tests*'
# title: 'Dotnet Logger Report'
# tag: '$(build.buildnumber)_#$(build.buildid)'
- task: PublishCodeCoverageResults@1
displayName: 'Dotnet Test Publish Code Coverage'
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: $(Build.SourcesDirectory)/**/TestResults/coverage.cobertura.xml
reportDirectory: $(Build.SourcesDirectory)/coveragereport
failIfCoverageEmpty: false
# - task: PublishCodeCoverageResults@1
# displayName: 'Dotnet Test Publish Code Coverage'
# inputs:
# codeCoverageTool: 'cobertura'
# summaryFileLocation: $(Build.SourcesDirectory)\coveragereport\Cobertura.xml
# reportDirectory: $(Build.SourcesDirectory)\coveragereport
# failIfCoverageEmpty: false
- task: SonarQubeAnalyze@5
condition: eq(variables.isMaster, 'true')
- task: SonarQubePublish@5
condition: eq(variables.isMaster, 'true')
inputs:
pollingTimeoutSec: '300'
- task: DotNetCoreCLI@2
displayName: 'Artifact Generate'
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
- task: PublishPipelineArtifact@1
displayName: 'Upload Artifact'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: 'DotnetCoreLoggerSite'