-
Notifications
You must be signed in to change notification settings - Fork 1
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
[LD-139] chore: test coverage report #162
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
78f859f
to
1a2db58
Compare
cf8774d
to
3506171
Compare
452c7ed
to
a6f123a
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe a little what the crucial part of code is doing?😅
@@ -36,14 +38,30 @@ jobs: | |||
uses: ./.github/actions/prepare-android-env | |||
|
|||
- name: Run test | |||
run: ./gradlew test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is replaced by a task that I created codeCoverage
uses: madrapps/[email protected] | ||
with: | ||
paths: | | ||
*/build/reports/jacoco/codeCoverage/codeCoverage.xml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we pass the path to the codeCoverage report in xml format to the action
@@ -93,6 +94,50 @@ android { | |||
} | |||
} | |||
|
|||
tasks.register('codeCoverage', JacocoReport) { | |||
dependsOn 'testDebugUnitTest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependsOn means that it will execute testDebugUnitTest when triggering codeCoverage and then all that is defined here
"src/main/kotlin/**" | ||
])) | ||
|
||
executionData.setFrom(fileTree( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location of "execution data", i.e. the coverage data collected by the unit test runner when running the tests against classes instrumented by the JaCoCo agent.
xml.required.set(true) | ||
} | ||
|
||
classDirectories.setFrom( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: The compiled class files without instrumentation. Execution data references instructions in these classes, so they're necessary for locating the actual instructions.
classDirectories.setFrom( | ||
fileTree(project.buildDir) { | ||
include("**/tmp/kotlin-classes/debug/**") | ||
exclude( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can exclude some classes so that we they are not included in the code coverage report
} | ||
) | ||
|
||
sourceDirectories.setFrom(fileTree( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the location of the original source code files. Optional, but allows the reporter to map bytecode instructions back to the original sources in order to include them into the report with coverage annotations.
8f27463
to
88b733d
Compare
|
|
.github/workflows/run-test.yml
Outdated
with: | ||
paths: | | ||
*/build/reports/jacoco/codeCoverage/codeCoverage.xml | ||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: why we have here: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
?
8f6feb5
to
fc7dca8
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but keep in mind that we need to continue to work on this subject to add support for merging test reports
Pull-Request
Description
Why?
What?
Links to related issues
(https://loudius.atlassian.net/browse/LD-139)
Demo
How to test
Documentation
Github action used to create a PR comment
Jacoco Library genereting the coverage report
Checklist