Skip to content

Commit ac0c417

Browse files
newtorka-d
andauthored
Initial migrate coverage check to pom xml (#116)
Co-authored-by: Alexander Dümont <[email protected]>
1 parent b7d7f6e commit ac0c417

File tree

4 files changed

+62
-144
lines changed

4 files changed

+62
-144
lines changed

.github/workflows/continuous-integration.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ jobs:
8787
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} org.jacoco:jacoco-maven-plugin:prepare-agent surefire:test org.jacoco:jacoco-maven-plugin:report"
8888
mvn $MVN_ARGS
8989
90-
- name: "Coverage Report"
91-
run: python .pipeline/scripts/print-coverage.py --jacoco-report-pattern "**/target/site/jacoco/jacoco.csv"
92-
9390
- name: "Slack Notification"
9491
if: ${{ github.ref == 'refs/heads/main' && failure() }}
9592
uses: slackapi/[email protected]

.pipeline/config.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ steps:
1010
detectTools: ['DETECTOR', 'BINARY_SCAN']
1111

1212
stages:
13-
test:
14-
coverageThresholds:
15-
instruction: 14
16-
branch: 3
17-
complexity: 12
18-
line: 46
19-
method: 33
20-
class: 67
2113
codeCheck:
2214
checkstyle:
2315
high: '0'

.pipeline/scripts/print-coverage.py

Lines changed: 0 additions & 133 deletions
This file was deleted.

pom.xml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
<enforcer.skipEnforceScopeLoggerBridges>false</enforcer.skipEnforceScopeLoggerBridges>
7272
<enforcer.skipEnforceScopeLombok>false</enforcer.skipEnforceScopeLombok>
7373
<enforcer.skipBanGeneratedModulesReference>false</enforcer.skipBanGeneratedModulesReference>
74+
<!-- Test coverage -->
75+
<coverage.instruction>74%</coverage.instruction>
76+
<coverage.branch>68%</coverage.branch>
77+
<coverage.complexity>67%</coverage.complexity>
78+
<coverage.line>75%</coverage.line>
79+
<coverage.method>80%</coverage.method>
80+
<coverage.class>85%</coverage.class>
7481
</properties>
7582

7683
<dependencyManagement>
@@ -488,6 +495,61 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma
488495
<exclude>com/sap/ai/sdk/app/**/*</exclude>
489496
</excludes>
490497
</configuration>
498+
<executions>
499+
<execution>
500+
<id>default-prepare-agent</id>
501+
<goals>
502+
<goal>prepare-agent</goal>
503+
</goals>
504+
</execution>
505+
<execution>
506+
<id>default-report</id>
507+
<goals>
508+
<goal>report</goal>
509+
</goals>
510+
<phase>prepare-package</phase>
511+
</execution>
512+
<execution>
513+
<id>default-check</id>
514+
<goals>
515+
<goal>check</goal>
516+
</goals>
517+
<configuration>
518+
<rules>
519+
<rule>
520+
<element>BUNDLE</element>
521+
<limits>
522+
<limit>
523+
<counter>COMPLEXITY</counter>
524+
<value>COVEREDRATIO</value>
525+
<minimum>${coverage.complexity}</minimum>
526+
</limit>
527+
<limit>
528+
<counter>LINE</counter>
529+
<value>COVEREDRATIO</value>
530+
<minimum>${coverage.line}</minimum>
531+
</limit>
532+
<limit>
533+
<counter>INSTRUCTION</counter>
534+
<value>COVEREDRATIO</value>
535+
<minimum>${coverage.instruction}</minimum>
536+
</limit>
537+
<limit>
538+
<counter>BRANCH</counter>
539+
<value>COVEREDRATIO</value>
540+
<minimum>${coverage.branch}</minimum>
541+
</limit>
542+
<limit>
543+
<counter>CLASS</counter>
544+
<value>COVEREDRATIO</value>
545+
<minimum>${coverage.class}</minimum>
546+
</limit>
547+
</limits>
548+
</rule>
549+
</rules>
550+
</configuration>
551+
</execution>
552+
</executions>
491553
</plugin>
492554
<plugin>
493555
<!-- Needed because GitHub actions uses an old Maven version <3.9.0 -->

0 commit comments

Comments
 (0)