All Projects → barecheck → code-coverage-action

barecheck / code-coverage-action

Licence: MIT license
GitHub Action that generates code coverage reports

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to code-coverage-action

tarpaulin
📈 GitHub Action for code coverage reporting with tarpaulin
Stars: ✭ 69 (+146.43%)
Mutual labels:  coverage, code-coverage, github-actions
jacoco-report
Github action that publishes the JaCoCo report as a comment in the Pull Request
Stars: ✭ 31 (+10.71%)
Mutual labels:  coverage, code-coverage, github-actions
pytest-coverage-comment
Comments a pull request with the pytest code coverage badge and full report
Stars: ✭ 32 (+14.29%)
Mutual labels:  coverage, github-actions
mutant-swarm
Mutation testing framework and code coverage for Hive SQL
Stars: ✭ 20 (-28.57%)
Mutual labels:  coverage, code-coverage
Altcover
Cross-platform coverage gathering and processing tool set for .net/.net core and Mono
Stars: ✭ 344 (+1128.57%)
Mutual labels:  coverage, code-coverage
mylib
Шаблон кросплатформенного CMake-проекта для языка C++ 🇬🇧 Modern CMake crossplatform project template for C++
Stars: ✭ 49 (+75%)
Mutual labels:  coverage, github-actions
jacoco-badge-generator
Coverage badges, and pull request coverage checks, from JaCoCo reports in GitHub Actions
Stars: ✭ 53 (+89.29%)
Mutual labels:  coverage, github-actions
frankencover.it
Code coverage for iOS and OSX.
Stars: ✭ 102 (+264.29%)
Mutual labels:  coverage, code-coverage
ruby-codacy-coverage
DEPRECATED Post coverage results to Codacy
Stars: ✭ 12 (-57.14%)
Mutual labels:  coverage, code-coverage
Single cov
Actionable code coverage.
Stars: ✭ 154 (+450%)
Mutual labels:  coverage, code-coverage
Bashcov
Code coverage tool for Bash
Stars: ✭ 113 (+303.57%)
Mutual labels:  coverage, code-coverage
grcov
📈 GitHub Action for code coverage reporting with grcov
Stars: ✭ 96 (+242.86%)
Mutual labels:  coverage, code-coverage
ghaction-cmake
cmake swiss army knife github docker action
Stars: ✭ 19 (-32.14%)
Mutual labels:  coverage, github-actions
codeclimate-action
GitHub Action to send your code coverage to CodeClimate
Stars: ✭ 145 (+417.86%)
Mutual labels:  coverage, github-actions
Minicover
Cross platform code coverage tool for .NET Core
Stars: ✭ 193 (+589.29%)
Mutual labels:  coverage, code-coverage
instrumentation
Assorted pintools
Stars: ✭ 24 (-14.29%)
Mutual labels:  coverage, code-coverage
Setup Php
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
Stars: ✭ 1,945 (+6846.43%)
Mutual labels:  code-coverage, github-actions
Utplsql
Testing Framework for PL/SQL
Stars: ✭ 402 (+1335.71%)
Mutual labels:  coverage, code-coverage
Coverlet
Cross platform code coverage for .NET
Stars: ✭ 2,303 (+8125%)
Mutual labels:  coverage, code-coverage
Cmake Scripts
A selection of useful scripts for use in CMake projects, include code coverage, sanitizers, and dependency graph generation.
Stars: ✭ 202 (+621.43%)
Mutual labels:  coverage, code-coverage

code-coverage-action

GitHub Action that generates coverage reports

code coverage report success

Installation

  1. Install Barecheck Application
  2. Copy the token provided on the authorization confirmation page and add it to your build environment as BARECHECK_GITHUB_APP_TOKEN
  3. Create Github Actions workflow from the example

Features

Show annotations

As a part of code coverage report action also enable an ability to show annotations along with changed lines to keep control of what is covered with tests without interacting review process

show annotations

Show uncovered files

In the real; world, it's hard to get 100% code coverage and keep it all the time. Instead of showing you all uncovered files Barecheck show only the ones you have changed. code coverage report

Usage

To integrate with this Github Action, you can just use the following configuration in your already created workflow. As a result, you will get Github Pull request comment with total code coverage

- name: Generate Code Coverage report
  id: code-coverage
  uses: barecheck/code-coverage-action@v1
  with:
    barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
    lcov-file: "./coverage/lcov.info"
    base-lcov-file: "./coverage/base-lcov.info"
    send-summary-comment: true
    show-annotations: "warning"

Arguments

Inputs

Key Required Default Description
github-token yes - Default Github Actions token. The token is not required if GitHub application is installed and the token passed through barecheck-github-app-token
lcov-file yes - Lcov.info file that was generated after your test coverage command
barecheck-github-app-token no - Barecheck application token, received after application installation comment.
barecheck-api-key no - Your project API_KEY generated from https://barecheck.com. Use this property to avoid running coverage for the base branch.
base-lcov-file no - Lcov.info file that would be used to compare code coverage. The comparison will be disabled if the file is not passed
send-summary-comment no true Option to send Github code coverage comment based on the changes that were made in PR
show-annotations no 'warning' Option to enable Github annotation that would show uncovered files in review tab. Options: ' ' | warning | error
minimum-ratio no '' Percentage of uncovered lines that are allowed for new changes
app-name no 'Barecheck' Application name would be used once you have more than one report in your workflow and want to have different reports per application.

Workflow Example

In order to compare your new changes report and the base branch you are able to use Github artifacts as in the example below:

name: Code Coverage

on: [pull_request]

jobs:
  base_branch_cov:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.base_ref }}
      - name: Use Node.js v16.11.0
        uses: actions/setup-node@v1
        with:
          node-version: v16.11.0

      - name: Install dependencies
        run: yarn

      - name: Run test coverage
        run: yarn coverage

      - name: Upload code coverage for ref branch
        uses: actions/upload-artifact@v2
        with:
          name: ref-lcov.info
          path: ./coverage/lcov.info

  checks:
    runs-on: ubuntu-latest
    needs: base_branch_cov
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js v16.11.0
        uses: actions/setup-node@v1
        with:
          node-version: v16.11.0

      - name: Download code coverage report from base branch
        uses: actions/download-artifact@v2
        with:
          name: ref-lcov.info

      - name: Install dependencies
        run: yarn

      - name: Run test coverage
        run: yarn coverage

      #  Compares two code coverage files and generates report as a comment
      - name: Generate Code Coverage report
        id: code-coverage
        uses: barecheck/code-coverage-action@v1
        with:
          barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
          lcov-file: "./coverage/lcov.info"
          base-lcov-file: "./lcov.info"
          minimum-ratio: 0 # Fails Github action once code coverage is decreasing
          send-summary-comment: true
          show-annotations: "warning" # Possible options warning|error

Use cases

Monorepo support

If you have monorepo with more than one application and want to have different code coverage reports you can use app-name input property to define different application names that would be used as a part of the title.

- name: Application1 - Generate Code Coverage report
  id: code-coverage
  uses: barecheck/code-coverage-action@v1
  with:
    barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
    lcov-file: "./coverage/lcov.info"
    base-lcov-file: "./coverage/base-lcov.info"
    app-name: "Application 1"
- name: Application2 - Generate Code Coverage report
  id: code-coverage
  uses: barecheck/code-coverage-action@v1
  with:
    barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
    lcov-file: "./coverage/lcov.info"
    base-lcov-file: "./coverage/base-lcov.info"
    app-name: "Application 2"

Using Barecheck Cloud

Barecheck cloud is still in beta but there are already some numbers of teams that are using it. Especially, for complex projects where running coverage for the main branch twice just to compare results might lead to performance problems. Action will not send any data besides just the coverage number and commit sha to the cloud so you can securely use this feature.

- name: Generate Code Coverage report
  id: code-coverage
  uses: barecheck/code-coverage-action@v1
  with:
    barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
    barecheck-api-key: ${{ secrets.BARECHECK_API_KEY }}
    lcov-file: "./coverage/lcov.info"

barecheck-api-key has a bigger priority than base-lcov-file . Once you passed of them, only API KEY will be used. All other parameters can be used in the same way.

Contributing

  • Clone this repository
  • Use current node.js version nvm use or nvm install
  • Run yarn install
  • Develop feature/fix
  • Run yarn build
  • Commit changes including ./dist/index.js bundle
  • Create Pull request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].