forked from microsoft/FHIR-Converter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.yml
265 lines (237 loc) · 8.9 KB
/
release.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: $(Date:yyyyMMdd)$(Rev:.r)
trigger:
- main
pr:
- main
variables:
solution: '**/*.sln'
unitTestProjects: "**/*UnitTests/*.csproj"
publishProject: "**/*Tool/*.csproj"
functionalTests: "**/*FunctionalTests/*.csproj"
buildConfiguration: 'Release'
major: 5
minor: 1
patch: 1
buildnum: $[counter(format('{0}.{1}.{2}',variables['major'],variables['minor'], variables['patch']), 1)]
version: $(major).$(minor).$(patch).$(buildnum)
stages:
- stage: Build
pool:
vmImage: 'windows-2019'
jobs:
- job: Build
steps:
- script: echo $(version)
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: 'restore'
projects: '$(solution)'
arguments: '--configuration $(buildConfiguration)'
feedsToUse: 'select'
vstsFeed: '7621b231-1a7d-4364-935b-2f72b911c43d/a60b7c8b-c6ae-4a8e-bd15-a526b603a1f2'
restoreArguments: '--disable-parallel'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: build
projects: '$(solution)'
arguments: '--configuration $(buildConfiguration) -p:Version=$(version)'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '$(unitTestProjects)'
arguments: '--configuration $(buildConfiguration) --collect "Code coverage"'
nobuild: true
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/main')
displayName: 'component detection'
- task: notice@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/main')
displayName: 'generate NOTICE file'
inputs:
outputformat: 'text'
- task: DownloadBuildArtifacts@0
condition: eq(variables['build.sourceBranch'], 'refs/heads/main')
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'NOTICE.txt'
downloadPath: '$(Build.SourcesDirectory)/bin/notice'
- task: DotNetCoreCLI@2
displayName: 'publish bin'
inputs:
command: 'publish'
projects: '$(publishProject)'
arguments: '--configuration $(buildConfiguration) --output $(Build.SourcesDirectory)/bin/publish'
nobuild: true
publishWebProjects: false
zipAfterPublish: false
- task: DotNetCoreCLI@2
displayName: 'publish github release bin'
inputs:
command: 'publish'
projects: '$(publishProject)'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/bin'
nobuild: true
publishWebProjects: false
zipAfterPublish: true
- task: DotNetCoreCLI@2
displayName: 'publish functional tests'
inputs:
command: 'publish'
projects: '$(functionalTests)'
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)/functionalTests'
nobuild: true
publishWebProjects: false
zipAfterPublish: false
- task: PowerShell@2
displayName: 'inject template version'
inputs:
targetType: 'inline'
script: |
$targetPath = '$(Build.SourcesDirectory)/data/Templates/Hl7v2/Resource/_Provenance.liquid'
(Get-Content $targetPath).replace('TEMPLATE_VERSION_PLACEHOLDER', '$(major).$(minor).$(patch)') | Set-Content $targetPath
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/data/Templates/Hl7v2'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.SourcesDirectory)/data/Templates/Hl7v2DefaultTemplates.tar.gz'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/data/Templates/Ccda'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.SourcesDirectory)/data/Templates/CcdaDefaultTemplates.tar.gz'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/data/Templates/Json'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.SourcesDirectory)/data/Templates/JsonDefaultTemplates.tar.gz'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/data/Templates/Stu3ToR4'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.SourcesDirectory)/data/Templates/Stu3ToR4DefaultTemplates.tar.gz'
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/data/Templates/FhirToHl7v2'
includeRootFolder: false
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.SourcesDirectory)/data/Templates/FhirToHl7v2DefaultTemplates.tar.gz'
- task: CopyFiles@2
displayName: 'copy DefaultTemplates to artifacts'
inputs:
sourceFolder: '$(Build.SourcesDirectory)/data'
targetFolder: '$(Build.ArtifactStagingDirectory)/data'
- task: DotNetCoreCLI@2
displayName: 'dotnet pack nugets'
inputs:
command: custom
custom: pack
arguments: >
--configuration $(buildConfiguration)
--output $(Build.BinariesDirectory)/nupkgs
--no-build
-p:NuspecProperties="version=$(version)"
- task: PublishBuildArtifacts@1
displayName: 'publish nuget artifacts'
inputs:
pathToPublish: '$(Build.BinariesDirectory)/nupkgs'
artifactName: 'nuget'
publishLocation: 'container'
- task: PublishBuildArtifacts@1
displayName: 'publish artifacts'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'FhirConverterBuild'
- stage: FunctionalTests
jobs:
- job: Windows_Functional_Test
pool:
vmImage: 'windows-2019'
continueOnError: false
steps:
- checkout: none #skip checking out the default repository resource
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
artifactName: FhirConverterBuild
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
docker pull wusongrui/registry-windows:2.7.1
docker run --rm -d -p 5000:5000 --name registry wusongrui/registry-windows:2.7.1
displayName: start registry
- script: |
dotnet test FhirConverterBuild/**/*FunctionalTests.dll
displayName: Functional Tests
- task: Docker@2
displayName: stop registry
condition: succeededOrFailed()
inputs:
command: stop
container: registry
- job: OSX_Functional_Test
condition: false # temporarily disabled due to lack of functional Mac agent to support these tests.
pool: CompassMacHosted
continueOnError: false
steps:
- checkout: none #skip checking out the default repository resource
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
artifactName: FhirConverterBuild
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
docker run --rm -d -p 5000:5000 --name registryOSX registry:2
displayName: start registryOSX
- script: |
chmod +x FhirConverterBuild/**/**/oras*
dotnet test FhirConverterBuild/**/*FunctionalTests.dll
displayName: Functional Tests
- task: Docker@2
displayName: stop registryOSX
condition: succeededOrFailed()
inputs:
command: stop
container: registryOSX
#need delete files for self-hosted agent
- task: DeleteFiles@1
inputs:
Contents: '**/*'
- stage: Release
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/main'))
jobs:
- job: publish
pool:
vmImage: 'windows-2019'
steps:
- checkout: none #skip checking out the default repository resource
- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
artifactName: FhirConverterBuild
downloadPath: $(System.DefaultWorkingDirectory)
- task: GithubRelease@0
displayName: 'Create GitHub Release'
inputs:
gitHubConnection: githubpipeline
repositoryName: microsoft/FHIR-Converter
isDraft: true
tagSource: manual
tag: v$(major).$(minor).$(patch)
assets: |
$(System.DefaultWorkingDirectory)/FhirConverterBuild/bin/**
$(System.DefaultWorkingDirectory)/FhirConverterBuild/data/Templates/Hl7v2DefaultTemplates.tar.gz
$(System.DefaultWorkingDirectory)/FhirConverterBuild/data/Templates/CcdaDefaultTemplates.tar.gz
$(System.DefaultWorkingDirectory)/FhirConverterBuild/data/Templates/JsonDefaultTemplates.tar.gz
$(System.DefaultWorkingDirectory)/FhirConverterBuild/data/Templates/Stu3ToR4DefaultTemplates.tar.gz