-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add pr code coverage to ci (#4643)
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,8 @@ | ||
platform: linux | ||
inputs: | ||
- name: src | ||
- name: pipeline-tasks | ||
outputs: [name: src] | ||
run: | ||
dir: src | ||
path: ci/tasks/code-coverage-diff.sh |
This file contains 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 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,25 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
source "$(dirname $PWD)/pipeline-tasks/github-setup.sh" | ||
|
||
# note our branch | ||
branch=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
# generate test coverage | ||
cov_cmd="yarn test:rtl --coverageReporters json-summary --coverageDirectory tmp" | ||
tot_cmd="jq '.["total"]["lines"]["pct"]' tmp/coverage-summary.json" | ||
bash -c $cov_cmd | ||
newcc=$(bash -c $tot_cmd) | ||
git checkout main | ||
bash -c $cov_cmd | ||
oldcc=$(bash -c $tot_cmd) | ||
|
||
difcc=$(($newcc-$oldcc)) | ||
|
||
gh pr comment $branch -b " \ | ||
## :robot: This is an automated code coverage report | ||
Total coverage (lines): $newcc% | ||
Coverage diff: $diffcc% | ||
" |