Use v2 of PublishCodeCoverageResults (#1665)

* Use v2 of PublishCodeCoverageResults

* Bump jacoco

* Try including source path for code coverage

* Aggregate sources for code coverage results

* Bump version for passing test

* Try individual source directories

* Parameterize source directories, include parameter for verbose coverage

* Fix syntax
This commit is contained in:
dotasek 2024-07-11 15:10:04 -04:00 committed by GitHub
parent b796400f03
commit 8fb95b49e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 6 deletions

View File

@ -28,7 +28,7 @@
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
<maven_clean_version>3.1.0</maven_clean_version>
<okhttp.version>4.11.0</okhttp.version>
<jacoco_version>0.8.9</jacoco_version>
<jacoco_version>0.8.12</jacoco_version>
<lombok_version>1.18.32</lombok_version>
<byte_buddy_version>1.14.8</byte_buddy_version>
<apache_poi_version>5.2.1</apache_poi_version>

View File

@ -77,6 +77,14 @@ parameters:
jdks:
- 1.11
- 1.17
- name: sourceDirectories
displayName: Source directories for test coverage reporting
type: string
default: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.utilities/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu2/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu2016may/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.dstu3/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r4/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r4b/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.r5/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.convertors/src/main/java/;$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/src/main/java/'
- name: verboseCoverage
displayName: Enable Verbose Coverage Reporting
type: boolean
default: false
variables:
- group: CODECOV_GROUP
@ -156,15 +164,26 @@ jobs:
jdkArchitectureOption: 'x64'
goals: 'jacoco:report-aggregate'
- task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results'
- task: PublishCodeCoverageResults@2
displayName: 'Publish test coverage for Azure'
condition: ${{ eq(parameters.verboseCoverage, 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/'
pathToSources: ${{ parameters.sourceDirectories }}
- task: reportgenerator@5
displayName: 'Publish verbose test coverage for Azure'
condition: ${{ eq(parameters.verboseCoverage, true) }}
inputs:
reports: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'
targetdir: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/'
sourcedirs: ${{ parameters.sourceDirectories }}
publishCodeCoverageResults: true
- 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'
displayName: 'Upload test results to codecov'