Code Monkey home page Code Monkey logo

jacoco-report-publisher's Introduction

typescript-action status

jacoco-report-publisher

Add JaCoCo test results in the push and pull request events. Inspired by Madrapps/jacoco-report and expanded some functionalities.

Usage

Inputs

  • report-paths - [required] comma-separated list of JaCoCo report paths
  • min-overall-instructions-coverage - [optional, default: 0] minimum required for INSTRUCTION coverage for the project, both average and per file
  • min-overall-branch-coverage - [optional, default: 0] minimum required for BRANCH coverage for the project, both average and per file
  • min-modified-files-instructions-coverage - [optional, default: 0] minimum required for INSTRUCTION coverage for the modified files, both average and per file
  • min-modified-files-branch-coverage - [optional, default: 0] minimum required for BRANCH coverage for the modified files, both average and per file
  • pull-request-title - [optional, default: ''] title of the pull request comment to be made
  • update-previous-comment - [optional, default: false] whether to update the previous comment or not; this takes higher precendence than delete-previous-comment option
  • delete-previous-comment - [optional, default: false] whether to delete the previous comment or not
  • github-token - [required] token to use to be used for GitHub API

Outputs

  • overall-instructions-coverage - the overall coverage of the project for INSTRUCTIONS counter
  • overall-branch-coverage - the overall coverage of the project for BRANCH counter
  • modified-files-instructions-coverage - the overall coverage of the modified files for INSTRUCTIONS counter
  • modified-files-branch-coverage - the overall coverage of the modified files for BRANCH counter

Example Workflow

name: Jacoco Code Coverage

on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Check out Code
        uses: actions/checkout@v3

      - name: Set up JDK 17.0
        uses: actions/setup-java@v3
        with:
          distribution: "corretto"
          java-version: 17.0
          cache: "gradle"

      - name: Run Coverage
        run: |
          chmod +x gradlew
          ./gradlew jacocoTestReport

      - name: Add coverage to PR
        id: jacoco
        uses: juliusiglesia/[email protected]
        with:
          report-paths: ${{ github.workspace }}/build/reports/jacoco/test/jacocoTestReport.xml
          github-token: ${{ secrets.GITHUB_TOKEN }}
          min-overall-instructions-coverage: 50
          min-overall-branch-coverage: 50
          min-modified-files-instructions-coverage: 70
          min-modified-files-branch-coverage: 70

Development

 

Prerequisistes:

  1. node v16+

 

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Run the tests ✔️

$ npm test

 PASS  ./index.test.js
  ✓ throws invalid number (3ms)
  ✓ wait 500 ms (504ms)
  ✓ test runs (95ms)

...

Auto-fix linting issues ✔️

$ npm run format

Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run ncc and push the results:

$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1

Note: We recommend using the --license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! 🚀

See the versioning documentation

Validate

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

uses: ./
with:
  report-paths: report
  github-token: token
  min-overall-instructions-coverage: 50
  min-overall-branch-coverage: 50
  min-modified-files-instructions-coverage: 70
  min-modified-files-branch-coverage: 70

See the actions tab for runs of this action! 🚀

Usage:

After testing you can create a v1 tag to reference the stable and latest V1 action

jacoco-report-publisher's People

Contributors

juliusiglesia 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.