From 70f7d77fba34e629039d086e0bd8e17b137f598f Mon Sep 17 00:00:00 2001 From: dotasek Date: Fri, 24 Feb 2023 09:23:45 -0500 Subject: [PATCH 1/3] Refactor PR Pipeline (#1133) * WIP start refactor * Build target jar in OS * Build target jar in OS 2 * Fix codecov and jacoco condition * Shuffle codecov test reporting --------- Co-authored-by: dotasek --- pull-request-pipeline-parameterized.yml | 55 +++++++++++++++++-------- pull-request-pipeline.yml | 28 +++++++++++++ 2 files changed, 65 insertions(+), 18 deletions(-) diff --git a/pull-request-pipeline-parameterized.yml b/pull-request-pipeline-parameterized.yml index 95cc10b12..36086efda 100644 --- a/pull-request-pipeline-parameterized.yml +++ b/pull-request-pipeline-parameterized.yml @@ -1,7 +1,7 @@ jobs: - ${{ each image in parameters.images }}: - job: - + dependsOn: [ 'setup' ] displayName: ${{image.displayName}} pool: @@ -9,23 +9,44 @@ jobs: variables: currentImage: ${{image.vmImage}} + currentName: ${{image.displayName}} codecov: $(CODECOV_TOKEN) VERSION: JAVA_TOOL_OPTIONS: ${{image.javaToolOptions}} steps: - # Runs 'mvn clean install' + - task: Cache@2 + inputs: + key: maven | $(Build.BuildId) + path: $(MAVEN_CACHE_FOLDER) + # Runs 'mvn test' - task: Maven@3 inputs: mavenPomFile: 'pom.xml' + options: '-pl "!org.hl7.fhir.validation.cli" -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' mavenOptions: '-Xmx3072m' javaHomeOption: 'JDKVersion' jdkVersionOption: '${{image.jdkVersion}}' jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' - goals: 'install' + goals: 'test' + # Upload test results to codecov + - script: bash <(curl https://codecov.io/bash) -t $(codecov) + displayName: 'codecov Bash Uploader' + condition: eq(variables.currentName, 'ubuntu-latest-java-11') + + # Publishes the test results to build artifacts. + - task: PublishCodeCoverageResults@1 + displayName: 'Publish JaCoCo test results' + condition: eq(variables.currentName, 'ubuntu-latest-java-11') + 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/' + + # Builds the CLI jar - task: Maven@3 inputs: mavenPomFile: 'pom.xml' @@ -33,21 +54,19 @@ jobs: javaHomeOption: 'JDKVersion' jdkVersionOption: '${{image.jdkVersion}}' jdkArchitectureOption: 'x64' - options: '-pl org.hl7.fhir.validation.cli' + options: '-pl org.hl7.fhir.validation.cli -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' + publishJUnitResults: false + goals: 'install' + + # Executes the CLI jar + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + 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.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/' diff --git a/pull-request-pipeline.yml b/pull-request-pipeline.yml index ad25c2ac7..ce3630186 100644 --- a/pull-request-pipeline.yml +++ b/pull-request-pipeline.yml @@ -1,3 +1,6 @@ +variables: + MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository + trigger: none pr: @@ -7,6 +10,31 @@ pr: # 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. jobs: + - job: setup + displayName: setup-and-cache-build + 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) + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + options: '-pl "!org.hl7.fhir.validation.cli" -DskipTests -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' - template: pull-request-pipeline-parameterized.yml parameters: images: From 76c01a98aab7687a500dc55a047aab13576a4cbd Mon Sep 17 00:00:00 2001 From: dotasek Date: Fri, 24 Feb 2023 15:05:49 -0500 Subject: [PATCH 2/3] Add basic checkstyle plugin config (#1122) Co-authored-by: dotasek --- checkstyle.xml | 27 +++++++++++++++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ org.hl7.fhir.r4/checkstyle_suppressions.xml | 8 ++++++ org.hl7.fhir.r4b/checkstyle_suppressions.xml | 8 ++++++ org.hl7.fhir.r5/checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ .../checkstyle_suppressions.xml | 8 ++++++ pom.xml | 20 +++++++++++--- 13 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 checkstyle.xml create mode 100644 org.hl7.fhir.convertors/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.dstu2/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.dstu2016may/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.dstu3/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.r4/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.r4b/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.r5/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.report/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.utilities/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.validation.cli/checkstyle_suppressions.xml create mode 100644 org.hl7.fhir.validation/checkstyle_suppressions.xml diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 000000000..625428252 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.hl7.fhir.convertors/checkstyle_suppressions.xml b/org.hl7.fhir.convertors/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.convertors/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.dstu2/checkstyle_suppressions.xml b/org.hl7.fhir.dstu2/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.dstu2/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.dstu2016may/checkstyle_suppressions.xml b/org.hl7.fhir.dstu2016may/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.dstu2016may/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.dstu3/checkstyle_suppressions.xml b/org.hl7.fhir.dstu3/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.dstu3/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.r4/checkstyle_suppressions.xml b/org.hl7.fhir.r4/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.r4/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.r4b/checkstyle_suppressions.xml b/org.hl7.fhir.r4b/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.r4b/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.r5/checkstyle_suppressions.xml b/org.hl7.fhir.r5/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.r5/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.report/checkstyle_suppressions.xml b/org.hl7.fhir.report/checkstyle_suppressions.xml new file mode 100644 index 000000000..1c51453aa --- /dev/null +++ b/org.hl7.fhir.report/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.utilities/checkstyle_suppressions.xml b/org.hl7.fhir.utilities/checkstyle_suppressions.xml new file mode 100644 index 000000000..1291bd218 --- /dev/null +++ b/org.hl7.fhir.utilities/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.validation.cli/checkstyle_suppressions.xml b/org.hl7.fhir.validation.cli/checkstyle_suppressions.xml new file mode 100644 index 000000000..1291bd218 --- /dev/null +++ b/org.hl7.fhir.validation.cli/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/org.hl7.fhir.validation/checkstyle_suppressions.xml b/org.hl7.fhir.validation/checkstyle_suppressions.xml new file mode 100644 index 000000000..1291bd218 --- /dev/null +++ b/org.hl7.fhir.validation/checkstyle_suppressions.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/pom.xml b/pom.xml index 2704139c6..7d6d344c6 100644 --- a/pom.xml +++ b/pom.xml @@ -184,9 +184,22 @@ org.apache.maven.plugins maven-checkstyle-plugin - - true - + + + process-sources + + checkstyle + + + true + ${project.basedir}/checkstyle_suppressions.xml + true + true + true + ${project.basedir}/../checkstyle.xml + + + org.apache.maven.plugins @@ -417,6 +430,7 @@ + From d2dc479a23c71794a0538c6581b7cc1606989834 Mon Sep 17 00:00:00 2001 From: dotasek Date: Fri, 24 Feb 2023 22:11:43 -0500 Subject: [PATCH 3/3] PR Build Refactor 2 (#1137) * Only resolve dependencies and plugins in the first stage * Switch back to maven install task but hopefully with cached maven repo * try switching codecov to informational * Use proper skipStaging config --------- Co-authored-by: dotasek --- codecov.yml | 8 +++++ org.hl7.fhir.report/pom.xml | 2 +- pull-request-pipeline-parameterized.yml | 42 +++++++++---------------- pull-request-pipeline.yml | 16 ++++++++-- 4 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..a793f5919 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: + informational: true + patch: + default: + informational: true \ No newline at end of file diff --git a/org.hl7.fhir.report/pom.xml b/org.hl7.fhir.report/pom.xml index 51cdbd3e9..0d1a6fcc8 100644 --- a/org.hl7.fhir.report/pom.xml +++ b/org.hl7.fhir.report/pom.xml @@ -90,7 +90,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - true + true diff --git a/pull-request-pipeline-parameterized.yml b/pull-request-pipeline-parameterized.yml index 36086efda..e283de225 100644 --- a/pull-request-pipeline-parameterized.yml +++ b/pull-request-pipeline-parameterized.yml @@ -19,18 +19,30 @@ jobs: inputs: key: maven | $(Build.BuildId) path: $(MAVEN_CACHE_FOLDER) - # Runs 'mvn test' + # Runs 'mvn install' - task: Maven@3 inputs: mavenPomFile: 'pom.xml' - options: '-pl "!org.hl7.fhir.validation.cli" -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' + options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' mavenOptions: '-Xmx3072m' javaHomeOption: 'JDKVersion' jdkVersionOption: '${{image.jdkVersion}}' jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/surefire-reports/TEST-*.xml' - goals: 'test' + goals: 'install' + + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + 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) @@ -46,27 +58,3 @@ jobs: summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml' reportDirectory: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/' - # Builds the CLI jar - - task: Maven@3 - inputs: - mavenPomFile: 'pom.xml' - mavenOptions: '-Xmx3072m' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '${{image.jdkVersion}}' - jdkArchitectureOption: 'x64' - options: '-pl org.hl7.fhir.validation.cli -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - publishJUnitResults: false - goals: 'install' - - # Executes the CLI jar - - task: Maven@3 - inputs: - mavenPomFile: 'pom.xml' - mavenOptions: '-Xmx3072m' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '${{image.jdkVersion}}' - jdkArchitectureOption: 'x64' - options: '-pl org.hl7.fhir.validation.cli -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' - publishJUnitResults: false - goals: 'exec:exec' - diff --git a/pull-request-pipeline.yml b/pull-request-pipeline.yml index ce3630186..c5df1978f 100644 --- a/pull-request-pipeline.yml +++ b/pull-request-pipeline.yml @@ -11,7 +11,7 @@ pr: # Azure doesn't always have the same Java versions on each system, so they are enumerated for each system independently. jobs: - job: setup - displayName: setup-and-cache-build + displayName: cache-maven-dependencies pool: vmImage: ubuntu-latest steps: @@ -28,13 +28,23 @@ jobs: - task: Maven@3 inputs: mavenPomFile: 'pom.xml' + options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' mavenOptions: '-Xmx3072m' - options: '-pl "!org.hl7.fhir.validation.cli" -DskipTests -Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'install' + goals: 'dependency:resolve' + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'dependency:resolve-plugins' - template: pull-request-pipeline-parameterized.yml parameters: images: