-
Notifications
You must be signed in to change notification settings - Fork 6
/
azure-pipelines.yml
104 lines (88 loc) · 3.67 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
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- '*' # must quote since "*" is a YAML reserved character; we want a string
schedules:
- cron: "0 12 * * 0"
displayName: Weekly Sunday build
branches:
include:
- master
always: true
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Yoti SonarCloud'
organization: 'getyoti'
scannerMode: 'MSBuild'
projectKey: 'getyoti:dotnet'
projectName: '.NET SDK'
projectVersion: '3.13.0'
extraProperties: |
sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
sonar.links.scm = https://github.com/getyoti/yoti-dotnet-sdk
sonar.exclusions = src/Yoti.Auth/ProtoBuf/**,src/Examples/**,**/obj/**,**/*.dll,src/Yoti.Auth/DigitalIdentity/**
displayName: SonarCloud Prepare Analysis
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
displayName: Restore Solution
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=false /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
displayName: Build Solution
# Cobertura is used to display tests and code coverage in Azure
- task: DotNetCoreCLI@2
inputs:
command: test
arguments: '--configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Exclude="[*]Yoti.Auth.ProtoBuf.*" /p:ExcludeByAttribute="GeneratedCodeAttribute"'
projects: '**/*Tests/*.csproj'
nobuild: true
displayName: Run Tests With Cobertura
# OpenCover is used to display code coverage in SonarCloud
- task: DotNetCoreCLI@2
inputs:
command: test
arguments: '--logger trx --configuration $(BuildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*]Yoti.Auth.ProtoBuf.*" /p:ExcludeByAttribute="GeneratedCodeAttribute"'
projects: '**/*Tests/*.csproj'
nobuild: true
displayName: Run Tests With OpenCover
# Generate the report using ReportGenerator (https://github.com/danielpalme/ReportGenerator)
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool
- script: reportgenerator -reports:$(Build.SourcesDirectory)/test/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:Cobertura
displayName: Cobertura Code Coverage
- script: reportgenerator -reports:$(Build.SourcesDirectory)/test/**/coverage.opencover.xml -targetdir:D:\Reports
displayName: OpenCover Code Coverage
# Publish the code coverage result (summary and web site)
# The summary allows to view the coverage percentage in the summary tab
# The web site allows to view which lines are covered directly in Azure Pipeline
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/CodeCoverage/Cobertura.xml'
displayName: 'Publish Cobertura Code Coverage'
- task: SonarCloudAnalyze@1
displayName: Sonar Cloud Analyze
- task: SonarCloudPublish@1
inputs:
pollingTimeoutSec: '300'
displayName: Sonar Cloud Publish