Giter VIP home page Giter VIP logo

scoverage-report-gha's Introduction

scoverage-report-gha

Action Template Actions Status

This action publishes sbt-scoverage test coverage report results as comments in Github PRs.

  • Meant to be used in scala projects that have Github actions for CI.
  • Parses xml contents from sbt-scoverage reports and extracts useful metrics.
  • Creates a markdown formatted comment and posts to Github PR.
  • This action was built using templates from python-container-action
  • The overall execution is inspired by the work done in jacoco-report

Sample output

img.png

Example usage

v0.5-alpha

name: My Workflow
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    # Assuming you have an sbt scala project with scoverage plugin
    - name: Checkout code
      uses: actions/checkout@v2
      
    - name: Generate sbt-scoverage testing and coverage report
      run: |
        /usr/local/bin/platform-param-decrypt_linux > ~/.env
        sbt coverage test coverageReport coverageOff

    # Get changed files from PR
    - name: Get changed files
      if: ${{ github.event.pull_request }}
      uses: jitterbit/get-changed-files@v1
      id: changed-files
      with:
        format: 'json'

    # Get scala version from build (on PR event)
    - name: Get Scala Version
      if: ${{ github.event.pull_request }}
      id: get-version
      run: |
        version=$(echo target/scala* | cut -c14-)
      echo "scala version is ${version}"
      echo "::set-output name=version::$version"
                
    # Then call the report action to post comment to PR (on PR event)
    - name: Run report action
      if: ${{ github.event.pull_request }}
      uses: wishabi/[email protected]
      id: scoverage
      with:
        repo: ${{ github.repository }}
        pr: ${{ github.event.pull_request.number }}
        token: ${{ secrets.GITHUB_TOKEN }}
        file: target/scala-${{ steps.get-version.outputs.version }}/scoverage-report/scoverage.xml
        minStatementCov: 0.95
        changedFiles: ${{ steps.changed-files.outputs.all }}
        includePackageCov: true
    
    # (Optional) Print test coverage output (on PR event)
    - name: Check outputs
        if: ${{ github.event.pull_request }}
        run: |
        echo "Statement Coverage - ${{ steps.scoverage.outputs.statementCoverage }}"

Tests

cd scoverage-report-gha
python3 -m unittest -v

scoverage-report-gha's People

Contributors

julio-flipp avatar maximpiorischinflipp avatar prerakchaudhari-flipp avatar

Watchers

Alexander Lockshyn avatar Marco Teixeira avatar Jeff Francis avatar Logan Fuller avatar Manish Bhatt avatar monica elmeniawy avatar Ryan Ong avatar Jason Loustel avatar Anthony Jhin avatar  avatar Sean Casey avatar Jake Greene avatar  avatar Brad Rogan 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.