Skip to content

Commit b5cf2f9

Browse files
authored
test coverage runner (#9)
* test coverage runner * fix * cleanup * version bump * actions
1 parent 67f76a8 commit b5cf2f9

15 files changed

Lines changed: 149 additions & 76 deletions

File tree

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ charset = utf-8
1717
[*.xml]
1818
indent_style = space
1919
indent_size = 2
20+
max_line_length = 150
2021

2122
[*.java]
2223
indent_style = space
2324
indent_size = 4
25+
max_line_length = 250
2426

2527
# Tab indentation (no size specified)
2628
[Makefile]

.github/workflows/build-on-pull-request.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
name: build and test on pull request
22
on:
33
pull_request:
4-
branches: [master]
4+
branches: [main]
55
jobs:
66
build-and-test:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v5
10-
- name: Malware Scanner # https://github.com/dell/common-github-actions/blob/main/malware-scanner/README.md
11-
uses: dell/common-github-actions/malware-scanner@main
12-
with:
13-
directories: .
14-
options: -ri
1510
- name: Set up JDK 8 for x64
1611
uses: actions/setup-java@v4
1712
with:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: scan-codecoverage
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
scan-codecoverage:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v5
10+
- name: Set up JDK 21 for x64
11+
uses: actions/setup-java@v4
12+
with:
13+
java-version: "21"
14+
distribution: "temurin"
15+
architecture: x64
16+
- run: mvn test
17+
- run: mvn jacoco:report
18+
- run:
19+
- run: zip -r coverage-report-html.zip jacoco/*
20+
working-directory: target/site/
21+
- uses: actions/upload-artifact@v4
22+
with:
23+
name: code-coverage
24+
path: target/site/coverage-report-html.zip
25+
# runs jacoco check which has 100% coverage rules. see pom.xml
26+
- run: mvn verify

.github/workflows/scan-malware.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: scan-malware
22
on:
33
pull_request:
4-
branches: [master]
4+
branches: [main]
55
jobs:
66
scan-malware:
77
runs-on: ubuntu-latest

.github/workflows/scan-semgrep.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: scan-semgrep
22
on:
3-
pull_request: {}
4-
workflow_dispatch: {}
5-
merge_group:
6-
types: [checks_requested]
3+
pull_request:
4+
branches: [main]
75
jobs:
86
scan-semgrep:
97
name: semgrep/ci

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ output.xml
77
.settings
88
.DS_Store
99
.dccache
10+
bar.xml

DEVELOPMENT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@
44

55
```
66
mvn package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
7-
java -jar target/java-junit-xml-merger-0.0.1-jar-with-dependencies.jar
7+
java -jar target/java-junit-xml-merger.jar
88
```
99

1010
### Testcoverage
1111

12-
[Run OpenClover](http://openclover.org/) with maven:
12+
We use jacoco and have enforced 100% coverage
1313

1414
```bash
15-
mvn clean clover:setup test clover:aggregate clover:clover
15+
mvn clean
16+
mvn test
17+
mvn verify
18+
mvn jacoco:report
1619
```
1720

18-
Now look into `target/site/clover/`
21+
Now look into `target/site/jacoco/` and open `index.html` in the browser.
22+
Should look like so:
23+
24+
<img width="1043" height="216" alt="image" src="https://github.com/user-attachments/assets/36b98e8a-5a60-4e51-83e9-43a717047845" />

Jenkinsfile

Whitespace-only changes.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
[![](https://codeclou.github.io/java-junit-xml-merger/img/github-product-logo-java-merger.png)](https://github.com/codeclou/java-junit-xml-merger)
66

7-
[![](https://codeclou.github.io/doc/badges/generated/test-coverage-100.svg?v2)](https://codeclou.github.io/java-junit-xml-merger/test-coverage/1.0.1/)
7+
![](https://codeclou.github.io/doc/badges/generated/test-coverage-100.svg?v2)
8+
89
----
910

1011

pom.xml

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
6+
>
47
<modelVersion>4.0.0</modelVersion>
58
<groupId>io.codeclou</groupId>
69
<artifactId>java-junit-xml-merger</artifactId>
7-
<version>1.2.0</version>
10+
<version>1.2.1</version>
811
<organization>
912
<name>codeclou.io</name>
1013
<url>http://codeclou.io/</url>
@@ -22,7 +25,8 @@
2225
<dependency>
2326
<groupId>commons-cli</groupId>
2427
<artifactId>commons-cli</artifactId>
25-
<version>1.4</version>
28+
<version>1.11.0</version>
29+
<scope>compile</scope>
2630
</dependency>
2731
<dependency>
2832
<groupId>junit</groupId>
@@ -33,19 +37,7 @@
3337
<dependency>
3438
<groupId>com.openpojo</groupId>
3539
<artifactId>openpojo</artifactId>
36-
<version>0.8.6</version>
37-
<scope>test</scope>
38-
</dependency>
39-
<dependency>
40-
<groupId>org.powermock</groupId>
41-
<artifactId>powermock-module-junit4</artifactId>
42-
<version>${powermock.version}</version>
43-
<scope>test</scope>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.powermock</groupId>
47-
<artifactId>powermock-api-mockito</artifactId>
48-
<version>${powermock.version}</version>
40+
<version>0.9.1</version>
4941
<scope>test</scope>
5042
</dependency>
5143
<dependency>
@@ -54,20 +46,9 @@
5446
<version>1.10.19</version>
5547
<scope>test</scope>
5648
</dependency>
57-
<dependency>
58-
<groupId>org.powermock</groupId>
59-
<artifactId>powermock-api-mockito-common</artifactId>
60-
<version>1.7.0</version>
61-
<scope>test</scope>
62-
</dependency>
6349
</dependencies>
6450
<build>
6551
<plugins>
66-
<plugin>
67-
<groupId>org.openclover</groupId>
68-
<artifactId>clover-maven-plugin</artifactId>
69-
<version>4.2.0</version>
70-
</plugin>
7152
<plugin>
7253
<artifactId>maven-assembly-plugin</artifactId>
7354
<version>3.1.0</version>
@@ -93,10 +74,59 @@
9374
</execution>
9475
</executions>
9576
</plugin>
77+
<plugin>
78+
<groupId>org.jacoco</groupId>
79+
<artifactId>jacoco-maven-plugin</artifactId>
80+
<version>0.8.14</version>
81+
<executions>
82+
<execution>
83+
<id>prepare-agent</id>
84+
<goals>
85+
<goal>prepare-agent</goal>
86+
</goals>
87+
</execution>
88+
<execution>
89+
<id>report</id>
90+
<goals>
91+
<goal>report</goal>
92+
</goals>
93+
<configuration>
94+
<formats>
95+
<format>XML</format>
96+
</formats>
97+
</configuration>
98+
</execution>
99+
<execution>
100+
<id>jacoco-check</id>
101+
<goals>
102+
<goal>check</goal>
103+
</goals>
104+
<configuration>
105+
<rules>
106+
<rule>
107+
<element>BUNDLE</element>
108+
<limits>
109+
<limit>
110+
<counter>INSTRUCTION</counter>
111+
<value>COVEREDRATIO</value>
112+
<minimum>1</minimum>
113+
<!-- WE AIM FOR 100% COVERAGE -->
114+
</limit>
115+
<limit>
116+
<counter>CLASS</counter>
117+
<value>MISSEDCOUNT</value>
118+
<maximum>0</maximum>
119+
</limit>
120+
</limits>
121+
</rule>
122+
</rules>
123+
</configuration>
124+
</execution>
125+
</executions>
126+
</plugin>
96127
</plugins>
97128
</build>
98129
<properties>
99-
<powermock.version>1.7.0</powermock.version>
100130
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
101131
<maven.compiler.source>1.8</maven.compiler.source>
102132
<maven.compiler.target>1.8</maven.compiler.target>

0 commit comments

Comments
 (0)