Skip to content

Commit

Permalink
Relative path for JaCoCo reports, test out to file, pass branch to Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeEdgar committed Feb 6, 2020
1 parent e936df2 commit 79a3784
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ci_coverage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

if [[ $(bc -l <<< "$(java -version 2>&1 | awk -F '\"' '/version/ {print $2}' | awk -F'.' '{print $1"."$2}') >= 11") -eq 1 ]]; then
mvn -Pcoverage -B verify sonar:sonar -Dsonar.projectKey=xlate_property-inject
export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo "pull-request-$TRAVIS_PULL_REQUEST"; fi)
mvn -Pcoverage -B verify sonar:sonar -Dsonar.projectKey=xlate_property-inject -Dsonar.branch.name=$BRANCH
else
echo "Not Java 11"
fi
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco/jacoco.xml,${project.build.directory}/site/jacoco-it/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
</properties>

<dependencies>
Expand Down Expand Up @@ -141,6 +141,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<environmentVariables>
<INJECTED_VARIABLE>This value was set as an environment variable!</INJECTED_VARIABLE>
<STRING7>string7value.env</STRING7>
Expand All @@ -158,6 +159,7 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<environmentVariables>
<INJECTED_VARIABLE>This value was set as an environment variable!</INJECTED_VARIABLE>
<STRING7>string7value.env</STRING7>
Expand Down

0 comments on commit 79a3784

Please sign in to comment.