Giter VIP home page Giter VIP logo

github-action's Introduction

logo

Coveralls GitHub Action

This GitHub Action posts your test suite's LCOV coverage data to coveralls.io for analysis, change tracking, and notifications. You don't need to add the repo to Coveralls first, it will be created when receiving the post.

When running on pull_request events, a comment will be added to the PR with details about how coverage will be affected if merged.

Usage

The action's step needs to run after your test suite has outputted an LCOV file. Most major test runners can be configured to do so; if you're using Node, see more info here.

Inputs:

Name Requirement Description
github-token required Must be in form github-token: ${{ secrets.GITHUB_TOKEN }}; Coveralls uses this token to verify the posted coverage data on the repo and create a new check based on the results. It is built into Github Actions and does not need to be manually specified in your secrets store. More Info
path-to-lcov optional Default: "./coverage/lcov.info". Local path to the lcov output file produced by your test suite. An error will be thrown if the file can't be found. This is the file that will be sent to the Coveralls API.
parallel optional Set to true for parallel (or matrix) based steps, where multiple posts to Coveralls will be performed in the check.
parallel-finished optional Set to true in the last job, after the other parallel jobs steps have completed, this will send a webhook to Coveralls to set the build complete.
coveralls-endpoint optional Hostname and protocol: https://<host>; Specifies a Coveralls Enterprise hostname.

Outputs:

  • coveralls-api-response: JSON response from the Coveralls API with a status code and url for the Job on Coveralls.

Standard Example:

  • This example assumes you're building a Node project using the command make test-coverage, demo here: nickmerwin/node-coveralls
on: ["push", "pull_request"]

name: Test Coveralls

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@v1

    - name: Use Node.js 10.x
      uses: actions/setup-node@v1
      with:
        node-version: 10.x

    - name: npm install, make test-coverage
      run: |
        npm install
        make test-coverage

    - name: Coveralls
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}

Complete Parallel Job Example:

on: ["push", "pull_request"]

name: Test Coveralls Parallel

jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@v1

    - name: Use Node.js 10.x
      uses: actions/setup-node@v1
      with:
        node-version: 10.x

    - name: npm install, make test-coverage
      run: |
        npm install
        make test-coverage

    - name: Coveralls Parallel
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        parallel: true
        path-to-lcov: ./coverage/lcov.info # optional (default value)

    - name: Coveralls Finished
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}
        parallel-finished: true

The "Coveralls Finished" step needs to run after all other steps have completed; it will let Coveralls know that all jobs in the build are done and aggregate coverage calculation can be calculated and notifications sent.

Demo

demo

Steps shown:

  1. A new function f without test coverage is added.
  2. The changes are committed and pushed to a new branch "function/f"
  3. The Action runs on GitHub CI.
  4. The commit on GitHub shows a new check for Coveralls with details "First build on function-f at 92.0%", and links to the Job on Coveralls.
  5. Line-by-line results indicate the new function is missing coverage.
  6. Create a pull request with the new branch.
  7. The pull_request check runs and the resulting coverage data triggers a fail status.
  8. A detailed comment is posted.

Troubleshooting:

Coveralls comments aren't added to my pull request

Ensure your workflow that invokes the Coveralls action runs on pull requests, e.g.:

on: ["push", "pull_request"]

Coveralls responds with "cannot find matching repository"

Ensure your workflow yaml line for the GitHub token matches exactly:

github-token: ${{ secrets.GITHUB_TOKEN }}

github-action's People

Contributors

ibakshay avatar jlabeit avatar marcusnotheis avatar nickmerwin avatar xhmikosr 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.