Giter Site home page Giter Site logo

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

Contributors

emibcn avatar johanvanhelden avatar jospapepaqt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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

Allow to get other metrics

Allow the user to get a different metric than just elements. For example:

  • statements
  • conditionals
  • methods
  • etc.

Maybe adding a field for selecting that and then using it at PHP like:

$metricName = $argv[3] || 'elements';

# (...)

foreach ($metrics as $metric) {
    $totalElements += (int) $metric[$metricName];
    $checkedElements += (int) $metric['covered' . $metricName];
}

Round decimals in a new output value

Hello again!

It would be nice to tell to the action a maximum number of decimals to show in an output value. Now, I have to add an extra action to round it, when it will be often needed. I think an extra output value its better than the original one, as rounding up may loose desired precision:

$precision = (int) $argv[3];

# [...]

echo '##[set-output name=round;]' . round($coverage, $precision) . PHP_EOL;

And then, in action.yml:

inputs:
#[...]
  precision:
    description: "The precision of the rounded value."
    required: true
    default: "2"
#[...]
outputs:
#[...]
  round:
    description: 'The processed value from the XML file, rounded to `precision` decimals.'
#[...]
  args:
    - ${{ inputs.filename }}
    - ${{ inputs.percentage }}
    - ${{ inputs.precision }}

Export coverage value as GitHub Action Output

Hello!

It would be great to access the calculated value as an aoutput value os the action. It just needs to echo in a fancy way, something like:

echo '##[set-output name=elements;]' . $coverage . PHP_EOL;

Then, this number can be used from next actions, with something like:

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

# Use the output from the `coverage` step
- name: Generate the badge SVG image
  uses: emibcn/badge-action@v1
  id: badge
  with:
    label: 'Coverage'
    status: ${{ steps.coverage.outputs.elements }}
    color: ${{ steps.coverage.outputs.elements > 95 && 'green' || 'red' }}
    path: ./badges/test-coverage.svg

Clarify LICENSE terms

Hi, this seems like a great library I'd like to consider using.
Please clarify the license terms?
Adding a LICENSE.txt would be nice as well.

Empty coverage value

Hi!

Since the upgrade to using $GITHUB_OUTPUT rather than set-output, the outputs from this action have been empty.

At first I thought it may be because of the ## infront of the echo "coverage=50%" >> $GITHUB_OUTPUT, but I changed that and tested it with no luck.

I saw someone else also had this issue, any ideas how to go about fixing this?

    > > No warnings anymore, but I have empty value while trying to access coverage and other values
${{ steps.coverage.outputs.coverage }}

it is now stored in $GITHUB_OUTPUT

echo "${{ env.steps.coverage.outputs.coverage }}" # This will output the coverage

It doesn't work for me as well :(
Also in docs I found that env. should not be used for getting output step value https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-3
But the weird thing they propose to use (and it works for me)

echo "SELECTED_COLOR=green" >> $GITHUB_OUTPUT

But in action logs I see output with ## symbols:

##"coverage=99.438202247191" >> $GITHUB_OUTPUT

Originally posted by @pfy-oleksii-storozhylov in #10 (comment)

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.