{"id":15045372,"url":"https://github.com/jenkinsci/github-coverage-reporter-plugin","last_synced_at":"2025-09-30T22:31:23.703Z","repository":{"id":40252214,"uuid":"144305047","full_name":"jenkinsci/github-coverage-reporter-plugin","owner":"jenkinsci","description":"Jenkins plugin for reporting test coverage as a PR status check","archived":false,"fork":true,"pushed_at":"2022-07-08T19:56:21.000Z","size":439,"stargazers_count":27,"open_issues_count":2,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-30T08:11:19.429Z","etag":null,"topics":["coverage","github"],"latest_commit_sha":null,"homepage":"https://plugins.jenkins.io/github-coverage-reporter/","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jnewc/github-coverage-reporter","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-10T15:44:25.000Z","updated_at":"2024-04-29T14:05:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jenkinsci/github-coverage-reporter-plugin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgithub-coverage-reporter-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgithub-coverage-reporter-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgithub-coverage-reporter-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fgithub-coverage-reporter-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/github-coverage-reporter-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234789860,"owners_count":18887044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","github"],"created_at":"2024-09-24T20:51:47.943Z","updated_at":"2025-09-30T22:31:23.357Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","readme":"# GitHub Coverage reporter\n\n[![Build Status](https://travis-ci.org/jnewc/github-coverage-reporter.svg?branch=master)](https://travis-ci.org/jnewc/github-coverage-reporter)\n\nJenkins plugin for reporting code coverage as a GitHub status check.\n\n## Screenshots\n\n![Screenshot of success status](https://raw.githubusercontent.com/jenkinsci/github-coverage-reporter/readme/assets/coverage-success.png)\n\n![Screenshot of failure status](https://raw.githubusercontent.com/jenkinsci/github-coverage-reporter/readme/assets/coverage-failure.png)\n\n# Usage\n\nThis plugin allows you to send status checks to GitHub pull requests, setting\nthe status based on whether it meets or exceeds expectations.\n\nThe base coverage amount against which the PR's coverage amount is compared can\nbe taken from one of two places:\n\n* **SonarQube** - retrieved from the API of your SonarQube instance. The\nSonarQube project can be selected from a list.\n* **Fixed Value** - a fixed coverage amount specified as part of your Jenkins\njob configuration.\n\n**NOTE**: Currently the SonarQube instance must be operating locally and be\naccessible from `localhost:9000`. This will be addressed in a coming release.\nIt is recommended that you proxy to the correct host and/or port if your\nSonarQube instance is hosted elsewhere.\n\n## Configuring the plugin\nGo to **Manage** -\u003e **Configure System** and find the section named\n_GitHub Coverage Reporter_.\n\nFrom here you can configure two fields:\n\n* **GitHub Enterprise URL** (_optional_) - The full url of a GitHub enterprise instance. If left blank, public GitHub is used (i.e. github.com).\n* **GitHub Access Token** (__*required*__) - A valid GitHub API token. The token should have\nsufficient permissions to allow reading target repos and posting statuses to\nthem. If you're not sure how to create a token, read [this](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line).\n\n## Using the plugin\n\nThe plugin provides a post-build action for auditing coverage files and\nposting a GitHub status to your pull request.\n\n![Screenshot of post-build action](https://raw.githubusercontent.com/jenkinsci/github-coverage-reporter/readme/assets/action.png)\n\n1. Specify the path of the coverage file and the type of coverage.\n2. Choose either SonarQube or Fixed Coverage.\n3. If fixed coverage, enter the minimum expected coverage (e.g. 75.0 for 75%).\n\nOpen a PR and check that the job reports the correct status back to GitHub.\n\n## Using the plugin in a Jenkinsfile\n\nYou can also use this plugin as part of Jenkins pipeline (aka Jenkinsfile). You can use it as an extra step, or as a post step.\nFor example for a declarative Jenkinsfile:\n\n```\npipeline {\n    stages {\n    ...\n        stage('Testing...') {\n            steps {\n                ...\n            }\n            post {\n                success {\n                    script {\n                        // if we are in a PR\n                        if (env.CHANGE_ID) {\n                            publishCoverageGithub(filepath:'coverage.xml', coverageXmlType: 'cobertura', comparisonOption: [ value: 'optionFixedCoverage', fixedCoverage: '0.65' ], coverageRateType: 'Line')\n                        }\n                    }\n                }\n            }\n        }\n    ...\n}\n```\n\nor if you want to add step depending on the coverage threshold result:\n```\npipeline {\n    stages {\n    ...\n        stage('Testing...') {\n            steps {\n                ...\n            }\n            post {\n                success {\n                    script {\n                        // if we are in a PR\n                        if (env.CHANGE_ID) {\n                            if (publishCoverageGithub(filepath:'coverage.xml', coverageXmlType: 'cobertura', comparisonOption: [ value: 'optionFixedCoverage', fixedCoverage: '0.65' ], coverageRateType: 'Line')) {\n                                sh \"echo success\"\n                            } else {\n                                sh \"echo failure\"\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    ...\n}\n```\n\nThe different publishCoverageGithub() options are:\n- filepath\n- coverageXmlType: `cobertura`, `jacoco` or `sonarqube`\n- comparisonOption.value: `optionFixedCoverage` or `optionSonarProject`\n- comparisonOption.fixedCoverage (for fixed coverage). It is a percentage between 0.0 (0%) and 1.0 (100%)\n- comparisonOption.sonarProject (for Sonar). Project key name\n- coverageRateType: `Line`, `Branch` or `Overall`\n\n## License\n\nAll code is licensed under [Apache 2.0 License](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgithub-coverage-reporter-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fgithub-coverage-reporter-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fgithub-coverage-reporter-plugin/lists"}