Skip to content

Commit 7325b10

Browse files
committed
Add code coverage check
Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent 303aa12 commit 7325b10

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
@@ -155,6 +155,7 @@
155155
<maven.surefire.plugin.version>2.19.1</maven.surefire.plugin.version>
156156
<maven.flatten.plugin.version>1.6.0</maven.flatten.plugin.version>
157157
<maven.deploy.plugin.version>3.1.3</maven.deploy.plugin.version>
158+
<jacoco.maven.plugin.version>0.8.12</jacoco.maven.plugin.version>
158159
<junit.platform.version>1.1.0</junit.platform.version>
159160
<junit.jupiter.engine.version>5.10.1</junit.jupiter.engine.version>
160161
<gson.version>2.13.1</gson.version>
@@ -226,6 +227,44 @@
226227
</plugins>
227228
</build>
228229
</profile>
230+
<profile>
231+
<id>coverage</id>
232+
<build>
233+
<plugins>
234+
<plugin>
235+
<groupId>org.apache.maven.plugins</groupId>
236+
<artifactId>maven-surefire-plugin</artifactId>
237+
<version>${maven.surefire.plugin.version}</version>
238+
<configuration>
239+
<argLine>${jacocoArgLine}</argLine>
240+
</configuration>
241+
</plugin>
242+
<plugin>
243+
<groupId>org.jacoco</groupId>
244+
<artifactId>jacoco-maven-plugin</artifactId>
245+
<version>${jacoco.maven.plugin.version}</version>
246+
<executions>
247+
<execution>
248+
<id>jacoco-prepare-agent</id>
249+
<goals>
250+
<goal>prepare-agent</goal>
251+
</goals>
252+
<configuration>
253+
<propertyName>jacocoArgLine</propertyName>
254+
</configuration>
255+
</execution>
256+
<execution>
257+
<id>jacoco-report</id>
258+
<phase>verify</phase>
259+
<goals>
260+
<goal>report</goal>
261+
</goals>
262+
</execution>
263+
</executions>
264+
</plugin>
265+
</plugins>
266+
</build>
267+
</profile>
229268
</profiles>
230269

231270
<build>

0 commit comments

Comments
 (0)