-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
168 lines (144 loc) · 4.99 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
- refs/tags/v*
pool:
vmImage: "windows-2022"
variables:
buildConfiguration: "Release"
unitTestProjects: "**/test/unit/**/*.csproj"
testResultsDirectory: "d:/a/1/TestResults"
MSBUILDSINGLELOADCONTEXT: 1
disable.coverage.autogenerate: "true"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core SDK 6.0.x"
inputs:
packageType: "sdk"
version: 6.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: UseDotNet@2
displayName: "Use .NET Core SDK 7.0.x"
inputs:
packageType: "sdk"
version: 7.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: UseDotNet@2
displayName: "Use .NET Core SDK from global.json"
inputs:
packageType: "sdk"
useGlobalJson: true
- task: VisualStudioTestPlatformInstaller@1
inputs:
packageFeedSelector: "nugetOrg"
versionSelector: "latestStable"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
verbosityRestore: Quiet
arguments: AdaskoTheBeAsT.FluentValidation.MediatR.sln
- task: SonarCloudPrepare@2
displayName: "Prepare analysis on SonarCloud"
inputs:
scannerMode: "MSBuild"
SonarCloud: "Sonar.AdaskoTheBeAsT.FluentValidation.MediatR"
organization: "adaskothebeast-github"
projectKey: "AdaskoTheBeAsT_AdaskoTheBeAsT.FluentValidation.MediatR"
projectName: AdaskoTheBeAsT.FluentValidation.MediatR
extraProperties: |
sonar.resharper.cs.reportPath=$(Build.SourcesDirectory)/CodeQualityResults.xml
- task: DotNetCoreCLI@2
displayName: Build
inputs:
arguments: "AdaskoTheBeAsT.FluentValidation.MediatR.sln --configuration $(buildConfiguration)"
- task: CopyFiles@2
displayName: "Copy nuget packages"
inputs:
sourceFolder: "$(Build.SourcesDirectory)"
contents: "**/$(BuildConfiguration)/**/?(AdaskoTheBeAsT.*.nupkg|AdaskoTheBeAsT.*.snupkg)"
targetFolder: "$(Build.SourcesDirectory)/nuget"
CleanTargetFolder: true
flattenFolders: true
- task: DeleteFiles@1
displayName: "Clear test results"
inputs:
SourceFolder: "$(testResultsDirectory)"
Contents: "**/*"
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: "$(unitTestProjects)"
publishTestResults: false
arguments: >-
--configuration $(buildConfiguration)
--collect:"Code Coverage"
--collect:"XPlat Code Coverage"
--logger:"trx"
--results-directory $(testResultsDirectory)
--no-build
--no-restore
--settings $(Build.SourcesDirectory)/.runsettings
/p:RunCodeAnalysis=false
- task: ResharperCli@2
inputs:
solutionOrProjectPath: "AdaskoTheBeAsT.FluentValidation.MediatR.sln"
resharperNuGetVersion: "2023.3.3"
failBuildLevelSelector: "Warning"
resultsOutputFilePath: "$(Build.SourcesDirectory)/CodeQualityResults.xml"
additionalArguments: "--no-build"
- task: SonarCloudAnalyze@2
displayName: Sonar Cloud analyze
- task: SonarCloudPublish@2
displayName: Sonar Cloud publish
inputs:
pollingTimeoutSec: "300"
- task: DeleteFiles@1
displayName: "Clear coverage files"
inputs:
SourceFolder: "$(testResultsDirectory)"
Contents: "**/*.coverage"
- task: PublishTestResults@2
displayName: "Publish Test Results"
inputs:
testResultsFormat: "VSTest"
testResultsFiles: "*.trx"
searchFolder: "$(testResultsDirectory)"
- task: reportgenerator@5
inputs:
reports: "$(testResultsDirectory)/**/coverage.cobertura.xml"
targetdir: "$(testResultsDirectory)/coverage"
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: "Cobertura"
summaryFileLocation: "$(testResultsDirectory)/**/coverage.cobertura.xml"
reportDirectory: "$(testResultsDirectory)/coverage"
- task: CopyFiles@2
displayName: "Copy nuget packages"
inputs:
sourceFolder: "$(Build.SourcesDirectory)/nuget"
contents: "**/*"
targetFolder: "$(Build.ArtifactStagingDirectory)"
CleanTargetFolder: true
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: "$(Build.ArtifactStagingDirectory)"
artifactName: NugetPackages
- task: NuGetToolInstaller@1
displayName: "Install nuget"
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
versionSpec:
checkLatest: true
- task: NuGetCommand@2
displayName: "Publish to nuget"
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
inputs:
command: "push"
packagesToPush: "$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.snupkg"
nuGetFeedType: "external"
publishFeedCredentials: "Nuget"