Skip to content

Commit

Permalink
Merge pull request #275 from Open-MBEE/jacoco
Browse files Browse the repository at this point in the history
Jacoco
  • Loading branch information
dlamoris authored Mar 12, 2024
2 parents f7ac4a8 + ca31054 commit 83ec1f6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
20 changes: 18 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
name: "Create and start all services from the docker-compose configuration"
command: |
cp example/src/main/resources/application.properties.example ./example/src/main/resources/application.properties
mkdir -p jacocoJars
curl -L -o ./jacocoJars/jacocoagent.jar "https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.8.7/org.jacoco.agent-0.8.7-runtime.jar"
curl -L -o ./jacocoJars/jacococli.jar "https://repo1.maven.org/maven2/org/jacoco/org.jacoco.cli/0.8.7/org.jacoco.cli-0.8.7-nodeps.jar"
docker-compose up --build -d
docker run --network container:mms curlimages/curl --retry 8 --retry-delay 10 --retry-max-time 90 --retry-connrefused http://mms:8080/healthcheck
Expand All @@ -43,6 +46,10 @@ jobs:
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run artifacts.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run elastic.postman_collection.json -e test-env.json --delay-request 500
docker run --volumes-from mms_test_configs --network container:mms -t postman/newman run groups.postman_collection.json -e test-env.json --delay-request 500
docker stop mms
mkdir -p jacocoOutput
docker cp mms:/mms/jacocoOutput/jacoco-it.exec ./jacocoOutput/jacoco-it.exec
- persist_to_workspace:
root: /home/circleci/
Expand All @@ -53,10 +60,17 @@ jobs:
executor: openjdk_executor
working_directory: /home/circleci/mms
steps:
- checkout
- attach_workspace:
at: ~/
- run:
name: Build classes to scan
command: ./gradlew build -x test
command: |
./gradlew build -x test
mkdir -p TEMPORARYclassfiles
cp -r */build/classes/java/main/* TEMPORARYclassfiles/
java -jar jacocoJars/jacococli.jar report jacocoOutput/jacoco-it.exec --classfiles TEMPORARYclassfiles/ --xml ./jacocoOutput/jacocoXMLReport
rm -r TEMPORARYclassfiles
- sonarcloud/scan

deploy_snapshot:
Expand Down Expand Up @@ -87,6 +101,8 @@ workflows:
tags:
only: /[0-9.]+(-(a|b|rc)[0-9]+)?/
- scan:
requires:
- build_and_test
filters:
tags:
only: /[0-9.]+(-(a|b|rc)[0-9]+)?/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN ./gradlew --no-daemon bootJar --warning-mode all

RUN find . -type f -name example-*.jar -not -iname '*javadoc*' -not -iname '*sources*' -exec cp '{}' '/app.jar' ';'
ENV JDK_JAVA_OPTIONS "-XX:MaxRAMPercentage=90.0"
ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-jar", "/app.jar"]
ENTRYPOINT ["java", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-javaagent:jacocoJars/jacocoagent.jar=destfile=jacocoOutput/jacoco-it.exec,output=file", "-jar", "/app.jar"]
EXPOSE 8080
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ sonar.projectKey=Open-MBEE_exec-mms
sonar.organization=openmbee
sonar.language=java
sonar.java.binaries=**/build/classes/java/main
sonar.coverage.jacoco.xmlReportPaths=jacocoOutput/jacocoXMLReport

0 comments on commit 83ec1f6

Please sign in to comment.