Skip to content

Commit

Permalink
[Github workflow] Upload codecov report with each CI run (#2685)
Browse files Browse the repository at this point in the history
* Add steps for generating and uploading codecov reports

* Use local variant instead of dev

* Fix jacoco plugin to use local build variant

* Remove flags from step

* Add flag "service"

* Add name

* Remove quotes

* Use codecov command line tool instead of codecov github action

* Use curl action

* Split codecov into two steps

* Fix curl flag

* Separate steps for codecov grant execute permission

* Replace curl github action with CLI

* Fix dir path in jacoco plugin

* Merge all steps into one

* Revert indent size to 4

---------

Co-authored-by: Gino Miceli <228050+gino-m@users.noreply.github.com>
  • Loading branch information
shobhitagarwal1612 and gino-m authored Aug 27, 2024
1 parent 4434801 commit b925aef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- name: Run code quality checks
run: ./gradlew checkCode

# TODO(#2670) : Upload codecov reports
# - name: Generate codecov report
# run: ./gradlew jacocoDevDebugUnitTestReport
- name: Generate codecov report
run: ./gradlew jacocoLocalDebugUnitTestReport

- name: Upload coverage to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --verbose upload-process --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} -n 'service'-${{ github.run_id }} -F service -f ground/build/reports/jacoco/jacocoLocalDebugUnitTestReport/jacocoLocalDebugUnitTestReport.xml
8 changes: 4 additions & 4 deletions config/jacoco/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ tasks.withType(Test).configureEach {
jacoco.excludes = ['jdk.internal.*']
}

tasks.register('jacocoDevDebugUnitTestReport', JacocoReport) {
dependsOn 'testDevDebugUnitTest'
tasks.register('jacocoLocalDebugUnitTestReport', JacocoReport) {
dependsOn 'testLocalDebugUnitTest'
group = "Reporting"
description = "Run tests and generate coverage reports"
reports {
Expand All @@ -35,7 +35,7 @@ tasks.register('jacocoDevDebugUnitTestReport', JacocoReport) {
html.required = true
}
classDirectories.from = fileTree(
dir: 'build/intermediates/classes/devDebug/transformDevDebugClassesWithAsm/dirs/com/google/android/ground',
dir: 'build/intermediates/classes/localDebug/transformLocalDebugClassesWithAsm/dirs/com/google/android/ground',
excludes: [
'**/databinding/*',
'**/local/room/dao/*',
Expand Down Expand Up @@ -110,5 +110,5 @@ tasks.register('jacocoDevDebugUnitTestReport', JacocoReport) {
]
)
sourceDirectories.from = files('src/main/java/com/google/android/ground')
executionData.from = files('build/jacoco/testDevDebugUnitTest.exec')
executionData.from = files('build/jacoco/testLocalDebugUnitTest.exec')
}

0 comments on commit b925aef

Please sign in to comment.