-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ANCHOR-413] Add jacoco test report to PR workflow (#1062)
### Description This is to add jacococ test report to PR workflow, to monitor test coverage change ### Testing After PR being published, there should be a github-action bot comment in your PR with test coverage. Please see #1081 (comment) for example. Note that this PR is published from a branch on original repo instead of a forked repo. ### Known limitations 1. For now Github only grant apps write permission (which is needed to make comment) to original repo, and read permission to forked repo, that mean this action will only works on PR created from original repo. I have created a ticket https://stellarorg.atlassian.net/browse/ANCHOR-433 to follow up on this and try to find a work around for forked repo For more info about github permission please refer to https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token 2. Currently the min-coverage-overall is set to 40 and min-coverage-changed-files is 60, this is just for testing, will be changed accordingly. --------- Co-authored-by: Reece Markowsky <[email protected]> Co-authored-by: Philip Liu <[email protected]>
- Loading branch information
1 parent
d39481d
commit 8463b4b
Showing
3 changed files
with
30 additions
and
2 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 |
---|---|---|
|
@@ -9,6 +9,10 @@ jobs: | |
gradle_test_and_build: | ||
name: Gradle Test and Build | ||
runs-on: ubuntu-22.04 | ||
# write to PR permission is required for jacocoTestReport Action to update comment | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v3 | ||
|
@@ -51,7 +55,18 @@ jobs: | |
- name: Gradle test and build. (unit tests, integration tests, end-2-end tests and build) | ||
env: | ||
run_docker: false | ||
run: ./gradlew clean build --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar | ||
run: ./gradlew clean build jacocoTestReport --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar | ||
|
||
- name: Add coverage to PR | ||
id: jacoco | ||
uses: madrapps/[email protected] | ||
with: | ||
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
min-coverage-overall: 40 | ||
min-coverage-changed-files: 60 | ||
title: Code Coverage | ||
update-comment: true | ||
|
||
- name: Stop docker containers | ||
env: | ||
|
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