@@ -11,9 +11,12 @@ variables:
11
11
BuildConfiguration : Release
12
12
IsBranchDeployable : ${{ containsValue(parameters.DeployBranches, variables['Build.SourceBranchName']) }}
13
13
CI : true
14
+ DotNetVersion : ' 8.0.x'
14
15
NodeVersion : ' 20.16.0'
15
16
RubyVersion : ' 3.2'
16
17
AcrServiceConnection : s101d-datahub-spn-ees-dfe-gov-uk-docker-managed-service-connection
18
+ PublicApiDir : GovUk.Education.ExploreEducationStatistics.Public.Data.Api
19
+ PublicApiDocsDir : explore-education-statistics-api-docs
17
20
18
21
trigger :
19
22
branches :
31
34
- test
32
35
33
36
jobs :
34
- - job : Backend
35
- pool : ees-ubuntu2204-xlarge
37
+ - job : BackendVerify
38
+ pool : ees-ubuntu2204-large
36
39
workspace :
37
40
clean : all
38
41
steps :
39
42
- task : UseDotNet@2
40
- displayName : Install .NET 8.0 SDK
43
+ displayName : Install .NET $(DotNetVersion)
41
44
inputs :
42
- version : 8.0.x
45
+ version : $(DotNetVersion)
43
46
performMultiLevelLookup : true
44
47
45
- - task : DotNetCoreCLI@2
46
- displayName : Build
47
- inputs :
48
- projects : |
49
- **/GovUk.*/*csproj
50
- !**/GovUk.Education.ExploreEducationStatistics.Admin/*csproj
51
- arguments : --configuration $(BuildConfiguration)
52
-
53
48
# TODO: Uncomment this step once formatter has been run globally.
54
49
# This is because whitespace rules cannot be warnings or suggestions; they will always be errors
55
50
# - task: DotNetCoreCLI@2
56
- # displayName:' Verify Formatting and Style
51
+ # displayName: Verify formatting
57
52
# inputs:
58
53
# command: custom
59
54
# custom: format whitespace src/GovUk.Education.ExploreEducationStatistics.sln --verify-no-changes --severity error
60
55
# arguments: --verify-no-changes --verbosity diagnostic
61
56
62
57
- task : DotNetCoreCLI@2
63
- displayName : Verify Formatting and Style
58
+ displayName : Verify style
64
59
inputs :
65
60
command : custom
66
61
custom : format
@@ -69,15 +64,45 @@ jobs:
69
64
projects : src/GovUk.Education.ExploreEducationStatistics.sln
70
65
71
66
- task : DotNetCoreCLI@2
72
- displayName : Verify Formatting and Style
67
+ displayName : Verify analyzers
73
68
inputs :
74
69
command : custom
75
70
custom : format
76
71
# # TODO: Remove "--severity error" once work has been done to resolve build warnings (https://dfedigital.atlassian.net/browse/EES-4594).
77
72
arguments : analyzers --verify-no-changes --verbosity diagnostic --severity error
78
73
projects : src/GovUk.Education.ExploreEducationStatistics.sln
79
74
80
- # TODO: Wrap these ^ three tasks up into a single `dotnet format` task once all 3 above TODOs are TO-DONE ;)
75
+ # TODO: Wrap the above three tasks up into a single `dotnet format` task once all TODOs are done
76
+
77
+ - task : DotNetCoreCLI@2
78
+ displayName : Build Public API
79
+ inputs :
80
+ projects : ' **/GovUk.Education.ExploreEducationStatistics.Public.Data.Api.csproj'
81
+ arguments : --configuration $(BuildConfiguration)
82
+
83
+ - task : Bash@3
84
+ displayName : Diff Public API OpenAPI docs
85
+ inputs :
86
+ targetType : inline
87
+ script : |
88
+ docker run --rm -t \
89
+ -v $(System.DefaultWorkingDirectory)/src/$(PublicApiDir)/bin/$(BuildConfiguration)/net8.0:/api \
90
+ -v $(System.DefaultWorkingDirectory)/src/$(PublicApiDocsDir):/api-docs \
91
+ -v $(System.DefaultWorkingDirectory)/ci/scripts:/scripts \
92
+ --entrypoint /bin/sh \
93
+ tufin/oasdiff \
94
+ /scripts/public-api-openapi-diff.sh
95
+
96
+ - job : BackendTest
97
+ pool : ees-ubuntu2204-xlarge
98
+ workspace :
99
+ clean : all
100
+ steps :
101
+ - task : UseDotNet@2
102
+ displayName : Install .NET $(DotNetVersion)
103
+ inputs :
104
+ version : $(DotNetVersion)
105
+ performMultiLevelLookup : true
81
106
82
107
- task : DotNetCoreCLI@2
83
108
displayName : Test
@@ -88,6 +113,16 @@ jobs:
88
113
!**/GovUk.Education.ExploreEducationStatistics.Admin.Tests/*csproj
89
114
arguments : --configuration $(BuildConfiguration)
90
115
116
+ - job : BackendPublish
117
+ pool :
118
+ vmImage : ubuntu-22.04
119
+ steps :
120
+ - task : UseDotNet@2
121
+ displayName : Install .NET $(DotNetVersion)
122
+ inputs :
123
+ version : $(DotNetVersion)
124
+ performMultiLevelLookup : true
125
+
91
126
- task : DotNetCoreCLI@2
92
127
displayName : Package Data API
93
128
inputs :
97
132
arguments : --self-contained true -r win-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/data-api
98
133
zipAfterPublish : True
99
134
100
- - task : PublishPipelineArtifact@0
135
+ - task : PublishPipelineArtifact@1
101
136
displayName : Publish Data API artifact
137
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
102
138
inputs :
103
139
artifactName : data-api
104
140
targetPath : $(Build.ArtifactStagingDirectory)/data-api
@@ -112,8 +148,9 @@ jobs:
112
148
arguments : --self-contained true -r win-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/content-api
113
149
zipAfterPublish : True
114
150
115
- - task : PublishPipelineArtifact@0
151
+ - task : PublishPipelineArtifact@1
116
152
displayName : Publish Content API artifact
153
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
117
154
inputs :
118
155
artifactName : content-api
119
156
targetPath : $(Build.ArtifactStagingDirectory)/content-api
@@ -126,7 +163,6 @@ jobs:
126
163
projects : ' **/GovUk.Education.ExploreEducationStatistics.Public.Data.Api.csproj'
127
164
arguments : -r linux-musl-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/public-api
128
165
zipAfterPublish : False
129
-
130
166
- task : Docker@2
131
167
displayName : Build Public API Docker image
132
168
condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
@@ -160,8 +196,9 @@ jobs:
160
196
arguments : --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/public-api-data-processor
161
197
zipAfterPublish : True
162
198
163
- - task : PublishPipelineArtifact@0
199
+ - task : PublishPipelineArtifact@1
164
200
displayName : Publish Public API Data Processor artifact
201
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
165
202
inputs :
166
203
artifactName : public-api-data-processor
167
204
targetPath : $(Build.ArtifactStagingDirectory)/public-api-data-processor
@@ -175,8 +212,9 @@ jobs:
175
212
arguments : --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/notifier
176
213
zipAfterPublish : True
177
214
178
- - task : PublishPipelineArtifact@0
215
+ - task : PublishPipelineArtifact@1
179
216
displayName : Publish Notifier artifact
217
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
180
218
inputs :
181
219
artifactName : notifier
182
220
targetPath : $(Build.ArtifactStagingDirectory)/notifier
@@ -190,8 +228,9 @@ jobs:
190
228
arguments : --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/publisher
191
229
zipAfterPublish : True
192
230
193
- - task : PublishPipelineArtifact@0
231
+ - task : PublishPipelineArtifact@1
194
232
displayName : Publish Publisher artifact
233
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
195
234
inputs :
196
235
artifactName : publisher
197
236
targetPath : $(Build.ArtifactStagingDirectory)/publisher
@@ -205,8 +244,9 @@ jobs:
205
244
arguments : --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)/processor
206
245
zipAfterPublish : True
207
246
208
- - task : PublishPipelineArtifact@0
247
+ - task : PublishPipelineArtifact@1
209
248
displayName : Publish Processor artifact
249
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
210
250
inputs :
211
251
artifactName : processor
212
252
targetPath : $(Build.ArtifactStagingDirectory)/processor
@@ -229,9 +269,9 @@ jobs:
229
269
script : corepack enable
230
270
231
271
- task : UseDotNet@2
232
- displayName : Install .NET 8.0 SDK
272
+ displayName : Install .NET $(DotNetVersion)
233
273
inputs :
234
- version : 8.0.x
274
+ version : $(DotNetVersion)
235
275
performMultiLevelLookup : true
236
276
237
277
- task : DotNetCoreCLI@2
@@ -267,13 +307,15 @@ jobs:
267
307
268
308
- task : DotNetCoreCLI@2
269
309
displayName : Package Admin app
310
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
270
311
inputs :
271
312
command : publish
272
313
publishWebProjects : false
273
314
projects : ' **/GovUk.Education.ExploreEducationStatistics.Admin.csproj'
274
315
arguments : --self-contained true -r win-x64 --configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)
275
316
276
- - task : PublishPipelineArtifact@0
317
+ - task : PublishPipelineArtifact@1
318
+ condition : and(succeeded(), eq(variables.IsBranchDeployable, true))
277
319
displayName : Publish Admin artifact
278
320
inputs :
279
321
artifactName : admin
@@ -387,22 +429,44 @@ jobs:
387
429
inputs :
388
430
versionSpec : ' >= $(RubyVersion)'
389
431
432
+ - task : Cache@2
433
+ displayName : Cache Gems
434
+ inputs :
435
+ key : ' gems | "$(Agent.OS)" | $(WorkingDirectory)/Gemfile.lock'
436
+ path : $(WorkingDirectory)/vendor
437
+ restoreKeys : |
438
+ gems | "$(Agent.OS)"
439
+ gems
440
+
441
+ - task : Bash@3
442
+ displayName : Set deployment config
443
+ inputs :
444
+ workingDirectory : $(WorkingDirectory)
445
+ targetType : inline
446
+ script : bundle config set deployment true
447
+
448
+ - task : Bash@3
449
+ displayName : Install Gems
450
+ inputs :
451
+ workingDirectory : $(WorkingDirectory)
452
+ targetType : inline
453
+ script : bundle install
454
+
390
455
- task : Bash@3
391
456
displayName : Build
392
- env :
393
- TECH_DOCS_API_URL : https://dev.statistics.api.education.gov.uk
394
457
inputs :
395
458
workingDirectory : $(WorkingDirectory)
396
459
targetType : inline
397
- script : |
398
- bundle install
460
+ script : |
399
461
bundle exec middleman build
462
+ # Remove afterwards as we don't want it in the artifact
463
+ rm -rf build
400
464
401
465
- task : PublishPipelineArtifact@1
402
- displayName : Publish artifact
466
+ displayName : Publish Public API docs artifact
403
467
inputs :
404
468
artifactName : public-api-docs
405
- targetPath : $(WorkingDirectory)/build
469
+ targetPath : $(System.DefaultWorkingDirectory)/src/$(PublicApiDocsDir)
406
470
407
471
- job : MiscellaneousArtifacts
408
472
pool :
0 commit comments