Add continuous integration/test coverage reporting.

Issue #105 resolved
Hendrik Schreiber created an issue

Hey there,

Services like http://drone.io/ offer free continuous integration (CI) services for open source Java projects hosted on bitbucket.

Integration is super-easy, I have just tried with my own fork of jaudiotagger. The only thing that didn't work right away, was some javadoc flag, but I was able to work around it using -Dmaven.javadoc.skip=true as additional maven flag in the build settings.

As a second step, one could convert the README.txt file to Markdown README.md and add build status badges as described here.

As a third step, the coverall maven plugin at https://github.com/trautonen/coveralls-maven-plugin may also be interesting to put a test coverage badge in the README.md. Again, the build settings would have to be slightly adjusted and the plugin would have to be added to the pom.xml, but it looks very simple.

Since both services require an account for the repo admin, this is not something I can easily do via a simple fork/pull request. But it would make quality control, especially when accepting pull requests, a little easier, I think.

Cheers,

-hendrik

Comments (27)

  1. IJabz repo owner

    Hi, not quite sure what continuous integration adds on top on me just running mvn install, and actualy ther e is an issue some tests reply on testfiles that I cant check into source control so I have to run locally anyway.

    I dont mind if README.txt is changed to Markdown but could you do it.

    The pom.xml aready has some integration with cobertura but I must admit Ive not run that for some time, http://www.jthink.net/jaudiotagger/maven/cobertura/index.html are you recommending coverall as a replacement for that ?

  2. Hendrik Schreiber reporter

    It does not add per se, just makes it a little easier and offers a little redundancy. Builds are triggered on any commit and every build is done on a clean checkout—something I bet you don't do every time when you build locally. So this way you can catch files you forgot to actually check in. It helps avoiding the "works on my machine pitfall".

    It's just an idea and takes all of 10 minutes of work. Signup for drone.io with your bitbucket account, import your repos, add the maven javadoc skip flags to the settings. Done.

    I dont mind if README.txt is changed to Markdown but could you do it.

    Yes, I could. And would, if you're interested in adding those badges (purely for show).

    Coveralls is not a replacement for cobertura.

    Instead, it is a service that displays the cobertura reports of the automated CI build. To enable the integration, you need to add a line like:

    mvn clean cobertura:cobertura coveralls:report -DrepoToken=yourcoverallsprojectrepositorytoken
    

    to the drone.io settings and add the coveralls maven plugin https://github.com/trautonen/coveralls-maven-plugin to the pom. That's it, as far as I know.

    Once enabled, test coverage reports should automatically be created on every commit.

    I'm happy to do the parts I can do (pom changes, README.txt -> README.md). But I cannot do it all AFAIK (accounts signup).

  3. Hendrik Schreiber reporter

    Thanks for merging the pull request! :-)

    Now only signup for Coveralls/Drone.io and settings configuration is needed.

  4. IJabz repo owner

    Hi, okay Ive signed up to both, added jaudiotagger repos to both and done a couple of builds. But nothing seems to be triggering anyhting to happen on coverall ?

  5. Hendrik Schreiber reporter

    What do your drone.io settings look like? Have you added something like:

    mvn clean cobertura:cobertura coveralls:report -DrepoToken=yourcoverallsprojectrepositorytoken
    

    at the end, to trigger the cobertura report? You can find the actual repo token on the Coveralls page for your jaudiotagger repo.

  6. Hendrik Schreiber reporter

    BTW: node.io let's you automatically upload the latest build artifact (i.e. jaudiotagger-SNAPSHOT-X.Y.Z.jar) to make it publicly available.

    The configuration seems dead-simple: http://docs.drone.io/artifacts.html

    Perhaps that's interesting to folks who don't use Maven.

  7. IJabz repo owner

    No I just did what you told me ! Okay I ve added that line with my repotoken and started a build off we will see what happens

  8. IJabz repo owner

    It caused the test to fail with 'Maximum output exceeded', maybe a limitation of drone.io Im thinking I may just not do the coveralls bit because it doesnt reflect the real test coverage anyway as I ran many tests locally that wont be performed on drone.io because they rely on test audio files that I cant checkin

  9. IJabz repo owner

    Regarding artifacts it does look easy to configure them bu then I would still have to download them and upload them upto bitbuckets download page anyway wouldnt I ?

  10. IJabz repo owner

    Heh Coverage showing something now, but all the builds with coverage failed. I had to disbale coverage line in drone.io to allow build to run again.

  11. Hendrik Schreiber reporter

    It caused the test to fail with 'Maximum output exceeded', maybe a limitation of drone.io Im thinking I may just not do the coveralls bit because it doesnt reflect the real test coverage anyway as I ran many tests locally that wont be performed on drone.io because they rely on test audio files that I can't checkin

    I ran it locally and the issue was a missing plugin configuration in the pom.xml. I just sent you a pull request to fix this.

    Currently you see a coverage of 70%, as a result of my manual build.

    Regarding artifacts it does look easy to configure them bu then I would still have to download them and upload them upto bitbuckets download page anyway wouldnt I ?

    If that's where you want them. Yes. If you just want a simply, free, automatic artifact archive. No.

    I'd see it as something extra.

  12. Hendrik Schreiber reporter

    With the pom.xml merged, you'd need to re-add that line:

    mvn clean cobertura:cobertura coveralls:report -DrepoToken=yourcoverallsprojectrepositorytoken
    

    to the node.io settings ...and cross your fingers that it then works. Perhaps -Dmaven.javadoc.skip=true is also needed. Don't know.

    It worked for me locally (without the javadoc.skip flag)—but we all know that the usefulness of such a statement is limited. ;-)

  13. IJabz repo owner

    If you just want a simply, free, automatic artifact archive. No. But I dont get how would anyone else see them if just on drone.io ?

  14. IJabz repo owner

    Right build has suceeded (still says maximum output exceeded) but that must just refer to the UI it provides so I cant see the completion of the build but it must have worked thatnks to your fix.

    One thing, Im confused you said earlier that Cobertura 70% was due to your local run I dont see how you would be able to effect my repo in this way ?

  15. Hendrik Schreiber reporter

    One thing, Im confused you said earlier that Cobertura 70% was due to your local run I dont see how you would be able to effect my repo in this way ?

    I was able to see, but not manipulate, the build settings on drone.io. So I snatched the coveralls repo token and used it locally. So all I was able to touch was the Coveralls report. Nothing else.

    But I dont get how would anyone else see them if just on drone.io ?

    Not unless you link to it from somewhere. You could add a latest build link to the website for example.

  16. Hendrik Schreiber reporter

    In any case - nice this is working now and the badges appear. Thanks for humoring me! :-)

    I have to admit, I got excited about discovering today how easy it is and figured jaudiotagger is a great project to apply this to. That, and the whole thing is quite hip these days...

  17. IJabz repo owner

    HI, I added this to artifacts

    target/jaudiotagger-2.2.6-SNAPSHOT.jar

    target/jaudiotagger-2.2.6-SNAPSHOT-sources.jar

    target/jaudiotagger-2.2.6-SNAPSHOT-javadoc.jar

    but hasnt worked

  18. Hendrik Schreiber reporter

    Just sent you a pull request with a new setting for node.io that hopefully fixes this.

  19. Hendrik Schreiber reporter

    Yes. Thanks.

    BTW: As far as I know, the -Xdoclint:none parameter in the pom is not supported by Java 7, that's why it only builds with Java 8. Perhaps that means that we should write something like:

    Requires Java 7 to run. Requires Java 8 to build.

    Just a thought.

  20. Log in to comment