-
Notifications
You must be signed in to change notification settings - Fork 165
/
pull-request-pipeline.yml
189 lines (175 loc) · 6.64 KB
/
pull-request-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
trigger: none
pr:
- master
- release
parameters:
- name: modulesToCache
displayName: Module Target Directories to Cache
type: object
default:
modules:
- org.hl7.fhir.utilities
- org.hl7.fhir.dstu2
- org.hl7.fhir.dstu2016may
- org.hl7.fhir.dstu3
- org.hl7.fhir.r4
- org.hl7.fhir.r4b
- org.hl7.fhir.r5
- org.hl7.fhir.convertors
- org.hl7.fhir.validation
- org.hl7.fhir.validation.cli
- org.hl7.fhir.report
- name: modulesToTest
displayName: Modules to Test
type: object
default:
modules:
- utilities
- dstu2
- dstu2016may
- dstu3
- r4
- r4b
- r5
- convertors
- validation
multiplatformModules:
- utilities
- name: testConfigurations
displayName: VM Images and JDKs to Test Against
type: object
default:
configurations:
- name: ubuntu_java_11
image: ubuntu-latest
jdk: 1.11
javaToolOptions:
- name: ubuntu_java_17
image: ubuntu-latest
jdk: 1.17
javaToolOptions:
- name: ubuntu_java_11_cp1252
image: ubuntu-latest
jdk: 1.11
javaToolOptions: -Dfile.encoding=Cp1252
- name: windows_java_11
image: windows-latest
jdk: 1.11
javaToolOptions:
- name: windows_java_17
image: windows-latest
jdk: 1.17
javaToolOptions:
- name: macos_java_11
image: macos-latest
jdk: 1.11
javaToolOptions:
- name: macos_java_17
image: macos-latest
jdk: 1.17
javaToolOptions:
- name: jdksToTest
displayName: JDKs to Test Against
type: object
default:
jdks:
- 1.11
- 1.17
- name: sourceDirectories
displayName: Source directories for test coverage reporting
type: string
default: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.utilities/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu2/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu2016may/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu3/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r4/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r4b/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r5/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.convertors/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/src/main/java/'
- name: verboseCoverage
displayName: Enable Verbose Coverage Reporting
type: boolean
default: false
variables:
- group: CODECOV_GROUP
- name: MAVEN_CACHE_FOLDER
value: $(Pipeline.Workspace)/.m2/repository
jobs:
- template: setup-and-cache-job-template.yml
parameters:
modulesToCache:
${{ parameters.modulesToCache.modules }}
- template: test-unit-jobs-template.yml
parameters:
testUnits:
- ${{ each configuration in parameters.testConfigurations.configurations }}:
- name: ${{ configuration.name }}
vmImage: ${{ configuration.image }}
javaToolOptions: ${{ configuration.javaToolOptions }}
jdkVersion: ${{ configuration.jdk }}
${{ if eq(configuration.name, 'ubuntu_java_11') }}:
skipJaCoCo: false
modules:
${{ parameters.modulesToTest.modules }}
${{ else }}:
skipJaCoCo: true
modules:
${{ parameters.modulesToTest.multiplatformModules }}
- template: test-cli-exec-job-template.yml
parameters:
testUnits:
- ${{ each configuration in parameters.testConfigurations.configurations }}:
- name: ${{ configuration.name }}
vmImage: ${{ configuration.image }}
jdkVersion: ${{ configuration.jdk }}
- job: publish_codecov
dependsOn:
- ${{ each module in parameters.modulesToTest.modules }}:
- ubuntu_java_11_${{ module }}
displayName: Publish Test Results and Coverage
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 1
- ${{ each module in parameters.modulesToTest.modules }}:
- task: Bash@3
inputs:
targetType: 'inline'
script: mkdir -p $(System.DefaultWorkingDirectory)/org.hl7.fhir.${{ module }}/target/
- task: DownloadBuildArtifacts@0
displayName: 'Download jacoco test coverage results for org.hl7.fhir.${{ module }}'
continueOnError: true
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'org.hl7.fhir.${{ module }}_target'
downloadPath: '$(System.DefaultWorkingDirectory)/'
# Copy contents from downloaded artifact directory to final target directory.
- task: CopyFiles@2
condition: always()
inputs:
sourceFolder: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.${{ module }}_target/'
contents: '**'
targetFolder: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.${{ module }}/target/'
- task: Maven@4
inputs:
mavenPomFile: 'pom.xml'
options: '-P JACOCO'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
goals: 'jacoco:report-aggregate'
- task: PublishCodeCoverageResults@2
displayName: 'Publish test coverage for Azure'
condition: ${{ eq(parameters.verboseCoverage, false) }}
inputs:
summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
pathToSources: ${{ parameters.sourceDirectories }}
- task: reportgenerator@5
displayName: 'Publish verbose test coverage for Azure'
condition: ${{ eq(parameters.verboseCoverage, true) }}
inputs:
reports: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
targetdir: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/'
sourcedirs: ${{ parameters.sourceDirectories }}
publishCodeCoverageResults: true
- bash: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t $(CODECOV_TOKEN) -R $(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/
displayName: 'Upload test results to codecov'