Skip to content

Handle case when testsuites is not the root element of the JUnit xml … #47

Handle case when testsuites is not the root element of the JUnit xml …

Handle case when testsuites is not the root element of the JUnit xml … #47

name: Update Coverage in README
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.yml'
- '.github/**'
- 'data/**'
- 'dist/**'
jobs:
update-coverage-in-readme:
name: Update Coverage in README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: NPM Cache
id: npm-cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm
- name: Install Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Check Format
run: npm run format-check
- name: Check Lint
run: npm run lint
- name: Check Build
run: npm run build
- name: Run Tests
run: npm run test:coverage | tee ./coverage.txt
- name: Jest Coverage Comment
id: coverageComment
uses: MishaKav/jest-coverage-comment@main
with:
hide-comment: true
coverage-path: ./coverage.txt
junitxml-path: ./coverage/junit.xml
- name: Check the output coverage
run: |
echo "Summary Report"
echo "Coverage Percentage - ${{ steps.coverageComment.outputs.coverage }}"
echo "Coverage Color - ${{ steps.coverageComment.outputs.color }}"
echo "Summary Html - ${{ steps.coverageComment.outputs.summaryHtml }}"
echo "JUnit Report"
echo "tests - ${{ steps.coverageComment.outputs.tests }}"
echo "skipped - ${{ steps.coverageComment.outputs.skipped }}"
echo "failures - ${{ steps.coverageComment.outputs.failures }}"
echo "errors - ${{ steps.coverageComment.outputs.errors }}"
echo "time - ${{ steps.coverageComment.outputs.time }}"
echo "Coverage Report"
echo "lines - ${{ steps.coverageComment.outputs.lines }}"
echo "branches - ${{ steps.coverageComment.outputs.branches }}"
echo "functions - ${{ steps.coverageComment.outputs.functions }}"
echo "statements - ${{ steps.coverageComment.outputs.statements }}"
echo "coverage - ${{ steps.coverageComment.outputs.coverage }}"
echo "color - ${{ steps.coverageComment.outputs.color }}"
echo "Coverage Html - ${{ steps.coverageComment.outputs.coverageHtml }}"
- name: Create the badge
if: github.ref == 'refs/heads/main'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.JEST_COVERAGE_COMMENT }}
gistID: 5e90d640f8c212ab7bbac38f72323f80
filename: jest-coverage-comment__main.json
label: coverage
message: ${{ steps.coverageComment.outputs.coverage }}%
color: ${{ steps.coverageComment.outputs.color }}
namedLogo: javascript