Skip to content

Commit d5cb5b8

Browse files
committed
Update adt_pull_request.yml for Azure Pipelines
1 parent 46c772e commit d5cb5b8

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

adt_pull_request.yml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,62 @@
11
pool:
2-
vmImage: windows-latest
2+
name: Azure Pipelines
3+
demands: java
34

4-
variables:
5-
buildConfiguration: 'Release'
6-
prPipeline: $[eq(variables['Build.Reason'], 'PullRequest')]
5+
#Your build pipeline references an undefined variable named ‘Parameters.RestoreBuildProjects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
6+
#Your build pipeline references an undefined variable named ‘Parameters.RestoreBuildProjects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
7+
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
8+
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
79

810
steps:
9-
- task: SonarQubePrepare@5
11+
- task: DotNetCoreCLI@2
12+
displayName: Restore
13+
inputs:
14+
command: restore
15+
projects: '$(Parameters.RestoreBuildProjects)'
16+
17+
- task: SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
18+
displayName: 'Prepare analysis on SonarCloud'
1019
inputs:
11-
SonarQube: 'SonarQube Developer Edition'
12-
scannerMode: 'MSBuild'
13-
projectKey: '$(SONAR_PROJECT_KEY)'
20+
SonarCloud: 'SonarCloud-ADT'
21+
organization: typinghard
22+
projectKey: 'typinghard_azure-devops-tracker'
1423
extraProperties: |
15-
# Additional properties that will be passed to the scanner,
16-
# Put one key=value per line, example:
17-
# sonar.exclusions=**/*.bin
18-
sonar.cs.vscoveragexml.reportsPaths=**/CodeCoverage/Cobertura.xml
24+
# Additional properties that will be passed to the scanner,
25+
# Put one key=value per line, example:
26+
# sonar.exclusions=**/*.bin
27+
sonar.cs.vscoveragexml.reportsPaths=$(Build.SourcesDirectory)/tests/\*\*/coverage.cobertura.xml
1928
20-
- task: CmdLine@2
29+
- task: DotNetCoreCLI@2
30+
displayName: Build
2131
inputs:
22-
script: dotnet build --no-incremental
23-
displayName: 'Rodando dotnet build'
32+
projects: '$(Parameters.RestoreBuildProjects)'
33+
arguments: '--configuration $(BuildConfiguration)'
2434

25-
# Test with Coverage
26-
# Run all tests with "/p:CollectCoverage=true /p:CoverletOutputFormat=cobertura" to generate the code coverage file
2735
- task: DotNetCoreCLI@2
2836
displayName: 'Calculate code coverage'
29-
continueOnError: false
3037
inputs:
3138
command: test
32-
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
3339
projects: '**/*[Tt]ests/*.csproj'
34-
nobuild: true
40+
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura'
3541

36-
- task: reportgenerator@5
42+
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@5
3743
displayName: ReportGenerator
3844
inputs:
3945
reports: '$(Build.SourcesDirectory)/tests/\*\*/coverage.cobertura.xml'
4046
targetdir: '$(Build.SourcesDirectory)/CodeCoverage'
4147
reporttypes: 'HtmlInline\_AzurePipelines;Cobertura;Badges'
4248
assemblyfilters: '-xunit\*'
49+
customSettings: assemblyfilters
4350

44-
# Publish the code coverage result (summary and web site)
45-
# The summary allows to view the coverage percentage in the summary tab
46-
# The web site allows to view which lines are covered directly in Azure Pipeline
4751
- task: PublishCodeCoverageResults@1
48-
displayName: 'Publish code coverage'
52+
displayName: 'Publish code coverage from $(Build.SourcesDirectory)/tests/\*\*/coverage.cobertura.xml'
4953
inputs:
5054
codeCoverageTool: Cobertura
51-
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
52-
reportDirectory: '$(Build.SourcesDirectory)/CodeCoverage'
55+
summaryFileLocation: '$(Build.SourcesDirectory)/tests/\*\*/coverage.cobertura.xml'
5356

54-
- task: SonarQubeAnalyze@5
55-
displayName: 'Run SonarCloud analysis'
57+
- task: SonarSource.sonarcloud.ce096e50-6155-4de8-8800-4221aaeed4a1.SonarCloudAnalyze@1
58+
displayName: 'Run Code Analysis'
59+
60+
- task: SonarSource.sonarcloud.38b27399-a642-40af-bb7d-9971f69712e8.SonarCloudPublish@1
61+
displayName: 'Publish Quality Gate Result'
5662

57-
- task: SonarQubePublish@5
58-
displayName: 'Publish sonarqube analysis'
59-
inputs:
60-
pollingTimeoutSec: '300'

0 commit comments

Comments
 (0)