jenkinsci / github-pr-coverage-status-plugin

Nice test coverage icon for your pull requests just from Jenkins
https://plugins.jenkins.io/github-pr-coverage-status/
Apache License 2.0
93 stars 101 forks source link
adopt-this-plugin badge coverage jenkins-plugin pull-requests

GitHub Pull Request Coverage Status Plugin for Jenkins

Code coverage icon for GitHub pull requests

Build Status

Overview

Parse code coverage report generated by build and post code coverage status comment to GitHub pull request: Example

Supports coverage reports

How to use

Install Plugin

Configure access to GitHub

Configure master coverage source

To be able compare Pull Request coverage plugin needs master coverage for GitHub repository.

Jenkins build

Sonar

You have the option to get the master coverage (base coverage) from your SonarQube instance. Otherwise the plugin will keep track of the master coverage in the project configuration file.

The plugin will try to find the project in SonarQube based on the repository name. If more than one projects match, a warning is logged, and the first one will be used to get the coverage data.

Publish coverage for pull request

Depends on plugin which you are using to run (trigger) pull request in Jenkins.

GitHub Pull Request Builder Plugin

Branch API Plugin

Other

How to use with Jenkins Pipelines

No coverage picture and my Jenkins is in private network and not accessible for GitHub

Because of that GitHub can't render icon picture hosted on Jenkins. Plugin can use http://shields.io public resource instead of Jenkins hosted picture. To use it:

No coverage picture on GitHub Pull Request Page

If you see next picture on your pull request in GitHub:

No coverage picture

In most cases that mean that your Jenkins runs on http instead of https Plugin uses same protocol as your Jenkins, however GitHub in most cases accessible by https Default browser policy to block non secure resources on secure pages from unknown domain.

To fix that:

  1. Configure Jenkins to be accessible for https https://jenkins.io/doc/book/installing/#configuring-http
  2. Next you have a few options:
    • Run your Jenkins on https only
    • Or configure plugin to publish link on picture over https
    • Open Jenkins
    • Click Manage Jenkins
    • Click Configure System
      • Find section Coverage status for GitHub Pull Requests
      • Find property Jenkins URL for icon in Pull Request
      • Put URL to your Jenkins with https like https://jenkins.my.com
      • Save
    • Restart Jenkins

Plugin settings

Changelog

2.1.1

2.1.0

2.0.0

1.10.0

1.9.1

1.9.0

1.8.2

1.8.0

1.7.1

1.7.0

1.6.1

1.6.0

1.5.0

Supporting Master Coverage from SonarQube. Check (details)[#master-coverage-from-sonar]

1.4.0

Supporting of private Jenkins with public GitHub. To enable that mode goto Jenkins Configuration and turn on Jenkins is not accessible for GitHub

1.3.0

Add support SimpleCov JSON coverage report for Ruby

1.2.0

Add alternative text to coverage image for case when GitHub doesn't able to show image

1.1.1

Correct parsing Cobertura report for edge cases

1.0.8

First public release to Jenkins Plugin Repo