GithubHelp home page GithubHelp logo

manuelprinz / gradle-print-coverage-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jansauer/gradle-print-coverage-plugin

0.0 1.0 0.0 185 KB

Scraps jacoco test reports and prints the code coverage to the console

Java 6.28% Groovy 93.72%

gradle-print-coverage-plugin's Introduction

Gradle Print Code Coverage Plugin

Scraps jacoco test reports and prints the code coverage to the console. Tools like GitLab can then parse for it for better integration.

For more information see GitLab's documentation on test coverage (examples).

This plugin is a fork from de.jansauer.printcoverage. See the section "Fork" for further information on the reasoning and how to migrate to this plugin.

Getting Started

Add this snippet to your build script.

plugins {
  id 'jacoco'
  id 'de.pinguinkiste.printcoverage' version '3.0.0'
} 

Extend your ci job configuration.

build-gradle:
  stage: build
  script:
    - ./gradlew build printCoverage
  coverage: '/^Coverage:\s(\d+\.\d+%)/'

Tasks

  • printCoverage The one that prints the coverage ;-)

Configuration

printcoverage {
  coverageType = 'INSTRUCTION'
}
  • coverageType: Type of coverage metric to be printed.
    One of 'INSTRUCTION', 'BRANCH', 'LINE', 'COMPLEXITY', 'METHOD' or 'CLASS'
    Default: 'INSTRUCTION'

Publishing Workflow

Every commit on this repository gets tested via GitHub Actions. Commits that are tagged with a semantic version are also automatically published to the gradle plugin directory as a new version.

Fork

This plugin is a fork from Jan Sauer's original plugin, de.jansauer.printcoverage.

Reason

I decided to fork this plugin because the original plugin had a growing list of issues, and I was not able to establish contact with Jan to share the maintenance. Some of its issues are annoying, and some are wasting build time, but it got to a point where it is no longer usable with current Gradle versions. I depend on the plugin myself, and still think it is useful, and wanted to get it up-to-date again.

Migrating to the plugin

Because of the fork, I had to change the plugin identifier and namespace, and bump of the major version because of that. Version 3.0.0 represents these changes. No other modifications on the codebase were made (except building on GitHub Actions instead of CircleCI, as well as minor plugin updates to make the workflows work). If your builds worked before with version 2.0.0 of the original plugin, they should work with version 3.0.0 of this fork.

All changes, like bugfixes, are done after version 3.0.0 version, and will be documented in a changelog. Although I will try my best, not all of those might be backwards compatible. I will document those changes and communicate them via semantic versioning. So if you decide to use a version greater than 3.0.0, please check the documentation and update your build scripts accordingly.

Planned features

  • Make the plugin compatible with Gradle 8+
  • Fix all open issues against the original codebase
  • Support task avoidance / lazy configuration
  • Ensure plugin works properly with build cache
  • Update dependencies to versions without known security issues

Contributing

Pull requests are always welcome. I'm grateful for any help or inspiration.

License and Authors

Copyright 2018, Jan Sauer <[email protected]> (https://jansauer.de)
Copyright 2023, Manuel Prinz <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gradle-print-coverage-plugin's People

Contributors

jansauer avatar manuelprinz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.