You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2020/10/15 07:27:50 UTC

[jackrabbit-filevault] 01/01: JCRVLT-475 enable Sonarcloud.io reporting

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/JCRVLT-475-enable-sonarcloud
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git

commit 9eff7634dc171a46def926a0ba87e4d7902b9a38
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Oct 15 09:27:31 2020 +0200

    JCRVLT-475 enable Sonarcloud.io reporting
---
 .travis.yml    |   8 +++++
 parent/pom.xml | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 2841df4..5e017aa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,6 +52,7 @@ jobs:
        - JDK="adopt@1.8"
        - LANG="de_DE.UTF-8"
        - LC_ALL="de_DE.UTF-8"
+       - POST_COVERAGE=true
 before_install:
   # Download the script
   - curl "${GRAVIS}.install-jdk-travis.sh" --output ~/.install-jdk-travis.sh
@@ -60,10 +61,17 @@ before_install:
   - curl "${GRAVIS}.install-maven.sh" --output ~/.install-maven.sh
   # Download, install, configue the JDK, and export the configuration to the current shell
   - source ~/.install-maven.sh
+addons:
+  sonarcloud:
+    organization: "apache"
+    token:
+      secure: "EMpJMtN+fqjuyy69BByyUc08QGzgYCA8s40HDLofCExA/7i0o8tDMwLm2nVBUO5RNrvK8YDxdNI4P6zRAytws/KIw8WPJG4ycN3OFhaqccZit0zWzHO+JAD3r7rSc7dRTmC3KzeMjEHJbsbKQywLVUuaSy6vf8x5GJT2KG73hIU=" # encrypted value of your token
 # This is your main script
 script:
   # Just an example. Do what you deem useful
   - mvn verify -B
+after_success:
+  - if [ "$POST_COVERAGE" == "true" ]; then mvn -Pjacoco-report clean verify sonar:sonar -Dsonar.projectKey=apache_jackrabbit-filevault; fi
 # If you use Gradle, cleanup the build cache from lock/temporary files
 before_cache:
   #- curl "${GRAVIS}.clean_gradle_cache.sh" --output ~/.clean_gradle_cache.sh
diff --git a/parent/pom.xml b/parent/pom.xml
index 26e606d..1bd3096 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -304,6 +304,11 @@ Bundle-Category: jackrabbit
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>org.jacoco</groupId>
+                    <artifactId>jacoco-maven-plugin</artifactId>
+                    <version>0.8.6</version>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
@@ -596,6 +601,106 @@ Bundle-Category: jackrabbit
                 </pluginManagement>
             </build>
         </profile>
+        <profile>
+            <id>jacoco-report</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.jacoco</groupId>
+                        <artifactId>jacoco-maven-plugin</artifactId>
+                        <configuration>
+                            <propertyName>jacoco.command</propertyName>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <id>prepare-agent</id>
+                                <goals>
+                                    <goal>prepare-agent</goal>
+                                </goals>
+                                <configuration>
+                                    <destFile>${project.build.directory}/jacoco-unit.exec</destFile>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>prepare-agent-integration</id>
+                                <goals>
+                                    <goal>prepare-agent-integration</goal>
+                                </goals>
+                                <configuration>
+                                    <destFile>${project.build.directory}/jacoco-it.exec</destFile>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>report</id>
+                                <goals>
+                                    <goal>report</goal>
+                                </goals>
+                                <configuration>
+                                    <dataFile>${project.build.directory}/jacoco-unit.exec</dataFile>
+                                    <outputDirectory> ${project.reporting.outputDirectory}/jacoco-unit</outputDirectory>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>report-integration</id>
+                                <goals>
+                                    <goal>report-integration</goal>
+                                </goals>
+                                <configuration>
+                                    <dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
+                                    <outputDirectory> ${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>merge-unit-and-it</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>merge</goal>
+                                </goals>
+                                <configuration>
+                                    <fileSets>
+                                        <fileSet>
+                                            <directory>${project.build.directory}</directory>
+                                            <includes>
+                                                <include>jacoco-unit.exec</include>
+                                                <include>jacoco-it.exec</include>
+                                            </includes>
+                                        </fileSet>
+                                    </fileSets>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>report-merged</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>report</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <argLine>${jacoco.command}</argLine>
+                        </configuration>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <argLine>${jacoco.command}</argLine>
+                            <systemPropertyVariables>
+                                <!--
+                                for IT where you need a forked JVM to run the tests you can use this system property to make sure that
+                                the JaCoCo agent correctly instruments your code
+                                 -->
+                                <jacoco.command>${jacoco.command}</jacoco.command>
+                            </systemPropertyVariables>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 
 </project>