Skip to content

Commit 2033a4a

Browse files
Add test coverage report to PRs
1 parent 66edd67 commit 2033a4a

File tree

3 files changed

+70
-7
lines changed

3 files changed

+70
-7
lines changed

.github/workflows/reports.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Report tests results
16+
17+
on:
18+
pull_request:
19+
branches: [ "main" ]
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
pull-requests: write
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Set up JDK 8
32+
uses: actions/setup-java@v4
33+
with:
34+
java-version: '8'
35+
distribution: 'temurin'
36+
37+
- name: Setup Gradle
38+
uses: gradle/actions/setup-gradle@v4
39+
40+
- name: Tests report
41+
run: ./gradlew :dumper:app:jacocoTestReport
42+
43+
- name: Add coverage to PR
44+
id: jacoco
45+
uses: madrapps/jacoco-report@v1.7.2
46+
with:
47+
paths: ${{ github.workspace }}/dumper/app/build/reports/jacoco/test/jacocoTestReport.xml
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
title: "Code Coverage Report"
50+
debug-mode: false
51+
update-comment: true
Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
name: DWH Dumper CI
215

316
on:
@@ -15,7 +28,7 @@ jobs:
1528

1629
steps:
1730
- name: Checkout latest code
18-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
1932

2033
- name: Set up JDK 8
2134
uses: actions/setup-java@v4
@@ -26,7 +39,7 @@ jobs:
2639
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
2740
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
2841
- name: Setup Gradle
29-
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
42+
uses: gradle/actions/setup-gradle@v4
3043

3144
- name: Setup Protobuf
3245
uses: arduino/setup-protoc@v3
@@ -37,10 +50,10 @@ jobs:
3750
run: ./gradlew -Pci clean
3851

3952
- name: Test Dumper
40-
run: ./gradlew -Pci :dumper:app:test
53+
run: ./gradlew -Pci :dumper:app:test --stacktrace
4154

4255
- name: Test DTS transfer
43-
run: ./gradlew -Pci :dts-transfer-status:app:test
56+
run: ./gradlew -Pci :dts-transfer-status:app:test --stacktrace
4457

4558
- name: Test Permissions migration
46-
run: ./gradlew -Pci :permissions-migration:app:test
59+
run: ./gradlew -Pci :permissions-migration:app:test --stacktrace

dumper/app/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,8 @@ test {
145145
jacocoTestReport {
146146
dependsOn test
147147
reports {
148-
xml.required = false
148+
xml.required = true
149149
csv.required = false
150-
html.outputLocation = layout.buildDirectory.dir('reports/jacocoHtml')
151150
}
152151
afterEvaluate {
153152
classDirectories.setFrom(files(classDirectories.files.collect {

0 commit comments

Comments
 (0)