-
Notifications
You must be signed in to change notification settings - Fork 167
Generate code coverage reports on PRs #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
coopernetes
merged 24 commits into
finos:main
from
CyberCitizen01:203-implement-code-coverage-reports-on-pull-requests
Jan 24, 2024
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
c25652c
chore: rename test files to `*.test.js`
CyberCitizen01 ee28b68
feat: add `nyc` to generate test coverage reports
CyberCitizen01 d68fc19
feat: ci logic to present & block PRs if coverage <80%
CyberCitizen01 4136628
fix: comment on PR irrespective of test step
CyberCitizen01 05cf4b2
fix: permissions for GITHUB_TOKEN
CyberCitizen01 bf712c1
fix: typo in syntax of storing exit code in o/p
CyberCitizen01 a37a3f6
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome cc21b82
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome 045a47d
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
CyberCitizen01 0d81a41
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
CyberCitizen01 5b1655f
feat: assess coverage report on modified files b/w PR and base ref
CyberCitizen01 222a3dc
chore(workflows): ignore coverage threshold limit
CyberCitizen01 b164608
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
CyberCitizen01 8182d65
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome 5d449e1
chore: update package-lock.json
JamieSlome 36421b7
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
CyberCitizen01 06964ce
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome a3e86ed
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
CyberCitizen01 bf12488
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome 5bbf789
chore: replace `romeovs/lcov-reporter-action` with `zgosalvez/github-…
CyberCitizen01 e1d6117
fix: failing workflow run `Unable to locate executable file: genhtml`
CyberCitizen01 b5f00a1
Merge branch 'main' into 203-implement-code-coverage-reports-on-pull-…
JamieSlome e40cfce
fix: failing workflow run because of missing lcov.info file
CyberCitizen01 9db4525
chore: `set-ouput` deprecated; use environment files
CyberCitizen01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* eslint-disable max-len */ | ||
| 'use strict'; | ||
|
|
||
| const { execFileSync } = require('child_process'); | ||
|
|
||
| let opts = { | ||
| branches: 80, | ||
| lines: 80, | ||
| functions: 80, | ||
| statements: 80, | ||
| }; | ||
|
|
||
| // Only generate coverage report for changed files in PR | ||
| // see: https://github.com/actions/checkout/issues/438#issuecomment-1446882066 | ||
| // https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
| if (process.env.GITHUB_BASE_REF !== undefined) { | ||
| console.log('Generating coverage report for changed files...'); | ||
| try { | ||
| const baseRef = execFileSync('git', [ | ||
| 'rev-parse', | ||
| `origin/${process.env.GITHUB_BASE_REF}`, | ||
| ]) | ||
| .toString() | ||
| .replace('\n', ''); | ||
| const headRef = process.env.GITHUB_SHA; | ||
| const stdout = execFileSync('git', [ | ||
| 'diff', | ||
| '--name-only', | ||
| `${baseRef}..${headRef}`, | ||
| ]).toString(); | ||
| opts = { | ||
| ...opts, | ||
| include: stdout.split('\n'), | ||
| }; | ||
| } catch (error) { | ||
| console.log('Error: ', error); | ||
| } | ||
| } | ||
|
|
||
| console.log('nyc config: ', opts); | ||
| module.exports = opts; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.