Giter Site home page Giter Site logo

gha-clover-test-coverage-check's Introduction

gha-clover-test-coverage-check

A clover test coverage checker for Github Actions.

Usage

Simply add the following step to your workflow:

- name: Check test coverage
  id: test-coverage
  uses: johanvanhelden/gha-clover-test-coverage-check@v1
  with:
    percentage: "95"
    filename: "coverage.xml"

Input

percentage

The minimum percentage of coverage allowed.

filename

The filename of the clover coverage XML file.

rounded-precision (optional)

The precision of the rounded coverage value. Where 0 will round to the highest rounded number (e.g: 99.999999 > 100).

exit (optional)

Wether the coverage check should exit if the required percentage is not met.

Output

Output is exported as GitHub Action output.

You can use it in other steps, for example:

- name: Test coverage
  run: echo "${{ steps.test-coverage.outputs.coverage }}"

Or make a step conditional:

- name: Test coverage report
  if: steps.test-coverage.outputs.coverage > 50
  run: echo "We are more than halfway there!"

coverage

The calculated coverage value.

coverage-display

The calculated coverage value for display purposes.

coverage-rounded

The rounded coverage value.

coverage-rounded-display

The rounded calculated coverage value for display purposes.

coverage-acceptable

The true or false value of the check result. You can use this output with the exit input to implement your own coverage logic.

Generating a coverage report

This is how you can generate a test coverage report using PHPUnit:

- name: Generate code coverage
  run: ./vendor/bin/phpunit --coverage-clover ./coverage.xml

Action Development

You can test the action locally by running: docker-compose up --build Any arguments can be configured in the docker-compose.yml file.

Building and publishing

Building happens automaticly once a new version is tagged.

To push a manual build, ensure you are logged in locally to hub.docker.com using docker login and have access to the hub repository. (note: your username is used, not your email address).

$ docker build ./ --tag johanvanhelden/gha-clover-test-coverage-check:TAG
$ docker push johanvanhelden/gha-clover-test-coverage-check:TAG

Replace TAG with the tag you are working on.

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.