Skip to content

Commit f3b11d3

Browse files
committed
Update adt_pull_request.yml for Azure Pipelines
1 parent 01953d5 commit f3b11d3

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

adt_pull_request.yml

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,54 @@
1-
# ASP.NET Core
2-
# Build and test ASP.NET Core projects targeting .NET Core.
3-
# Add steps that run tests, create a NuGet package, deploy, and more:
4-
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
5-
6-
#trigger:
7-
#- version-5
8-
91
pool:
10-
vmImage: windows-latest
11-
12-
variables:
13-
buildConfiguration: 'Release'
14-
prPipeline: $[eq(variables['Build.Reason'], 'PullRequest')]
2+
name: Azure Pipelines
3+
demands: java
154

165
steps:
17-
- script: dotnet tool install --global dotnet-sonarscanner
18-
displayName: 'Instalando dependência global sonarscanner'
19-
20-
- script: dotnet tool install --global JetBrains.dotCover.GlobalTool
21-
displayName: 'Instalando dependência global JetBrains.dotCover.GlobalTool'
22-
23-
- script: dotnet build --configuration $(buildConfiguration)
24-
displayName: 'dotnet build $(buildConfiguration)'
6+
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
7+
displayName: 'Prepare analysis on SonarCloud'
8+
inputs:
9+
SonarCloud: 'SonarCloud-ADT'
10+
organization: typinghard
11+
projectKey: 'typinghard_azure-devops-tracker'
12+
extraProperties: |
13+
# Additional properties that will be passed to the scanner,
14+
# Put one key=value per line, example:
15+
# sonar.exclusions=**/*.bin
16+
sonar.coverageReportPaths=$(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml
17+
18+
- task: CmdLine@2
19+
inputs:
20+
script: dotnet build --no-incremental
21+
displayName: 'Rodando dotnet build'
2522

2623
- task: DotNetCoreCLI@2
2724
displayName: 'Calculate code coverage'
28-
continueOnError: false
2925
inputs:
3026
command: test
3127
projects: '**/*[Tt]ests/*.csproj'
32-
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutput=../TestResults/ /p:CoverletOutputFormat="json%2ccobertura" /p:MergeWith=../TestResults/coverage.json /m:1'
33-
publishTestResults: false
34-
35-
- task: DotNetCoreCLI@2
36-
displayName: 'Checkpoint: Total branch coverage >= $(codeCoverageBranchThreshold)'
37-
continueOnError: false
28+
arguments: '--configuration $(BuildConfiguration) --collect "XPlat Code coverage" -- RunConfiguration.DisableAppDomain=true'
29+
30+
- script: 'dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.5.8'
31+
displayName: 'Install ReportGenerator tool'
32+
33+
- script: 'reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"'
34+
displayName: 'Create reports'
35+
36+
#- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@5
37+
# displayName: ReportGenerator
38+
# inputs:
39+
# reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
40+
# targetdir: '$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"'
41+
# #reporttypes: 'HtmlInline_AzurePipelines;Cobertura;Badges'
42+
# #assemblyfilters: '-xunit\*'
43+
44+
- task: PublishCodeCoverageResults@1
45+
displayName: 'Publish code coverage from $(Build.SourcesDirectory)/coverlet/reports/coverage.cobertura.xml'
3846
inputs:
39-
command: test
40-
projects: '**/*[Tt]ests/*.csproj'
41-
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutput=../TestResults/ /p:CoverletOutputFormat="json%2ccobertura" /p:MergeWith=../TestResults/coverage.json /p:ThresholdType=branch /p:Threshold=$(codeCoverageBranchThreshold) /p:ThresholdStat=total'
42-
publishTestResults: false
47+
codeCoverageTool: Cobertura
48+
summaryFileLocation: '$(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml'
49+
50+
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
51+
displayName: 'Run Code Analysis'
4352

44-
- script: 'dotnet sonarscanner begin /k:"$(SONAR_PROJECT_KEY)" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login="$(SONAR_TOKEN)" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html dotnet build –no-incremental dotnet dotcover test --dcReportType=HTML dotnet sonarscanner end /d:sonar.login="$(SONAR_TOKEN)"'
45-
displayName: 'Rodando SonarScanner '
53+
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
54+
displayName: 'Publish Quality Gate Result'

0 commit comments

Comments
 (0)