-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathazure-pipelines.yml
108 lines (95 loc) · 2.93 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
107
108
name: '$(Rev:r)' # Build.BuildId
trigger:
- master
pool:
name: Azure Pipelines
vmImage: 'windows-latest'
demands:
- msbuild
- visualstudio
- vstest
variables:
Solution: 'src/NLog.MailKit.sln'
BuildPlatform: 'Any CPU'
BuildConfiguration: 'Release'
Version: '5.3'
FullVersion: '$(Version).$(Build.BuildId)'
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 6.x'
inputs:
versionSpec: 6.x
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '$(Solution)'
verbosityRestore: Minimal
- task: SonarCloudPrepare@3
displayName: 'Prepare SonarCloud analysis'
inputs:
SonarCloud: 'Sonarcloud'
organization: nlog
projectKey: nlog.mailkit
projectName: 'NLog Mailkit'
projectVersion: '$(FullVersion)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(Solution)'
msbuildArgs: '-v:m -p:Version=$(Version) -p:FileVersion=$(FullVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true -p:EmbedUntrackedSources=true'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
logProjectEvents: false
- task: VSTest@2
displayName: 'Run Tests'
inputs:
testAssemblyVer2: |
**\*.tests.dll
!**\obj\**
!**\ref\**
codeCoverageEnabled: true
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
rerunFailedTests: true
- task: SonarCloudAnalyze@3
displayName: 'Run SonarCloud Analysis'
- task: SonarCloudPublish@3
displayName: 'Publish SonarCloud Quality Gate'
- task: CopyFiles@2
displayName: 'Copy Files artifacts'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: |
**\bin\$(BuildConfiguration)\**\*.nupkg
**\bin\$(BuildConfiguration)\**\*.snupkg
TargetFolder: '$(build.artifactstagingdirectory)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: packages'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: packages
condition: succeededOrFailed()
- task: NuGetCommand@2
displayName: 'Push NuGet Package to nuget.org'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' # will also push the snupkg
nuGetFeedType: 'external'
publishFeedCredentials: 'NLog new'
allowPackageConflicts: true
verbosityPush: 'Normal'
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
continueOnError: true
- task: NuGetCommand@2
displayName: 'Push NuGet Package to Azure Devops'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' # will also push the snupkg
nuGetFeedType: 'internal'
publishVstsFeed: 'a6abb58f-ecac-4f57-8990-021064cff0ff/d910ba3f-9900-4b9a-a317-016618781395' # NLog
allowPackageConflicts: true
verbosityPush: 'Normal'
enabled: false # Get error TF400898