Skip to content

Commit

Permalink
Added coverage + Codacy badges
Browse files Browse the repository at this point in the history
Used jacoco maven agent and jacoco ant reporter.
  • Loading branch information
sverhoeven committed Dec 13, 2016
1 parent e42b2b2 commit 234aa85
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ jdk: oraclejdk8
cache:
directories:
- $HOME/.m2
- $HOME/jpm
install: mvn package -B
script: xvfb-run mvn verify -B
after_success:
- curl -sL https://github.com/jpm4j/jpm4j.installers/raw/master/dist/biz.aQute.jpm.run.jar > ~/.m2/jpm4j.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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ KNIME nodes to configure, run and analyze PLANTS protein-ligand docking

PLANTS homepage at http://www.mnf.uni-tuebingen.de/fachbereiche/pharmazie-und-biochemie/pharmazie/pharmazeutische-chemie/pd-dr-t-exner/research/plants.html

Knime node skeleton with sample code as described [here](https://tech.knime.org/developer-guide).

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

This project uses [Eclipse Tycho](https://www.eclipse.org/tycho/) to perform build steps.

Expand Down
96 changes: 93 additions & 3 deletions tests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -13,14 +14,103 @@

<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.knime.plants.*</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="knime-plants/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 234aa85

Please sign in to comment.