Update maven config and tests to allow Java 8, 11 and 17 builds (#653)

* Updates to enable Java 8, 11, and 17 builds

* Set surefire args according to profile + update jacoco verison

* Add comments for surefire profile args.

* Temporarily skip failing test

* Object based parameters ***NO_CI***

* Cleanup skipped test, move new pipeline codo

* Update validator_test_case_version
This commit is contained in:
dotasek 2021-11-16 09:26:53 -05:00 committed by GitHub
parent d483a7dbc3
commit cccf1cebae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 84 additions and 96 deletions

View File

@ -89,7 +89,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<version>${lombok_version}</version>
<scope>provided</scope>
</dependency>

View File

@ -21,7 +21,7 @@ import java.io.*;
public class ResourceRoundTripTests {
@BeforeAll
public void setUp() throws Exception {
public static void setUp() throws Exception {
}
@Test

View File

@ -653,6 +653,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
http.trustAllhosts();
HTTPResult res = http.get("https://build.fhir.org/ig/qas.json?nocache=" + System.currentTimeMillis());
res.checkThrowException();
buildInfo = (JsonArray) new com.google.gson.JsonParser().parse(TextFile.bytesToString(res.getContent()));
List<BuildRecord> builds = new ArrayList<>();

View File

@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*;
@ -29,7 +30,7 @@ class UtilitiesTest {
public static final String WIN_JAVA_HOME = System.getenv("JAVA_HOME") + "\\";
public static final String OSX_USER_DIR = System.getProperty("user.home") + "/";
public static final String OSX_JAVA_HOME = System.getenv("JAVA_HOME");
public static final String OSX_JAVA_HOME = Paths.get(System.getenv("JAVA_HOME")).normalize().toString() + "/";
@Test
@DisplayName("Test Utilities.path maps temp directory correctly")

View File

@ -155,7 +155,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<version>${lombok_version}</version>
<scope>provided</scope>
</dependency>

83
pom.xml
View File

@ -22,9 +22,10 @@
<validator_test_case_version>1.1.74-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version>
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
<jacoco_version>0.8.5</jacoco_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
<jacoco_version>0.8.7</jacoco_version>
<info_cqframework_version>1.5.1</info_cqframework_version>
<lombok_version>1.18.22</lombok_version>
</properties>
<name>HL7 Core Artifacts</name>
@ -195,24 +196,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven_surefire_version}</version>
<configuration>
<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} -Xmx4096m</argLine>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
@ -368,6 +351,66 @@
</build>
<profiles>
<profile>
<id>surefire-java-8</id>
<activation>
<jdk>(,1.8]</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven_surefire_version}</version>
<configuration>
<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.
-->
<!-- UseConcMarkSweepGC is required for Java 8 builds, or else garbage collection will fail
for forked tests -->
<argLine>${argLine} -Xmx4096m -XX:+UseConcMarkSweepGC</argLine>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>surefire-java-9-plus</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven_surefire_version}</version>
<configuration>
<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} -Xmx4096m</argLine>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>github-repo</id>
<activation>

View File

@ -1,15 +1,15 @@
jobs:
- ${{ each imageName in parameters.imageName }}:
- ${{ each jdkVersion in parameters.jdkVersion }}:
- ${{ each image in parameters.images }}:
- ${{ each jdkVersion in image.jdkVersions }}:
- job:
displayName: ${{imageName}}_${{jdkVersion}}
displayName: ${{image.name}}_${{jdkVersion}}
pool:
vmImage: ${{imageName}}
vmImage: ${{image.name}}
variables:
currentImage: ${{imageName}}
currentImage: ${{image.name}}
codecov: $(CODECOV_TOKEN)
VERSION:

View File

@ -5,59 +5,13 @@ pr:
- release
# Different users have different machine setups, we run the build three times, on ubuntu, osx, and windows
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: "macos-latest"
windows:
imageName: "windows-2019"
maxParallel: 3
pool:
vmImage: $(imageName)
variables:
currentImage: $(imageName)
codecov: $(CODECOV_TOKEN)
VERSION:
steps:
# Runs 'mvn clean package'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
options: '-pl org.hl7.fhir.validation.cli'
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.currentImage, 'ubuntu-latest')
# Publishes the test results to build artifacts.
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results'
condition: eq(variables.currentImage, 'ubuntu-latest')
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/'
jobs:
- template: pull-request-pipeline-parameterized.yml
parameters:
images:
- name: ubuntu-latest
jdkVersions: [ '1.8', '1.11' ]
- name: macos-latest
jdkVersions: [ '1.8', '1.11', '1.17']
- name: windows-2019
jdkVersions: [ '1.8', '1.11', '1.17']

View File

@ -1,11 +0,0 @@
trigger: none
pr:
- master
- release
jobs:
- template: pull-request-pipeline-parameterized.yml
parameters:
imageName: [ 'ubuntu-latest', 'macos-latest', 'windows-2019' ]
jdkVersion: [ '1.8', '1.11', '1.17']