Skip to content

Commit

Permalink
Adde code coverage
Browse files Browse the repository at this point in the history
With Travis-CI and Codacy integration.

Fixes #19
  • Loading branch information
sverhoeven committed Jan 20, 2017
1 parent d8ad503 commit 08e017c
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cache:
- $HOME/.m2
- $HOME/.cache/pip
- $HOME/conda
- $HOME/jpm
before_install:
- if [ ! -e $HOME/conda/bin/activate ]; then
wget -nc https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh;
Expand All @@ -17,3 +18,7 @@ install:
- pip install git+https://github.com/3D-e-Chem/kripodb.git
- mvn package -B
script: xvfb-run mvn verify -B
before_cache:
- wget -nc -O ~/.m2/jpm4j.jar https://github.com/jpm4j/jpm4j.installers/raw/master/dist/biz.aQute.jpm.run.jar
- java -jar $HOME/.m2/jpm4j.jar -u install com.codacy:codacy-coverage-reporter:assembly
- $HOME/jpm/bin/codacy-coverage-reporter -l Java -r tests/target/jacoco/report/jacoco.xml
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Formatted as described on http://keepachangelog.com/
### Added

- kripodb Python installation instruction in node description (#16)
- code coverage (#19)

### Changed

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[![Build Status](https://travis-ci.org/3D-e-Chem/knime-kripodb.svg?branch=master)](https://travis-ci.org/3D-e-Chem/knime-kripodb)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bde4d072a1874e7abae252b1e46a9c3a)](https://www.codacy.com/app/3D-e-Chem/knime-kripodb?utm_source=github.com&utm_medium=referral&utm_content=3D-e-Chem/knime-kripodb&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/bde4d072a1874e7abae252b1e46a9c3a)](https://www.codacy.com/app/3D-e-Chem/knime-kripodb?utm_source=github.com&utm_medium=referral&utm_content=3D-e-Chem/knime-kripodb&utm_campaign=Badge_Coverage)
[![DOI](https://zenodo.org/badge/19641/3D-e-Chem/knime-kripodb.svg)](https://zenodo.org/badge/latestdoi/19641/3D-e-Chem/knime-kripodb)

# Installation
Expand Down
91 changes: 89 additions & 2 deletions tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,101 @@

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<include>nl.esciencecenter.e3dchem.kripodb.*</include>
</configuration>
</execution>
</executions>
</plugin>
<!-- the report goal of jacoco-maven-plugin plugin shows coverage of tests.
To get coverage of ../plugin/src/ use the jacoco ant reporter. See https://intellectualcramps.wordpress.com/2012/03/22/jacoco-tycho-and-coverage-reports/ -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
<version>0.7.8</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>jacoco-report</id>
<phase>verify</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property name="source-location" location="../" />
<taskdef name="jacoco-report" classname="org.jacoco.ant.ReportTask"
classpathref="maven.plugin.classpath" />
<taskdef classpathref="maven.runtime.classpath"
resource="net/sf/antcontrib/antcontrib.properties" />
<available file="${project.basedir}/target/jacoco.exec"
property="jacoco.exec.file.exists" />
<echo message="${project.basedir}/target/jacoco.exec" />
<if>
<equals arg1="${jacoco.exec.file.exists}" arg2="true" />
<then>
<echo message="Executing jacoco report" />
<echo message="${source-location}" />
<trycatch>
<try>
<jacoco-report>
<executiondata>
<file file="${project.basedir}/target/jacoco.exec" />
</executiondata>

<structure name="plugin">
<classfiles>
<fileset dir="${source-location}/plugin/target/classes" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${source-location}/plugin/src/java" />
</sourcefiles>
</structure>
<html destdir="${project.basedir}/target/jacoco/report" />
<xml destfile="${project.basedir}/target/jacoco/report/jacoco.xml" />
</jacoco-report>
</try>
<catch>
<echo>skipping</echo>
</catch>
</trycatch>
</then>
<else>
<echo message="No jacoco.exec file found." />
</else>
</if>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<argLine>${tycho.test.jvmArgs}</argLine>
<argLine>${tycho.testArgLine} ${tycho.test.jvmArgs}</argLine>
</configuration>

</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 08e017c

Please sign in to comment.