forked from hapifhir/hapi-fhir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-job-template.yml
145 lines (143 loc) · 7.05 KB
/
test-job-template.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
# HAPI FHIR Build Pipeline
parameters:
param: [ ]
jobs:
- job: setup
displayName: setup-and-cache-build
timeoutInMinutes: 60
container: maven:3.9-eclipse-temurin-21-jammy
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 1
- task: Cache@2
inputs:
key: 'maven | "$(Agent.OS)" | "$(Build.SourceVersion)" | ./pom.xml'
path: $(MAVEN_CACHE_FOLDER)
- task: Bash@3
inputs:
targetType: 'inline'
script: mkdir -p $(MAVEN_CACHE_FOLDER); pwd; ls -al $(MAVEN_CACHE_FOLDER)
- task: Maven@3
env:
JAVA_HOME_11_X64: /opt/java/openjdk
inputs:
goals: 'install'
# These are Maven CLI options (and show up in the build logs) - "-nsu"=Don't update snapshots. We can remove this when Maven OSS is more healthy
options: '-P CI,CHECKSTYLE -Dmaven.test.skip -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Dmaven.javadoc.skip=true -Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false -Dstyle.color=always -Djansi.force=true'
# These are JVM options (and don't show up in the build logs)
mavenOptions: '-Xmx1024m $(MAVEN_OPTS) -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto'
jdkVersionOption: 1.11
- ${{ each p in parameters.modules }}:
- job: ${{ p.name }}
timeoutInMinutes: 60
displayName: ${{ p.name }}
dependsOn: [ 'setup' ]
container: maven:3.9-eclipse-temurin-21-jammy
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 1
- script: echo testing module ${{ p.module }}
- script: echo $(SourceBranchName)
- task: [email protected]
displayName: Docker Installer
inputs:
dockerVersion: 17.09.0-ce
releaseType: stable
- task: Cache@2
inputs:
key: 'maven | "$(Agent.OS)" | "$(Build.SourceVersion)" | ./pom.xml'
path: $(MAVEN_CACHE_FOLDER)
- task: Maven@3
env:
JAVA_HOME_11_X64: /opt/java/openjdk
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: 'clean verify jacoco:report -pl ${{ p.module }}'
# These are Maven CLI options (and show up in the build logs) - "-nsu"=Don't update snapshots. We can remove this when Maven OSS is more healthy
options: '-P JACOCO,CI -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Dmaven.wagon.http.pool=false -Dhttp.keepAlive=false -Dstyle.color=always -Djansi.force=true'
# These are JVM options (and don't show up in the build logs)
mavenOptions: '-Xmx1024m $(MAVEN_OPTS) -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto'
jdkVersionOption: 1.11
# Copy testing log files and publish to pipeline run on Azure.
- task: CopyFiles@2
condition: always()
inputs:
sourceFolder: '$(System.DefaultWorkingDirectory)/'
contents: '**/target/*-reports/*.txt'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Full Test Output'
condition: always()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/'
artifactName: '${{p.name}}_full_logs_$(Build.BuildId)_$(Build.BuildNumber)_$(System.JobId).zip'
# Publish target directory
- task: PublishBuildArtifacts@1
displayName: 'Publish generated build files'
continueOnError: true
inputs:
pathToPublish: '$(System.DefaultWorkingDirectory)/${{ p.module }}/target/'
parallel: true
artifactName: '${{ p.name }}_target'
- job:
pool:
vmImage: ubuntu-latest
timeoutInMinutes: 60
displayName: generate_test_reports
container: maven:3.9-eclipse-temurin-21-jammy
dependsOn:
- ${{ each p in parameters.modules }}:
- ${{ p.name }}
steps:
- checkout: self
fetchDepth: 1
- ${{ each p in parameters.modules }}:
- task: Bash@3
inputs:
targetType: 'inline'
script: mkdir -p $(System.DefaultWorkingDirectory)/${{ p.module }}/target/
- task: DownloadBuildArtifacts@0
displayName: 'Download jacoco test coverage result exec file for ${{ p.name }}'
continueOnError: true
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: '${{ p.name }}_target'
downloadPath: '$(System.DefaultWorkingDirectory)/'
# Copy contents from downloaded artifact directory to final target directory.
- task: CopyFiles@2
condition: always()
inputs:
sourceFolder: '$(System.DefaultWorkingDirectory)/${{ p.name }}_target/'
contents: '**'
targetFolder: '$(System.DefaultWorkingDirectory)/${{ p.module }}/target/'
- task: Maven@3
env:
JAVA_HOME_11_X64: /opt/java/openjdk
inputs:
mavenPomFile: '$(System.DefaultWorkingDirectory)/pom.xml'
goals: 'jacoco:report-aggregate'
# These are Maven CLI options (and show up in the build logs) - "-nsu"=Don't update snapshots. We can remove this when Maven OSS is more healthy
options: '-P JACOCO'
# These are JVM options (and don't show up in the build logs)
mavenOptions: '-Xmx1024m $(MAVEN_OPTS) -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto'
jdkVersionOption: 1.11
- bash: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t $(CODECOV_TOKEN) -R hapi-fhir-jacoco/target/site/jacoco-aggregate/
displayName: 'codecov'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: $(System.DefaultWorkingDirectory)/hapi-fhir-jacoco/target/site/jacoco-aggregate/jacoco.xml
reportDirectory: $(System.DefaultWorkingDirectory)/hapi-fhir-jacoco/target/site/jacoco-report/
failIfCoverageEmpty: true