This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathazure-pipelines.yml
95 lines (82 loc) · 2.96 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
trigger:
branches:
include:
- master
- refs/tags/*
paths:
exclude:
- README.md
variables:
buildConfiguration: 'Release'
stages:
- stage: Diagnostic
displayName: Diagnostic Info
condition: eq(variables['System.Debug'], 'true')
jobs:
- job:
displayName: Print Azure Pipelines Diagnostic Info
steps:
- task: CmdLine@2
displayName: Print current environment variables
inputs:
script: 'set'
- stage: CodeAnalysis
displayName: Code Analysis
dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
jobs:
- job:
displayName: Run Sonar Cloud
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
displayName: Install .Net Core 2.2.x SDK
inputs:
packageType: sdk
version: '2.2.x'
- task: UseDotNet@2
displayName: Install .Net Core 3.1.x SDK
inputs:
packageType: sdk
version: '3.1.x'
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.3.x'
- task: gitversion/execute@0
displayName: Use GitVersion
inputs:
additionalArguments: '/updateAssemblyInfo'
- task: SonarCloudPrepare@1
displayName: Prepare SonarCloud
inputs:
SonarCloud: 'SonarCloud vhatsura'
organization: 'vhatsura'
scannerMode: 'MSBuild'
projectKey: 'elastic-apm-mongo'
projectName: 'elastic-apm-mongo'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
sonar.exclusions=examples/**/*
sonar.test.exclusions=tests/**/*
sonar.cs.opencover.reportsPaths=**/*.opencover.xml
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
timeoutInMinutes: 5
inputs:
command: test
# https://github.com/tonerdo/coverlet/blob/589e210e740bbf243cb0e57acbff7bf4e1ea8a66/Documentation/MSBuildIntegration.md#note-for-powershell--vsts-users
arguments: '--no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute="Obsolete%2cGeneratedCodeAttribute%2cCompilerGeneratedAttribute"'
- task: SonarCloudAnalyze@1
displayName: Run Sonar Scanner
- task: SonarCloudPublish@1
displayName: Publish analyze artifacts to Sonar Cloud
inputs:
pollingTimeoutSec: '300'