Skip to content

Commit a88bd31

Browse files
authored
Add code coverage check (#1929)
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent ad4b0c6 commit a88bd31

3 files changed

Lines changed: 86 additions & 1 deletion

File tree

.github/workflows/maven.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ jobs:
3535
- name: Update submodule
3636
run: git submodule update --init
3737
- name: Build with Maven
38-
run: mvn --batch-mode --update-snapshots verify
38+
run: mvn -Pcoverage --batch-mode --update-snapshots verify
39+
- name: Upload coverage
40+
uses: codecov/codecov-action@v5
41+
with:
42+
files: ./sdk-core/target/site/jacoco/jacoco.xml,./sdk-bulkwriter/target/site/jacoco/jacoco.xml
43+
name: ubuntu-jacoco-coverage
44+
disable_safe_directory: true
45+
verbose: true

codecov.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Configuration for Codecov
2+
codecov:
3+
require_ci_to_pass: no
4+
notify:
5+
require_ci_to_pass: no
6+
wait_for_ci: false
7+
8+
coverage:
9+
precision: 2
10+
round: down
11+
range: "70...100"
12+
13+
status:
14+
project:
15+
default:
16+
target: 70%
17+
threshold: 0%
18+
patch:
19+
default:
20+
target: 80%
21+
threshold: 0%
22+
if_ci_failed: error
23+
24+
comment:
25+
layout: "reach, diff, flags, files"
26+
behavior: default
27+
require_changes: false
28+
branches:
29+
- master
30+
31+
ignore:
32+
- .github
33+
- benchmark
34+
- doc
35+
- examples
36+
- tests
37+
- "**/*.md"
38+
- "**/*.yml"
39+
- "**/*.yaml"

pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<maven.surefire.plugin.version>2.19.1</maven.surefire.plugin.version>
163163
<maven.flatten.plugin.version>1.6.0</maven.flatten.plugin.version>
164164
<maven.deploy.plugin.version>3.1.3</maven.deploy.plugin.version>
165+
<jacoco.maven.plugin.version>0.8.12</jacoco.maven.plugin.version>
165166
<junit.platform.version>1.1.0</junit.platform.version>
166167
<junit.jupiter.engine.version>5.10.1</junit.jupiter.engine.version>
167168
<gson.version>2.13.1</gson.version>
@@ -234,6 +235,44 @@
234235
</plugins>
235236
</build>
236237
</profile>
238+
<profile>
239+
<id>coverage</id>
240+
<build>
241+
<plugins>
242+
<plugin>
243+
<groupId>org.apache.maven.plugins</groupId>
244+
<artifactId>maven-surefire-plugin</artifactId>
245+
<version>${maven.surefire.plugin.version}</version>
246+
<configuration>
247+
<argLine>${jacocoArgLine}</argLine>
248+
</configuration>
249+
</plugin>
250+
<plugin>
251+
<groupId>org.jacoco</groupId>
252+
<artifactId>jacoco-maven-plugin</artifactId>
253+
<version>${jacoco.maven.plugin.version}</version>
254+
<executions>
255+
<execution>
256+
<id>jacoco-prepare-agent</id>
257+
<goals>
258+
<goal>prepare-agent</goal>
259+
</goals>
260+
<configuration>
261+
<propertyName>jacocoArgLine</propertyName>
262+
</configuration>
263+
</execution>
264+
<execution>
265+
<id>jacoco-report</id>
266+
<phase>verify</phase>
267+
<goals>
268+
<goal>report</goal>
269+
</goals>
270+
</execution>
271+
</executions>
272+
</plugin>
273+
</plugins>
274+
</build>
275+
</profile>
237276
</profiles>
238277

239278
<build>

0 commit comments

Comments
 (0)