-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yaml
149 lines (131 loc) · 4.79 KB
/
azure-pipelines.yaml
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
trigger:
branches:
include:
- master
paths:
include:
- src/extensions/*
pool:
vmImage: 'windows-latest'
parameters:
- name: publishFromFeature
displayName: 'Publish from feature branch to Private MarketPlace?'
type: boolean
default: false
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
publisher: 'capgemini-msft-uk'
deploymentBranch: 'refs/heads/master'
extensionId: 'build-release-task'
extensionName: 'Capgemini Microsoft UK Build and Release Tools'
vstsMktPlaceServiceConnName: 'Capgemini MarketPlace Publishers'
stages:
- stage: Build
jobs:
- job: BuildJob
displayName: Build
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 5.2.0'
inputs:
versionSpec: 5.2.0
- task: PowerShell@2
displayName: 'Run Pester Tests'
inputs:
targetType: filePath
filePath: '$(System.DefaultWorkingDirectory)/tests/RunTests.ps1'
workingDirectory: '$(System.DefaultWorkingDirectory)/tests'
- task: PublishTestResults@2
displayName: 'Publish Pester Results **/Pester-Tests.xml'
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/Pester-Tests.xml'
testRunTitle: 'OWASP API Tests'
searchFolder: '$(System.DefaultWorkingDirectory)\tests\TestResults'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '**/Pester-Coverage.xml'
pathToSources: '$(System.DefaultWorkingDirectory)\tests\TestResults'
- task: TfxInstaller@3
displayName: 'Use Node CLI for Azure DevOps'
inputs:
version: 'v0.9.x'
- task: QueryAzureDevOpsExtensionVersion@3
inputs:
connectTo: 'VsTeam'
connectedServiceName: '$(vstsMktPlaceServiceConnName)'
publisherId: '$(publisher)-dev'
extensionId: '$(extensionId)'
versionAction: 'Patch'
outputVariable: 'Task.Extension.Version'
- task: PackageAzureDevOpsExtension@3
inputs:
rootFolder: '$(system.defaultworkingdirectory)/src/extensions'
publisherId: '$(publisher)'
extensionId: '$(extensionId)'
extensionName: '$(extensionName)'
extensionVersion: '$(Task.Extension.Version)'
updateTasksVersion: true
updateTasksVersionType: 'patch'
extensionVisibility: 'private'
extensionPricing: 'free'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**.vsix'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
- stage: PublishtoPrivateMarketPlace
displayName: Publish to Private MarketPlace
condition: and(succeeded(), or(eq(${{ parameters.publishFromFeature }}, true), eq(variables['Build.SourceBranch'], variables['deploymentBranch'])))
jobs:
- job: PublishPrivateJob
displayName: Publish to Private MarketPlace
steps:
- checkout: none
- download: current
- task: TfxInstaller@3
inputs:
version: 'v0.9.x'
- task: PublishExtension@1
inputs:
connectTo: 'VsTeam'
connectedServiceName: '$(vstsMktPlaceServiceConnName)'
fileType: 'vsix'
vsixFile: '$(Pipeline.Workspace)/drop/**.vsix'
publisherId: '$(publisher)-dev'
extensionName: '$(extensionName)'
updateTasksVersion: false
extensionVisibility: 'private'
extensionPricing: 'free'
- stage: PublishToPublicMarketPlace
displayName: Publish to Public Feed
condition: and(succeeded(), eq(variables['Build.SourceBranch'], variables['deploymentBranch']))
jobs:
- deployment:
environment: Public Visual Studio MarketPlace
strategy:
runOnce:
deploy:
steps:
- task: TfxInstaller@3
inputs:
version: 'v0.9.x'
- task: PublishExtension@1
inputs:
connectTo: 'VsTeam'
connectedServiceName: '$(vstsMktPlaceServiceConnName)'
fileType: 'vsix'
vsixFile: '$(Pipeline.Workspace)/drop/**.vsix'
publisherId: '$(publisher)'
extensionName: '$(extensionName)'
updateTasksVersion: false
extensionVisibility: 'public'
extensionPricing: 'free'