This action will report test coverage summary of the pull-request touched files in the description. It works with the json coverage-summary generated by Istanbul
reporter.
Required The GitHub authentication token (workflows automatically set this for you, nothing needed here)
Required Path to the Istanbul 'coverage-summary.json' file in your repo
Required Title of the report
Summary of the report in json format. sample:
{
"lines": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
"functions": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
"statements": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 },
"branches": { "total": 0, "covered": 0, "skipped": 0, "pct": 0 }
}
Setup your test framework to use Istanbul
to create coverage report as json file and thats it. just feed that file to this action as an input.
on:
pull_request:
branches: [main, dev]
jobs:
angular-test-coverage:
runs-on: ubuntu-latest
name: angular test coverage update
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run Jasmine tests
run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
- name: Coverage report
uses: eleboys/test-coverage-report-action@v1.0.2
id: report
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: coverage/coverage-summary.json
title: Karma Test Coverage
- name: Print the output summary
run: echo "Report coverage json ${{ steps.report.outputs.summary }}"