-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
106 lines (85 loc) · 3.16 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
# 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: none
pool:
vmImage: 'Ubuntu-16.04'
variables:
buildConfiguration: 'Release'
majorVersion: 0
minorVersion: 4
#NOTE: this allows for auto incrementing on the patch number each time it runs... reset when the major minor is updated...
#https://kasunkodagoda.com/2019/04/03/hidden-gems-in-azure-pipelines-creating-your-own-rev-variable-using-counter-expression-in-azure-pipelines/
patchVersion: $[counter(format('{0}.{1}', variables['majorVersion'], variables['minorVersion'], 0))]
steps:
- task: SonarCloudPrepare@1
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'SonarCloudService'
organization: '$(SonarOrganization)'
scannerMode: 'MSBuild'
projectKey: '$(SonarProjectKey)'
projectName: '$(SonarProjectName)'
projectVersion: '$(Build.BuildNumber)'
extraProperties: |
sonar.cs.opencover.reportsPaths=$(Build.SourcesDirectory)/TestResults/Coverage/coverage.opencover.xml
sonar.exclusions=**/wwwroot/lib/**/*
# condition: |
# and
# (
# succeeded(),
# eq(variables['Build.Reason'], 'PullRequest'),
# eq(variables['System.PullRequest.TargetBranch'], 'master')
# )
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '**/*[Tt]est/*.csproj'
arguments: '--no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/TestResults/Coverage/*cobertura.xml
reportDirectory: '$(Build.SourcesDirectory)/TestResults/Coverage'
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud code analysis'
# condition: |
# and
# (
# succeeded(),
# eq(variables['Build.Reason'], 'PullRequest'),
# eq(variables['System.PullRequest.TargetBranch'], 'master')
# )
- task: SonarCloudPublish@1
displayName: 'Publish SonarCloud quality gate results'
# condition: |
# and
# (
# succeeded(),
# eq(variables['Build.Reason'], 'PullRequest'),
# eq(variables['System.PullRequest.TargetBranch'], 'master')
# )
- task: WhiteSource Bolt@20
displayName: 'Run WhiteSource Bolt'
#TODO: need to turn these tasks off for Pull Requests
- task: DotNetCoreCLI@2
displayName: package the assembly
inputs:
command: pack
nobuild: true
versioningScheme: byPrereleaseNumber
configurationToBack: $(buildConfiguration)
packagesToPack: "**/*.csproj"
majorVersion: '$(majorVersion)'
minorVersion: '$(minorVersion)'
patchVersion: '$(patchVersion)'
- task: NuGetCommand@2
displayName: publish the assembly
inputs:
command: push
publishVstsFeed: 'RelationalMapper'
allowPackageconflicts: true