Skip to content

Commit

Permalink
reporting coverage and test results
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Karpala <piotrkarpala@microsoft.com>
  • Loading branch information
karpikpl committed May 1, 2024
1 parent e17347e commit 1acc803
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ on:

permissions:
contents: read
statuses: write
issues: read
checks: write
pull-requests: write

jobs:
test-javascript:
Expand Down Expand Up @@ -45,6 +48,49 @@ jobs:
id: npm-ci-test
run: npm run ci-test

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Test Results JS
files: |
.reports/**/*.xml
- uses: actions/upload-artifact@v4
with:
name: js-results
path: |
reports/*
coverage/*
- name: Code Coverage Summary Report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./coverage/*.xml
badge: true
format: markdown
output: both

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md

- name: Add Coverage Summary
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
// read summary file
var summary = fs.readFileSync('code-coverage-results.md', 'utf8');
await core.summary
.addHeading('JS Code Coverage Summary')
.addRaw(summary)
.write()
test-action:
name: GitHub Actions Test
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,6 @@ __tests__/runner/*
.idea
.vscode
*.code-workspace
.reports

# Ignore test results
.reports

0 comments on commit 1acc803

Please sign in to comment.