Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 12 commits into from
Nov 16, 2021
Merged
2 changes: 1 addition & 1 deletion org.hl7.fhir.convertors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class ResourceRoundTripTests {

@BeforeAll
public void setUp() throws Exception {
public static void setUp() throws Exception {
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ private void loadFromBuildServer() throws IOException {
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<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Random;

import static org.junit.jupiter.api.Assertions.*;
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion org.hl7.fhir.validation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
83 changes: 63 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
10 changes: 5 additions & 5 deletions pull-request-pipeline-parameterized.yml
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
66 changes: 10 additions & 56 deletions pull-request-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
11 changes: 0 additions & 11 deletions test-java-8-11-17-pipeline.yml

This file was deleted.