Enable coveralls on travis (#670)

* enable Sonarcloud
This commit is contained in:
Xiangdong Huang 2019-12-23 15:48:23 +08:00 committed by Jialin Qiao
parent 2b58cab8d3
commit 96fd6d70e3
4 changed files with 215 additions and 22 deletions

View File

@ -191,8 +191,8 @@ matrix:
dist: xenial
jdk: openjdk8
script:
- mvn test -Pcode-coverage -pl '!distribution'
# now, grafana has no tests; spark-* tests are written by scala
- mvn post-integration-test -Pcode-coverage -Pcoveralls -Dservice_name=travis_ci -pl tsfile,client,jdbc,server,session,hadoop,hive-connector
cache:
directories:

158
pom.xml
View File

@ -87,6 +87,7 @@
<jline.version>2.14.5</jline.version>
<jetty.version>9.4.24.v20191120</jetty.version>
<metrics.version>3.2.6</metrics.version>
<javax.xml.bind.version>2.4.0-b180725.0427</javax.xml.bind.version>
<!-- URL of the ASF SonarQube server -->
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>apache</sonar.organization>
@ -209,7 +210,7 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180725.0427</version>
<version>${javax.xml.bind.version}</version>
</dependency>
<dependency>
<groupId>jline</groupId>
@ -638,6 +639,43 @@
</execution>
</executions>
</plugin>
<plugin>
<!-- Separates the unit tests from the integration tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<!-- Include unit tests within integration-test phase. -->
<include>src/test/**/*Test.java</include>
</includes>
<excludes>
<!-- Exclude integration tests within (unit) test phase. -->
<exclude>src/test/**/*IT.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<includes>
<!-- Include integration tests within integration-test phase. -->
<include>src/test/**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
@ -976,6 +1014,7 @@
</plugins>
</build>
</profile>
<!-- code coverage for ut and it, and then merge them together.-->
<profile>
<id>code-coverage</id>
<build>
@ -987,8 +1026,6 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<configuration>
<skip>false</skip>
<destFile>${basedir}/target/coverage-reports/jacoco.exec</destFile>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
@ -1017,24 +1054,133 @@
</rules>
</configuration>
<executions>
<!-- see https://natritmeyer.com/howto/reporting-aggregated-unit-and-integration-test-coverage-with-jacoco/-->
<!-- For UT-->
<execution>
<id>prepare-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-unit-tests.exec</destFile>
<propertyName>surefire.jacoco.args</propertyName>
</configuration>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<id>ut-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports</outputDirectory>
<dataFile>${project.build.directory}/jacoco-unit-tests.exec</dataFile>
<outputDirectory>${project.build.directory}/jacoco-unit-reports</outputDirectory>
</configuration>
</execution>
<!-- For IT-->
<execution>
<id>before-integration-test-execution</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/jacoco-integration-tests.exec</destFile>
<propertyName>failsafe.jacoco.args</propertyName>
</configuration>
</execution>
<execution>
<id>after-integration-test-execution</id>
<phase>integration-test</phase>
<goals>
<goal>report</goal>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-integration-tests.exec</dataFile>
<outputDirectory>${project.build.directory}/jacoco-integration-reports</outputDirectory>
</configuration>
</execution>
<execution>
<id>merge-unit-and-integration</id>
<phase>post-integration-test</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}/</directory>
<includes>
<include>*.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.build.directory}/merged.exec</destFile>
</configuration>
</execution>
<execution>
<id>create-merged-report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/merged.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
<!-- overwrite argLine-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{surefire.jacoco.args} -Xmx1024m</argLine>
</configuration>
</plugin>
<!-- for IT-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<argLine>@{failsafe.jacoco.args} -Xmx1024m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- upload code coverage report to coveralls.io-->
<!-- to enable coveralls locally, you need to get the repoToken from https://coveralls.io/github/apache/incubator-iotdb.
use `mvn post-integration-test -pl hadoop -Pcode-coverage -Pcoveralls -DrepoToken=TOKEN`-->
<profile>
<id>coveralls</id>
<build>
<plugins>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>4.3.0</version>
<executions>
<execution>
<id>report to coveralls</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

View File

@ -28,16 +28,13 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>iotdb-session</artifactId>
<name>IoTDB Session</name>
<properties>
<session.test.skip>false</session.test.skip>
<session.it.skip>${session.test.skip}</session.it.skip>
<session.ut.skip>${session.test.skip}</session.ut.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
@ -58,13 +55,35 @@
</execution>
</executions>
</plugin>
<!--using `mvn test` to run UT, `mvn verify` to run ITs
Reference: https://antoniogoncalves.org/2012/12/13/lets-turn-integration-tests-with-maven-to-a-first-class-citizen/-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${session.ut.skip}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>run-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<skipTests>${session.test.skip}</skipTests>
<skipITs>${session.it.skip}</skipITs>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.iotdb</groupId>
@ -93,4 +112,32 @@
<artifactId>commons-lang</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>skipSessionTests</id>
<activation>
<property>
<name>skipTests</name>
<value>true</value>
</property>
</activation>
<properties>
<session.test.skip>true</session.test.skip>
<session.ut.skip>true</session.ut.skip>
<session.it.skip>true</session.it.skip>
</properties>
</profile>
<profile>
<id>skipUT_SessionTests</id>
<activation>
<property>
<name>skipUTs</name>
<value>true</value>
</property>
</activation>
<properties>
<session.ut.skip>true</session.ut.skip>
</properties>
</profile>
</profiles>
</project>

View File

@ -15,6 +15,6 @@
#specific language governing permissions and limitations
#under the License.
base_dir=target
base_dir=target/tmp
data_dirs=target/data
wal_dir=target/wal