org.hl7.fhir.core/pull-request-pipeline.yml

170 lines
5.3 KiB
YAML

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
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@3
inputs:
mavenPomFile: 'pom.xml'
options: '-P JACOCO'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
goals: 'jacoco:report-aggregate'
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results'
inputs:
codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/'
- 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: 'codecov'