-
Notifications
You must be signed in to change notification settings - Fork 29
/
eShop_buildtest-pipeline.yml
208 lines (183 loc) · 5.95 KB
/
eShop_buildtest-pipeline.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
trigger: none
pool:
vmImage: "windows-latest"
parameters:
- name: UnitTests
displayName: Run Unit Tests?
type: boolean
default: true
- name: IntegrationTests
displayName: Run Integration Tests?
type: boolean
default: true
- name: FunctionalTests
displayName: Run Functional Tests?
type: boolean
default: true
variables:
- group: SecureVariables
- name: buildConfiguration
value: "Release"
stages:
- stage: QualityCheck
displayName: Quality Checks
jobs:
- ${{ if and(eq(parameters.UnitTests, false), eq(parameters.IntegrationTests, false), eq(parameters.FunctionalTests, false)) }}:
- job:
steps:
- script: |
echo "No tests selected for execution!"
displayName: NO TESTS
- ${{ if eq(parameters.UnitTests, true) }}:
- job: UnitTestsJob
displayName: "Unit Test Jobs"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core 7.0"
inputs:
packageType: "sdk"
version: "7.0.x"
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "Application-Source-Code/**/*.csproj"
arguments: "--configuration $(BuildConfiguration)"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: "restore"
projects: "Application-Source-Code/**/*.csproj"
# feedsToUse: "config"
# nugetConfigPath: "nuget.config"
- task: DotNetCoreCLI@2
displayName: "Unit Tests"
inputs:
command: test
projects: "Application-Source-Code/**/UnitTests.csproj"
arguments: "--configuration $(BuildConfiguration)"
- ${{ if eq(parameters.IntegrationTests, true) }}:
- job: IntegrationTestsJob
displayName: "Integration Test Jobs"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core 7.0"
inputs:
packageType: "sdk"
version: "7.0.x"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: "restore"
projects: "Application-Source-Code/**/*.csproj"
# feedsToUse: "config"
# nugetConfigPath: "nuget.config"
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "Application-Source-Code/**/*.csproj"
arguments: "--configuration $(BuildConfiguration)"
- task: DotNetCoreCLI@2
displayName: "Integration Tests"
inputs:
command: test
projects: "Application-Source-Code/**/IntegrationTests.csproj"
arguments: "--configuration $(BuildConfiguration)"
- ${{ if eq(parameters.FunctionalTests, true) }}:
- job: FunctionalTestsJob
displayName: "Functional Test Jobs"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core 7.0"
inputs:
packageType: "sdk"
version: "7.0.x"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: "restore"
projects: "Application-Source-Code/**/*.csproj"
# feedsToUse: "config"
# nugetConfigPath: "nuget.config"
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "Application-Source-Code/**/*.csproj"
arguments: "--configuration $(BuildConfiguration)"
- task: DotNetCoreCLI@2
displayName: "Functional Tests"
inputs:
command: test
projects: "Application-Source-Code/**/FunctionalTests.csproj"
arguments: "--configuration $(BuildConfiguration)"
- stage: Build
displayName: Build and Pack
dependsOn: QualityCheck
condition: succeeded()
jobs:
- job: BuildAndPackageJob
displayName: "Build and Package Job"
steps:
- task: UseDotNet@2
displayName: "Use .NET Core 7.0"
inputs:
packageType: "sdk"
version: "7.0.x"
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: "restore"
projects: "Application-Source-Code/**/*.csproj"
# feedsToUse: "config"
# nugetConfigPath: "nuget.config"
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: "Application-Source-Code/**/*.csproj"
arguments: "--configuration $(BuildConfiguration)"
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: True
arguments: "--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)"
zipAfterPublish: True
# - task: PublishBuildArtifacts@1
# displayName: "Publish Artifact"
# inputs:
# PathtoPublish: "$(Build.ArtifactStagingDirectory)"
# condition: succeededOrFailed()
- task: PublishPipelineArtifact@1
displayName: "Publish Artifact"
condition: succeededOrFailed()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'eShopOnWeb'
publishLocation: 'pipeline'
- task: XplatGenerateReleaseNotes@3
displayName: "Generate Release Notes"
inputs:
outputfile: '$(Build.ArtifactStagingDirectory)/ReleaseNotes.md'
templateLocation: 'File'
templatefile: 'azure-pipelines/build-handlebars-template.md'
checkStage: true
overrideStageName: 'Build'
stopOnRedeploy: false
sortWi: false
showOnlyPrimary: false
searchCrossProjectForPRs: true
# gitHubPat: 'GHPAT'
dumpPayloadToConsole: true
dumpPayloadToFile: false
replaceFile: false
getParentsAndChildren: true
getAllParents: true
# tags: 'sometag'
getIndirectPullRequests: true
stopOnError: false
- task: PublishPipelineArtifact@1
displayName: "Publish Release Notes Artifact"
condition: succeededOrFailed()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/ReleaseNotes.md'
artifact: 'ReleaseNotes'
publishLocation: 'pipeline'