-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
azure-pipelines.yml
144 lines (131 loc) 路 5.8 KB
/
azure-pipelines.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
# HAPI FHIR Build Pipeline
variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
#MAVEN_CACHE_FOLDER: $(Agent.TempDirectory)/.m2/repository
#MAVEN_OPTS: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
MAVEN_OPTS: ''
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: Build
container: maven:3-jdk-11
steps:
# Grab the previous cache
- task: Cache@2
displayName: Get Maven Cache
inputs:
key: 'maven | "$(Agent.OS)" | ./pom.xml | "4"'
path: $(MAVEN_CACHE_FOLDER)
# Build the project fully without tests. At the end of this job, this should be auto-stored in the cache, for future retrieval by subsequent jobs
- task: Maven@3
displayName: Build Project
env:
JAVA_HOME_11_X64: /usr/local/openjdk-11
inputs:
goals: 'clean 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 ALLMODULES,JACOCO,ERRORPRONE,CI -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Dmaven.test.skip"
# 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
# Store this build
- task: PublishPipelineArtifact@1
displayName: 'Store Test Output'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/'
artifactName: 'logs-$(system.jobpositioninphase)'
- job: Test
dependsOn: Build
strategy:
parallel: 3
displayName: Run Tests
timeoutInMinutes: 360
container: maven:3-jdk-11
steps:
- task: Cache@2
inputs:
key: 'maven | "$(Agent.OS)" | ./pom.xml | "4"'
path: $(MAVEN_CACHE_FOLDER)
- task: Bash@3
displayName: Create Maven Cache
inputs:
targetType: 'inline'
script: mkdir -p $(MAVEN_CACHE_FOLDER); pwd; ls -al $(MAVEN_CACHE_FOLDER)
- task: Bash@3
displayName: Determine Target Modules
inputs:
targetType: 'filePath'
filePath: 'slice_modules.sh'
- task: Maven@3
env:
JAVA_HOME_11_X64: /usr/local/openjdk-11
inputs:
goals: 'clean 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 ALLMODULES,JACOCO,CI,ERRORPRONE -e -B -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -pl :$(slicedModules)"
# 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
# - script: bash <(curl https://codecov.io/bash) -t $(CODECOV_TOKEN)
# displayName: 'codecov'
# Copy test results into a sane location
- task: CopyFiles@2
condition: always()
inputs:
sourceFolder: '$(System.DefaultWorkingDirectory)/'
contents: |
**/surefire-reports/**
**/failsafe-reports/**
targetFolder: '$(Build.ArtifactStagingDirectory)'
# Publish artifact containing test results.
- task: PublishPipelineArtifact@1
displayName: 'Store Test Output'
condition: always()
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/'
artifactName: 'logs-$(system.jobpositioninphase)'
# Amalgamate the test results, and report them.
- job: Report
dependsOn: Test
condition: always()
displayName: Report Results
container: maven:3-jdk-11
steps:
- task: DownloadPipelineArtifact@2
displayName: Download logs
- task: Bash@3
displayName: PWD
inputs:
targetType: 'inline'
script: pwd; ls -al $(Pipeline.Workspace)
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: $(System.DefaultWorkingDirectory)/hapi-fhir-jacoco/target/site/jacoco-report/jacoco.xml
reportDirectory: $(System.DefaultWorkingDirectory)/hapi-fhir-jacoco/target/site/jacoco-report/
failIfCoverageEmpty: false
# Potential Additional Maven3 Options:
#publishJUnitResults: true
#testResultsFiles: '**/surefire-reports/TEST-*.xml' # Required when publishJUnitResults == True
#testRunTitle: # Optional
#codeCoverageToolOption: 'None' # Optional. Options: none, cobertura, jaCoCo. Enabling code coverage inserts the `clean` goal into the Maven goals list when Maven runs.
#codeCoverageClassFilter: # Optional. Comma-separated list of filters to include or exclude classes from collecting code coverage. For example: +:com.*,+:org.*,-:my.app*.*
#codeCoverageClassFilesDirectories: # Optional
#codeCoverageSourceDirectories: # Optional
#codeCoverageFailIfEmpty: false # Optional
#javaHomeOption: 'JDKVersion' # Options: jDKVersion, path
#jdkVersionOption: 'default' # Optional. Options: default, 1.11, 1.10, 1.9, 1.8, 1.7, 1.6
#jdkDirectory: # Required when javaHomeOption == Path
#jdkArchitectureOption: 'x64' # Optional. Options: x86, x64
#mavenVersionOption: 'Default' # Options: default, path
#mavenDirectory: # Required when mavenVersionOption == Path
#mavenSetM2Home: false # Required when mavenVersionOption == Path
#mavenAuthenticateFeed: false
#effectivePomSkip: false
#sonarQubeRunAnalysis: false
#sqMavenPluginVersionChoice: 'latest' # Required when sonarQubeRunAnalysis == True# Options: latest, pom
#checkStyleRunAnalysis: false # Optional
#pmdRunAnalysis: false # Optional
#findBugsRunAnalysis: false # Optional