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>
This commit is contained in:
dotasek 2023-05-24 13:09:13 -04:00 committed by GitHub
parent 8f52ad8fe8
commit 55ac916133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 332 additions and 205 deletions

View File

@ -1,10 +0,0 @@
parameters:
- name: targetModule
displayName: 'Target module in project'
type: string
steps:
- task: Cache@2
inputs:
key: maven | $(Build.BuildId) | targets | "${{ parameters.targetModule }}"
path: $(System.DefaultWorkingDirectory)/${{ parameters.targetModule }}/target/

View File

@ -0,0 +1,7 @@
steps:
- ${{ each value in parameters.modules }}:
- task: Cache@2
displayName: Cache ${{ value }} target
inputs:
key: maven | $(Build.BuildId) | targets | "${{ value }}"
path: $(System.DefaultWorkingDirectory)/${{ value }}/target/

View File

@ -10,13 +10,12 @@ import java.util.stream.Stream;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.r5.DiffUtils;
import org.hl7.fhir.r5.conformance.profile.BindingResolution;
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
@ -47,13 +46,13 @@ import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.CommonPackages;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager.FilesystemPackageCacheMode;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
@ -62,7 +61,7 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
public class SnapShotGenerationTests {
public enum TestFetchMode {
INPUT,
OUTPUT,

View File

@ -9,7 +9,7 @@ import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.hl7.fhir.convertors.loaders.XVersionLoader;
import org.hl7.fhir.exceptions.DefinitionException;
@ -44,6 +44,7 @@ import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.w3c.dom.Document;

View File

@ -1,7 +1,5 @@
package org.hl7.fhir.validation.tests;
import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -11,7 +9,7 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@ -23,7 +21,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.hl7.fhir.utilities.*;
import org.hl7.fhir.utilities.tests.CacheVerificationLogger;
import org.hl7.fhir.validation.tests.ValidationTests.TestSorter;
import org.hl7.fhir.validation.tests.utilities.TestUtilities;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50;

127
pom.xml
View File

@ -170,6 +170,52 @@
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco_version}</version>
<configuration>
<excludes>
<!-- These are auto-generated files that will exceed the JVM limit on file size.
If these are not excluded Jacoco complains and won't run the validator tests. -->
<exclude>org/hl7/fhir/r5/terminologies/JurisdictionUtilities</exclude>
<exclude>org/hl7/fhir/r5/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r5/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4b/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r4b/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r4/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4/**/*</exclude>
<exclude>org/hl7/fhir/dstu3/**/*</exclude>
<exclude>org/hl7/fhir/dstu2/**/*</exclude>
<exclude>org/hl7/fhir/dstu2016may/**/*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven_surefire_version}</version>
<configuration>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<parallel>classes</parallel>
<trimStackTrace>false</trimStackTrace>
<testFailureIgnore>false</testFailureIgnore>
<!-- We need to include the ${argLine} here so the Jacoco test arguments are included in the
Surefire testing run. This may appear as an error in some IDEs, but it will run regardless.
-->
<argLine>@{argLine} -Xmx5632m</argLine>
<systemPropertyVariables>
<java.locale.providers>COMPAT</java.locale.providers>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -362,43 +408,7 @@
<skipUpdateLicense>true</skipUpdateLicense>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco_version}</version>
<configuration>
<excludes>
<!-- These are auto-generated files that will exceed the JVM limit on file size.
If these are not excluded, Jacoco complains and won't run the validator tests. -->
<exclude>org/hl7/fhir/r5/terminologies/JurisdictionUtilities</exclude>
<exclude>org/hl7/fhir/r5/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r5/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4b/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r4b/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4/formats/JsonParser</exclude>
<exclude>org/hl7/fhir/r4/formats/XmlParser</exclude>
<exclude>org/hl7/fhir/r4/**/*</exclude>
<exclude>org/hl7/fhir/dstu3/**/*</exclude>
<exclude>org/hl7/fhir/dstu2/**/*</exclude>
<exclude>org/hl7/fhir/dstu2016may/**/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
@ -431,6 +441,28 @@
</build>
<profiles>
<profile>
<id>JACOCO</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<dumpOnExit>true</dumpOnExit>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>surefire-java-9-plus</id>
<activation>
@ -439,25 +471,10 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven_surefire_version}</version>
<configuration>
<forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory"/>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<parallel>classes</parallel>
<trimStackTrace>false</trimStackTrace>
<testFailureIgnore>false</testFailureIgnore>
<!-- We need to include the ${argLine} here so the Jacoco test arguments are included in the
Surefire testing run. This may appear as an error in some IDEs, but it will run regardless.
-->
<argLine>${argLine} -Xmx5632m</argLine>
<systemPropertyVariables>
<java.locale.providers>COMPAT</java.locale.providers>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
</configuration>
</plugin>
</plugin>
</plugins>
</build>
</profile>

View File

@ -1,61 +0,0 @@
jobs:
- ${{ each image in parameters.images }}:
- job:
dependsOn: [ 'setup' ]
displayName: ${{image.displayName}}
pool:
vmImage: ${{image.vmImage}}
variables:
currentImage: ${{image.vmImage}}
currentName: ${{image.displayName}}
codecov: $(CODECOV_TOKEN)
VERSION:
JAVA_TOOL_OPTIONS: ${{image.javaToolOptions}}
skipJaCoCo: $[not(eq(variables['currentName'], 'ubuntu-latest-java-11'))]
steps:
- task: Cache@2
inputs:
key: maven | $(Build.BuildId)
path: $(MAVEN_CACHE_FOLDER)
# Runs 'mvn install'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Djacoco.skip=$(skipJaCoCo)'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{image.jdkVersion}}'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'install'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{image.jdkVersion}}'
jdkArchitectureOption: 'x64'
options: '-pl org.hl7.fhir.validation.cli -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
publishJUnitResults: false
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'exec:exec'
# Upload test results to codecov
- script: bash <(curl https://codecov.io/bash) -t $(codecov)
displayName: 'codecov Bash Uploader'
condition: eq(variables.skipJaCoCo, false)
# Publishes the test results to build artifacts.
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results'
condition: eq(variables.skipJaCoCo, false)
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/'

View File

@ -1,79 +1,170 @@
variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
trigger: none
pr:
- master
- release
# Different users have different machine setups, we run the build three times, on ubuntu, osx, and windows.
# Azure doesn't always have the same Java versions on each system, so they are enumerated for each system independently.
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:
- job: setup
displayName: cache-maven-dependencies
- 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
- task: Cache@2
inputs:
key: maven | $(Build.BuildId)
path: $(MAVEN_CACHE_FOLDER)
- task: Bash@3
inputs:
targetType: 'inline'
script: mkdir -p $(MAVEN_CACHE_FOLDER); pwd; ls -al $(MAVEN_CACHE_FOLDER)
- ${{ 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: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
options: '-P JACOCO'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'dependency:resolve'
- task: Maven@3
goals: 'jacoco:report-aggregate'
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results'
inputs:
mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-Xmx4096m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'dependency:resolve-plugins'
- template: pull-request-pipeline-parameterized.yml
parameters:
images:
# This image is here so that at least one job specifically sets Cp1252 file encodings, which are normally set by the JDK (which Azure can change on each latest image)
- displayName: ubuntu-latest-java-17-cp1252
vmImage: ubuntu-latest
jdkVersion: 1.17
javaToolOptions: -Dfile.encoding=Cp1252
- displayName: ubuntu-latest-java-11
vmImage: ubuntu-latest
jdkVersion: 1.11
javaToolOptions:
- displayName: ubuntu-latest-java-17
vmImage: ubuntu-latest
jdkVersion: 1.17
javaToolOptions:
- displayName: macos-latest-java-11
vmImage: macos-latest
jdkVersion: 1.11
javaToolOptions:
- displayName: macos-latest-java-17
vmImage: macos-latest
jdkVersion: 1.17
javaToolOptions:
- displayName: windows-latest-java-11
vmImage: windows-latest
jdkVersion: 1.11
javaToolOptions:
- displayName: windows-latest-java-17
vmImage: windows-latest
jdkVersion: 1.17
javaToolOptions:
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'

View File

@ -1,23 +1,20 @@
trigger: none
pool:
vmImage: ubuntu-latest
jobs:
- job: setup
displayName: cache-maven-dependencies
displayName: Cache Maven Artifacts and Build Targets
pool:
vmImage: ubuntu-latest
steps:
- checkout: self
fetchDepth: 1
- task: Cache@2
displayName: Cache maven artifacts
inputs:
key: maven | $(Build.BuildId) | artifacts
path: $(MAVEN_CACHE_FOLDER)
- template: cache-target-directory-task.yml
- template: cache-target-tasks-template.yml
parameters:
targetModule: org.hl7.fhir.convertors
modules:
${{ parameters.modulesToCache }}
- task: Bash@3
inputs:
targetType: 'inline'
@ -31,4 +28,4 @@ jobs:
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'install'
goals: 'install'

View File

@ -0,0 +1,31 @@
jobs:
- ${{ each unit in parameters.testUnits }}:
- job:
dependsOn: [ 'setup' ]
displayName: Test validator-cli.jar execution on ${{unit.name}}
pool:
vmImage: ${{unit.vmImage}}
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:
- org.hl7.fhir.validation.cli
# Runs 'mvn exec'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{unit.jdkVersion}}'
jdkArchitectureOption: 'x64'
options: '-pl org.hl7.fhir.validation.cli -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
publishJUnitResults: false
goals: 'exec:exec'

View File

@ -0,0 +1,57 @@
jobs:
- ${{ each unit in parameters.testUnits }}:
- ${{ each value in unit.modules }}:
- job: ${{unit.name}}_${{value}}
dependsOn: [ 'setup' ]
displayName: Test ${{value}} on ${{unit.name}}
pool:
vmImage: ${{unit.vmImage}}
variables:
JAVA_TOOL_OPTIONS: ${{unit.javaToolOptions}}
skipJaCoCo: $[eq(${{unit.skipJaCoCo}}, true)]
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:
- org.hl7.fhir.${{ value }}
# Runs 'mvn install'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -pl org.hl7.fhir.${{value}} -Djacoco.skip=${{unit.skipJaCoCo}} -P JACOCO'
mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{unit.jdkVersion}}'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'verify jacoco:report'
- task: CopyFiles@2
condition: eq(variables.skipJaCoCo, false)
inputs:
sourceFolder: '$(System.DefaultWorkingDirectory)/'
contents: '**/target/*-reports/*.txt'
targetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Full Test Output'
condition: eq(variables.skipJaCoCo, false)
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/'
artifactName: '${{value}}_full_logs_$(Build.BuildId)_$(Build.BuildNumber)_$(System.JobId).zip'
- task: PublishBuildArtifacts@1
displayName: 'Publish generated build files'
condition: eq(variables.skipJaCoCo, false)
continueOnError: true
inputs:
pathToPublish: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.${{ value }}/target/'
parallel: true
artifactName: 'org.hl7.fhir.${{ value }}_target'