-
Notifications
You must be signed in to change notification settings - Fork 161
/
master-branch-pipeline.yml
200 lines (181 loc) · 6.49 KB
/
master-branch-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
# This pipeline produces a SNAPSHOT build for each of the sub modules in
# the core library, and publishes them to ossrh.
pr: none
trigger:
- master
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
variables:
- group: PGP_VAR_GROUP
- group: SONATYPE_VAR_GROUP
- group: GIT_VAR_GROUP
- name: MAVEN_CACHE_FOLDER
value: $(Pipeline.Workspace)/.m2/repository
jobs:
- template: setup-and-cache-job-template.yml
parameters:
modulesToCache:
${{ parameters.modulesToCache.modules }}
signArtifacts: true
- template: test-unit-jobs-template.yml
parameters:
testUnits:
- name: ubuntu_java_11
vmImage: "ubuntu-latest"
javaToolOptions:
jdkVersion: 1.11
skipJaCoCo: true
modules:
${{ parameters.modulesToTest.modules }}
- job: deploy_to_sonatype
dependsOn:
- ${{ each module in parameters.modulesToTest.modules }}:
- ubuntu_java_11_${{ module }}
pool:
vmImage: "ubuntu-latest"
steps:
- task: Cache@2
displayName: Cache maven artifacts
inputs:
key: maven | $(Build.BuildId) | artifacts
path: $(MAVEN_CACHE_FOLDER)
- template: cache-target-tasks-template.yml
parameters:
modules:
${{ parameters.modulesToCache.modules }}
- template: setup-signing-tasks-template.yml
# Deploy the SNAPSHOT artifact to sonatype nexus.
# This is done for the master branch merges only.
- task: Maven@4
displayName: 'Deploy to Sonatype staging'
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: jar:jar deploy:deploy
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) --settings $(Agent.TempDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -Dmaven.test.skip -DdeployToSonatype'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
publishJUnitResults: false
- job: deploy_to_github
dependsOn:
- ${{ each module in parameters.modulesToTest.modules }}:
- ubuntu_java_11_${{ module }}
pool:
vmImage: "ubuntu-latest"
steps:
- task: Cache@2
displayName: Cache maven artifacts
inputs:
key: maven | $(Build.BuildId) | artifacts
path: $(MAVEN_CACHE_FOLDER)
- template: cache-target-tasks-template.yml
parameters:
modules:
${{ parameters.modulesToCache.modules }}
- template: setup-signing-tasks-template.yml
# Deploy the SNAPSHOT artifact to GitHub packages.
# This is done for the master branch merges only.
- task: Maven@4
displayName: 'Deploy to GitHub packages'
enabled: false
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: jar:jar deploy:deploy
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) --settings $(Agent.TempDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -Dmaven.test.skip -DdeployToGitHub'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
publishJUnitResults: false
- job: generate_i8n_csv_png_and_commit
dependsOn: setup
#- ${{ each module in parameters.modulesToTest.modules }}:
# - ubuntu_java_11_${{ module }}
variables:
# Normally this test outputs to console. This variable appears as env param
# I18N_COVERAGE_FILE, which tells the test to write the output to a file
# instead.
- name: i18n.coverage.file
value: ../i18n-coverage.csv
pool:
vmImage: "ubuntu-latest"
steps:
# For creating the snapshot release with maven, we need to build a fake settings.xml for it to read from.
# This is done for the master branch merges only.
- task: Cache@2
displayName: Cache maven artifacts
inputs:
key: maven | $(Build.BuildId) | artifacts
path: $(MAVEN_CACHE_FOLDER)
- template: cache-target-tasks-template.yml
parameters:
modules:
${{ parameters.modulesToCache.modules }}
- bash: |
git config --global user.email $(GIT_USER_EMAIL)
git config --global user.name $(GIT_USER_NAME)
displayName: 'Set up git'
# Install pip packages
- bash: |
pip3 install matplotlib
pip3 install numpy
pip3 install pandas
displayName: 'Set up python packages'
- task: Maven@4
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -pl org.hl7.fhir.utilities '
mavenOptions: '-Dtest=I18nCoverageTest#testPhraseCoverage'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
goals: 'surefire:test'
displayName: 'Run i18n coverage test to generate csv'
- task: PythonScript@0
inputs:
scriptSource: 'filePath'
scriptPath: .azure/i18n-coverage-table/generate-i18n-coverage-table.py
arguments:
displayName: 'Make png table from coverage test csv'
# Verify png file generation
- bash: |
ls -l ./i18n-coverage-table.png
- bash: |
git fetch
git checkout master
git status
git add ./i18n-coverage.csv
git add ./i18n-coverage-table.png
git commit . -m "Updating i18n-coverage csv and png table ***NO_CI***"
git push https://$(GIT_PAT)@github.com/hapifhir/org.hl7.fhir.core.git
displayName: 'Push updated csv and plot to git.'