org.hl7.fhir.core/pull-request-pipeline.yml
dotasek 55ac916133
Refactor Pull Request Pipeline (#1273)
* Try multiple module target directories

* Try different format

* Try displaying cache task name + multiple caches

* Name the maven artifact cache step + add all modules

* Start consuming cached builds + targets

* Fix job list

* Fix other bad params

* Fix bad indent

* Try test task

* Try different value syntax

* Add all modules

* See if cacheing works from linux to windows

* Refactor as testUnits

* Trim tested modules

* missing colon

* It's not an image anymore, it's a unit

* Test exec

* Test exec for real

* Fix parameters format

* Fix r5 url for package fetch (#1260)

* Fix r5 url for package fetch

* Revert previous commit

* Make r6 the only packages fetched from build.fhir.org

* Update RELEASE_NOTES.md

* Update RELEASE_NOTES.md

* Release: v6.0.6
## Validator Changes

* no changes

## Other code changes

* Update R6 package tgz fetching
***NO_CI***

* Updating version to: 6.0.7-SNAPSHOT and incrementing test cases dependency.

* Try using parameters

* Try another way

* Try third way

* Try fourth way

* Try fifth way

* Try 6

* Try 7

* Apply refactor

* Try iterating over images

* Try iterating over images 2

* Test all images

* Conditionally test multiplatform modules

* Test JDKs too

* Fix and()

* Add JDK image to job names + test JDKs for exec

* Better job name for setup

* Fix names

* more granular test configs

* fix repeated jobs

* name for exec jobs

* fix missing s

* Add placeholder Codecov job

* Fix complaint about job name

* Try moving codecov to test template

* Add explicit module for test

* Try setting up job name

* Try setting up job name

* Change job names to use underscore and alphanum

* Move codecov job back to master-branch

* Fix condition to match ubuntu_java_11

* Publish test reports

* Publish test reports

* use value for artifact name

* Use variable for skipJaCoCo conditions

* Skip validation temporarily

* Change artifact names.

* add jacoco:report-aggregate task

* remove leftover cut and paste line

* Improve test job display name

* Add jacoco results + codecov upload

* Fix accidental inclusions in module loop

* Remove JaCoCo coverage condition

* Bump down JaCoCo plugin

* Rearrange JaCoCo plugin

* Fix surefire and jacoco output

* Add jacoco to pipeline

* Try skipping maven cache step

* Add codecov token

* Add missing MAVEN_CACHE_FOLDER

* Change variable syntax

* Move setup to own template

* Change setup template

* rearrange pipeline yml, re-enable validation test module

* Update core version bumps

* Temporarily disable tests

* Move to PR pipeline + Fix unused pool declaration

* Disable some more.

* Restore disabled and ignored tests

* Fix task name + clean up old prototype

---------

Co-authored-by: markiantorno <markiantorno@gmail.com>
2023-05-24 13:09:13 -04:00

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'