forked from cuiopen/json-rpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
110 lines (110 loc) · 4 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
109
110
variables:
- name: 'Build.ProjectPath'
value: '$(Build.SourcesDirectory)/global.proj'
stages:
- stage: Pack
dependsOn: []
jobs:
- job: Release
steps:
- task: UseDotNet@2
displayName: 'dotnet.use.sdk'
inputs:
useGlobalJson: true
workingDirectory: '$(Build.SourcesDirectory)'
- task: DotNetCoreCLI@2
displayName: 'dotnet.build'
inputs:
command: custom
custom: build
arguments: '$(Build.ProjectPath) -v $(DOTNET_VERBOSITY) -c Release -p:ContinuousIntegrationBuild=true -p:BuildNumber=$(Build.BuildNumber) -p:UseSolution=true'
- task: DotNetCoreCLI@2
displayName: 'dotnet.pack'
inputs:
command: custom
custom: pack
arguments: '$(Build.ProjectPath) -v $(DOTNET_VERBOSITY) -c Release -p:ContinuousIntegrationBuild=true -p:BuildNumber=$(Build.BuildNumber) --no-build --include-symbols -o $(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
displayName: 'artifact.publish'
inputs:
artifactName: 'packages'
targetPath: '$(Build.ArtifactStagingDirectory)'
- stage: Test
dependsOn: []
condition: eq(variables['Build.SkipTest'], '')
jobs:
- job: Release
steps:
- task: UseDotNet@2
displayName: 'dotnet.use.sonar'
inputs:
packageType: runtime
version: 2.x
- task: UseDotNet@2
displayName: 'dotnet.use.sdk'
inputs:
useGlobalJson: true
workingDirectory: '$(Build.SourcesDirectory)'
- task: SonarCloudPrepare@1
displayName: 'sonar.prepare'
inputs:
SonarCloud: '$(System.ServiceConnection.Sonar)'
organization: '$(Sonar.Organization)'
projectKey: '$(Sonar.ProjectKey)'
scannerMode: 'MSBuild'
extraProperties: |
sonar.log.level=$(Sonar.Logging.Level)
sonar.scm.disabled=true
sonar.cs.roslyn.ignoreIssues=true
sonar.cs.vstest.reportsPaths=$(Common.TestResultsDirectory)/**/*.trx
sonar.cs.opencover.reportsPaths=$(Common.TestResultsDirectory)/**/*.opencover.xml
- task: DotNetCoreCLI@2
displayName: 'dotnet.build'
inputs:
command: custom
custom: build
arguments: '$(Build.ProjectPath) -v $(DOTNET_VERBOSITY) -c Release -p:BuildNumber=$(Build.BuildNumber) -p:UseSolution=true -p:CopyLocalLockFileAssemblies=true'
- task: DotNetCoreCLI@2
displayName: 'dotnet.test'
inputs:
command: custom
custom: test
arguments: '$(Build.ProjectPath) -v $(DOTNET_VERBOSITY) -c Release -p:BuildNumber=$(Build.BuildNumber) --no-build --filter TestCategory!=System -s $(Build.SourcesDirectory)/src/.runsettings -l trx -r $(Common.TestResultsDirectory)'
- task: PublishTestResults@2
displayName: 'report.publish'
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
searchFolder: '$(Common.TestResultsDirectory)'
- task: SonarCloudAnalyze@1
displayName: 'sonar.analyze'
condition: and(succeeded(), not(canceled()))
- task: SonarCloudPublish@1
displayName: 'sonar.publish'
condition: and(succeeded(), not(canceled()), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
- stage: Push
dependsOn:
- Pack
- Test
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SkipPush'], ''))
jobs:
- job: Release
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
displayName: 'artifact.download'
inputs:
artifactName: 'packages'
targetPath: '$(Build.ArtifactStagingDirectory)'
- task: NuGetToolInstaller@1
displayName: 'nuget.use'
inputs:
versionSpec: '$(System.NuGet.Version)'
- task: NuGetCommand@2
displayName: 'nuget.push'
condition: and(succeeded(), not(canceled()))
inputs:
command: push
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: '$(System.ServiceConnection.NuGet.Staging)'