Skip to content

Commit 0497eda

Browse files
authored
Update code coverage with jacoco (#577)
* Update code coverage with jacoco
1 parent b87bd4c commit 0497eda

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,22 @@ jobs:
113113
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -P /tmp
114114
tar xf /tmp/apache-maven-3.6.3-bin.tar.gz -C /opt
115115
echo "${M2_HOME}/bin" >> $GITHUB_PATH
116+
117+
# To ensure docker containers are fully up and running we sleep 60s
118+
- name: Before script
119+
run: |
120+
source src/main/docker/env.bash
121+
docker compose -f src/main/docker/docker-compose.yml up -d mongodb mongodb-auth rabbitmq eiffel-er mail-server
122+
sleep 60
116123
117-
- name: Run cobertura
124+
- name: Run jacoco
118125
shell: bash
119126
run: |
120-
mvn cobertura:cobertura -Dcobertura.report.format=xml -B
127+
mvn -V -B -U clean test -DskipITs -Dsurefire.rerunFailingTestsCount=2 -Djasypt.encryptor.password=secret -Dspring.config.location=src/functionaltests/resources/application.properties jacoco:report -Dformats=xml
121128
122129
# Generating test coverage report and publishing to Codacy
123130
- name: Run report coverage
124131
uses: codacy/codacy-coverage-reporter-action@v1
125132
with:
126133
project-token: 571cdd20d4bf435f84b25d806d304792
127-
coverage-reports: target/site/cobertura/coverage.xml
134+
coverage-reports: target/site/jacoco/jacoco.xml

pom.xml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -664,26 +664,44 @@
664664
<groupId>org.jacoco</groupId>
665665
<artifactId>jacoco-maven-plugin</artifactId>
666666
<version>0.8.8</version>
667-
<configuration>
668-
<excludes>
669-
<exclude>com/ericsson/ei/controller/model/*</exclude>
670-
</excludes>
671-
</configuration>
672667
<executions>
673668
<execution>
674-
<id>jacoco-initialize</id>
669+
<id>prepare-agent</id>
675670
<goals>
676671
<goal>prepare-agent</goal>
677672
</goals>
678673
</execution>
679674
<execution>
680-
<id>jacoco-site</id>
681-
<phase>package</phase>
675+
<id>report</id>
676+
<phase>prepare-package</phase>
682677
<goals>
683678
<goal>report</goal>
684679
</goals>
685680
</execution>
681+
<execution>
682+
<id>post-unit-test</id>
683+
<phase>test</phase>
684+
<goals>
685+
<goal>report</goal>
686+
</goals>
687+
<configuration>
688+
<!-- Sets the path to the file which contains
689+
the execution data. -->
690+
<dataFile>target/jacoco.exec</dataFile>
691+
<!-- Sets the output directory for the code coverage
692+
report. -->
693+
<outputDirectory>target/jacoco</outputDirectory>
694+
</configuration>
695+
</execution>
686696
</executions>
697+
<configuration>
698+
<excludes>
699+
<exclude>com/ericsson/ei/controller/model/*</exclude>
700+
</excludes>
701+
<systemPropertyVariables>
702+
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
703+
</systemPropertyVariables>
704+
</configuration>
687705
</plugin>
688706
</plugins>
689707
</build>

0 commit comments

Comments
 (0)