Skip to content

Commit 08b0da5

Browse files
committed
merge with 4.9.0
2 parents d99ab90 + c6a5172 commit 08b0da5

File tree

104 files changed

+8899
-1493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+8899
-1493
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Comment Test Coverage from a json-summary file
2+
3+
A GitHub action to comment on a PR on GitHub with a simple test coverage summary table that edits itself on successive pushes to the same PR.
4+
5+
## How to use with Karma + Angular
6+
7+
1. Add `"codeCoverage": true,` under test > options in angular.json
8+
2. In your karma.conf.js set coverageIstanbulReporter.reports to include `json-summary` and save it to the /coverage directory if using the sample setup below
9+
3. Use in your workflow as illustrated below:
10+
11+
```yml
12+
name: test-pull-request
13+
on: [pull_request]
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout Code
19+
uses: actions/checkout@v1
20+
21+
- name: Run Jasmine tests
22+
run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
23+
24+
- name: Comment Test Coverage
25+
uses: lucianogorza/[email protected]
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
path: coverage/coverage-summary.json
29+
title: Karma Test Coverage
30+
```
31+
32+
## How to use with Jest
33+
34+
1. Add `"codeCoverage": true,` under test > options in angular.json
35+
2. In your jest.config.js set coverageReporters to include `json-summary` and set coverageDirectory to 'coverage' if using the path in the sample setup above.
36+
3. Use in your workflow as illustrated above in the Karma example.
37+
38+
## Parameters
39+
40+
- `token` (**required**) - The GitHub authentication token (workflows automatically set this for you, nothing needed here)
41+
- `path` (**required**) - Path to your coverage-summary.json file
42+
- `title` (**optional**) - Title of comment in PR (defaults to "Test Coverage")
43+
44+
## How to edit the action
45+
46+
Feel free to submit a PR to this repo and ask me to update the action, but if you'd like to create your own action:
47+
48+
1. Clone down repo, `npm install`, and make changes
49+
2. Run `npm run package`
50+
3. Commit changes
51+
4. Create a new release on GitHub to publish latest version of the action. See https://help.github.com/en/actions/building-actions/publishing-actions-in-github-marketplace
52+
53+
## License
54+
55+
Repurposed from https://github.com/AthleticNet/comment-test-coverage, Copyright (c) 2021 AthleticNet
56+
Repurposed from https://github.com/peter-evans/commit-comment, Copyright (c) 2019 Peter Evans and https://github.com/mshick/add-pr-comment, Copyright (c) 2019 Michael Shick
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Comment Test Coverage with delete filter by title'
2+
description: 'Read a Test Coverage json-summary test report and add stats on to PR using a table that rewrites itself on successive pushes.'
3+
inputs:
4+
token:
5+
description: 'The GitHub authentication token'
6+
required: true
7+
path:
8+
description: 'Filepath to json-summary file'
9+
required: true
10+
title:
11+
description: 'Comment title in PR conversation'
12+
required: false
13+
default: 'Test Coverage'
14+
runs:
15+
using: 'node12'
16+
main: 'dist/index.js'
17+
branding:
18+
icon: 'message-square'
19+
color: 'gray-dark'

0 commit comments

Comments
 (0)