Skip to content

Process jacoco reports and print the code coverage to the Azure DevOps

License

Notifications You must be signed in to change notification settings

intermedia-net/printcoverage

Repository files navigation

PrintCoverage

PrintCoverage plugin allows you easily integrate coverage badge into your Azure DevOps pull requests!

Build Status License: MIT

How to use

In the module build.gradle:

plugins {
    id('com.intermedia.printcoverage').version('0.0.2')
}

import com.intermedia.printcoverage.azure.AzurePrinterFactory
import com.intermedia.printcoverage.azure.AzureRepo

printCoverage {
    setPrinterFactory(
            new AzurePrinterFactory(
                    new AzureRepo(
                            "<azure token>",
                            "<azure base url>",
                            "<azure organization>" ,
                            "<azure project>",
                            "<azure repo>"
                    )
            )
    )
    setJacocoReportFile(file("${project.buildDir}/outputs/jacoco/report.xml"))
}

Where azure token is a personal access token with custom scopes:

  • Code (Status)
  • Code (Read & Write)

And then run it in the Azure pipeline as a policy for a target branch:

./gradlew testDebugUnitTest printCoverage

How it works

The plugin processes the jacoco report xml file, analyzes the test coverage stat, and then posts it via Azure DevOps api as a pull request status update.

About

Process jacoco reports and print the code coverage to the Azure DevOps

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages