-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
azure-pipelines.yml
193 lines (178 loc) · 6.17 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
trigger:
batch: true
branches:
include:
- master
- develop
paths:
exclude:
- README.md
- doc/*
- .github/*
pr:
branches:
include:
- develop
- master
paths:
exclude:
- README.md
- doc/*
variables:
- group: 'External Resources'
- name: vmImage
value: 'ubuntu-latest' # see https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml&viewFallbackFrom=vsts
- name: rgName
value: 'storagenet-deleteme'
- name: v
value: '9.2.0'
- name: av
value: '9.0.0'
- name: pv
value: '9.2.7-preview-03'
stages:
- stage: Build
jobs:
- job: Core
pool:
vmImage: $(vmImage)
steps:
- script: echo "##vso[build.updatebuildnumber]$(pv)"
- task: DotNetCoreCLI@2
displayName: 'Unit Tests'
continueOnError: true
inputs:
command: 'test'
projects: 'test/Storage.Net.Tests/Storage.Net.Tests.csproj'
arguments: '-c release /p:Version=$(pv) /p:FileVersion=$(v) /p:AssemblyVersion=$(av) /p:PackageLicense="https://github.com/aloneguid/storage/blob/master/LICENSE" /p:Authors="Ivan Gavryliuk (@aloneguid)" /p:PackageIcon="storage.png"'
- task: DotNetCoreCLI@2
displayName: 'build all'
inputs:
projects: src/storage.sln
arguments: '-c release /p:Version=$(pv) /p:FileVersion=$(v) /p:AssemblyVersion=$(av) /p:PackageLicense="https://github.com/aloneguid/storage/blob/master/LICENSE" /p:Authors="Ivan Gavryliuk (@aloneguid)" /p:PackageIcon="storage.png"'
- task: CopyFiles@2
displayName: 'copy generated nugets'
inputs:
SourceFolder: src
Contents: '**/*.nupkg'
TargetFolder: ' $(build.artifactstagingdirectory)'
CleanTargetFolder: true
OverWrite: true
flattenFolders: true
# we don't care if tests in other stages are not successful, we want to public this to internal testing
- task: NuGetCommand@2
condition: "eq(variables['Build.SourceBranch'], 'refs/heads/develop')"
displayName: 'push to internal feed'
continueOnError: true
inputs:
command: 'push'
packagesToPush: '$(build.artifactstagingdirectory)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '34dffbbb-3f23-4f93-9019-e579bf50a1ff'
allowPackageConflicts: true
- task: PublishBuildArtifacts@1
displayName: 'publish nugets as artifacts'
inputs:
ArtifactName: nuget
- stage: Integration
condition: "eq(variables['Build.SourceBranch'], 'refs/heads/develop')"
dependsOn: []
jobs:
- job: Infra
displayName: 'Build Test Infrastructure'
steps:
- task: AzureResourceManagerTemplateDeployment@3
displayName: 'Deploy Test Azure Resources'
inputs:
deploymentScope: 'Resource Group'
azureResourceManagerConnection: 'PAYG (personal)'
subscriptionId: 'e692471f-4dba-4d86-8940-ce6cca371941'
action: 'Create Or Update Resource Group'
resourceGroupName: $(rgName)
location: 'North Europe'
templateLocation: 'Linked artifact'
csmFile: 'infra/azure.json'
deploymentMode: 'Incremental'
deploymentOutputs: 'InfraOutput'
- task: AzurePowerShell@4
displayName: 'Post Configure Resources'
inputs:
azureSubscription: 'PAYG (personal)'
ScriptType: 'FilePath'
ScriptPath: 'infra/postconfigure.ps1'
ScriptArguments: '-JsonString ''$(InfraOutput)'' -RgName $(rgName)'
FailOnStandardError: true
azurePowerShellVersion: 'LatestVersion'
pwsh: true
- task: PowerShell@2
displayName: 'Transfer Secrets to Variable Set'
inputs:
filePath: 'infra/infraset.ps1'
arguments: '-JsonString ''$(InfraOutput)'' -Organisation ''aloneguid'' -Project ''AllPublic'' -GroupId ''8'' -Pat ''$(Pat)'''
failOnStderr: true
pwsh: true
- job: Blobs
displayName: 'Blobs'
dependsOn: [ 'Infra' ]
pool:
vmImage: $(vmImage)
steps:
- task: DotNetCoreCLI@2
displayName: 'run tests'
continueOnError: false
inputs:
command: test
projects: test/Storage.Net.Tests.Integration/Storage.Net.Tests.Integration.csproj
arguments: '-c release --filter Category=Blobs'
- job: Messaging
dependsOn: [ 'Infra' ]
displayName: 'Messaging'
pool:
vmImage: $(vmImage)
steps:
- task: DotNetCoreCLI@2
displayName: 'run tests'
continueOnError: false
inputs:
command: test
projects: test/Storage.Net.Tests.Integration/Storage.Net.Tests.Integration.csproj
arguments: '-c release --filter Category=Messenger'
- stage: Deploy
dependsOn: ['Build', 'Integration']
condition: "eq(variables['Build.SourceBranch'], 'refs/heads/master')"
#condition: "or( eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/queuesvnext') )"
jobs:
- deployment: Nuget
displayName: 'Push packages'
pool:
vmImage: $(vmImage)
environment: live
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'nuget'
downloadPath: '$(System.ArtifactsDirectory)'
- task: NuGetCommand@2
#condition: "or( eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/queuesvnext') )"
displayName: nuget.org
inputs:
command: push
packagesToPush: '$(System.ArtifactsDirectory)/nuget/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'nuget.org (aloneguid)'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'aloneguid'
repositoryName: 'aloneguid/storage'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: '$(Build.BuildNumber)'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'issueBased'
changeLogLabels: