-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Analyze code quality with Sonar during Travis CI build
Sonar analysis is only run when the branch belongs to the pitest/pitclipse repository. Indeed, sending the results of the the analysis to SonarCloud requires the encrypted SONAR token which is not provided by Travis CI when the build comes from a fork. The code checking whether the analysis can be run is located in .travis/build.sh and is called by the .travis.yml configuration file. I also struggled a bit to encrypt the token because encryption on travis-ci.com is different from encryption on travis-ci.org. For the record here is what I did: > travis login --pro > travis encrypt --pro <token> -r pitest/pitclipse
- Loading branch information
Showing
6 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# IF the variable is set, we can run Sonar analysis. | ||
# Indeed, that means that the build is performed on a branch of the | ||
# pitest/pitclipse repository and that Travis CI allows us to use | ||
# encrypted variables (e.g. Sonar's token) | ||
if [ "${SONAR_SCANNER_HOME}" != "" ]; then | ||
COMMAND="mvn verify -P jacoco sonar:sonar"; | ||
|
||
# ELSE we cannot run Sonar analysis because the branch is coming | ||
# from a fork and Travis CI does not allow use to use encrypted variables. | ||
else | ||
COMMAND="mvn verify -P jacoco"; | ||
fi | ||
|
||
echo ${COMMAND} | ||
${COMMAND} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
sonar.projectName=Pitclipse | ||
sonar.projectKey=org.pitest:org.pitest.pitclipse | ||
|
||
# ===================================================== | ||
# Meta-data for the project | ||
# ===================================================== | ||
|
||
sonar.links.ci=https://travis-ci.com/pitest/pitclipse | ||
sonar.links.scm=https://github.com/pitest/pitclipse | ||
sonar.links.issue=https://github.com/pitest/pitclipse/issues | ||
|
||
|
||
# ===================================================== | ||
# Properties that will be shared amongst all modules | ||
# ===================================================== | ||
|
||
sonar.host.url=https://sonarcloud.io | ||
|
||
# ===================================================== | ||
# Java config | ||
# ===================================================== | ||
|
||
sonar.java.source=8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.pitest</groupId> | ||
<artifactId>org.pitest.pitclipse.tests</artifactId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>io.cucumber</artifactId> | ||
<packaging>eclipse-plugin</packaging> | ||
<version>4.3.0</version> | ||
|
||
<properties> | ||
<sonar.skip>true</sonar.skip> | ||
</properties> | ||
</project> |