Integrating RapiCover with Atlassian Bamboo

April 4th, 2017

In this post, we describe how to integrate RapiCover with Bamboo, the continuous integration service from Atlassian. 

If RapiCover is already integrated into your build system and your builds are managed by Bamboo, you can integrate RapiCover with Bamboo so that Bamboo tracks code coverage data and archives a code coverage report for each build you run.

Creating a coverage batch file

First, create a batch file. Let’s call it rvd2bamboo.bat and place it somewhere in your build system, for example alongside your top level makefiles or other scripts.

The batch file should contain the following:

set RVDFILE=<path_to_your_RapiCover_rvd_file.rvd>

set RVSPATH=<path_to_RVS_installation>

set DEST=%bamboo_build_working_directory%\target\site

md %bamboo_build_working_directory%\target

md %bamboo_build_working_directory%\target\site

md %DEST%\clover

md %DEST%\rapicover


REM Archive the RapiCover report

copy /y %RVDFILE% %DEST%\rapicover\rapicover.rvd

REM Create the clover summary from the RapiCover report

%RVSPATH%\bin\covexport %RVDFILE% --fmt clover -o %DEST%\clover\clover.xml

Let’s assume your file is C:\mybuilds\rvd2bamboo.bat.

Configuring a project

The next step is to create a new job to your build plan. To do this, click the edit button for an existing build plan.

You can now add a coverage job to a stage of the plan you configured previously. Click Add Job to create a coverage job.

Click on the new job's name to access its configuration options.

First, click Add task to configure a new task. Select Command and type the name of the batch file you created earlier in the Executable label field. 

Next, in the Miscellaneous tab, check Use Clover to collect Code Coverage for this build and set the Clover XML Location to target\site\clover\clover.xml.

Finally, in the Artifacts tab, click Create definition and add the artifact shown below.

Building and collecting coverage data

When you run the plan your configured, the coverage job will be executed at the end of the build and your coverage report will be saved in both RapiCover and Clover formats. 

You can now access detailed RapiCover reports for each build in the Artifacts tab, and view summary coverage data in the Reports menu, under Clover Code Coverage.

If anything goes wrong, you can identify the issue using the log for the job.

Notes:

  • Requires RVS version 3.3a minimum.
  • Tested on Bamboo version 5.8.1
Antoine Colin

Categories