Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/coverage report #557

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/pipelines/azure-devops/pipeline_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ createNewBranch

copyYAMLFile

add_jacoco_dependency

copyCommonScript

type copyScript &> /dev/null && copyScript
Expand Down
36 changes: 36 additions & 0 deletions scripts/pipelines/common/pipeline_generator.lib
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ function commitCommonFiles {
# Add the YAML files.
git add "$pipelinePath" -f

# Check if the pom.xml file exists before trying to add it.
if [ -f "pom.xml" ]; then
# Add the changes in the pom.xml file
git add "pom.xml"
fi

# Git commit and push it into the repository.
# changing all files to be executable
find "$pipelinePath" -type f -name '*.sh' -exec git update-index --chmod=+x {} \;
Expand All @@ -292,3 +298,33 @@ function languageVersionVerification {
exit 2
fi
}
function add_jacoco_dependency {
if [[ "$language" == "quarkus"* ]]; then
echo -e "${green}Adding Jacoco plugin dependencies to pom.xml..."
echo -ne ${white}

# Define the Jacoco plugin
jacoco_plugin="<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>"

# Insert the Jacoco plugin into the pom.xml file
perl -i -pe "s|</plugins>|${jacoco_plugin}\n</plugins>|g" "${localDirectory}/pom.xml"
fi
}
2 changes: 1 addition & 1 deletion scripts/pipelines/common/templates/build/quarkus-build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
mvn package -B -Pnative
mvn package -B -Pnative
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
mvn package -B
mvn package -B
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
mvn sonar:sonar -B -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.java.binaries=$PROJECT_PATH/target/classes
mvn sonar:sonar -B -Dsonar.host.url="$SONAR_URL" -Dsonar.login="$SONAR_TOKEN" -Dsonar.java.binaries=$PROJECT_PATH/target/classes -Dsonar.coverage.jacoco.xmlReportPaths=$PROJECT_PATH/target/site/jacoco/jacoco.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
mvn test -B -Dmaven.install.skip=true
mvn test -B -Dmaven.install.skip=true -Djacoco.append=true -Dmaven.test.failure.ignore=true