So I've run JaCoCo via the maven plugin, and am trying to pluck out the instruction percentage.
Here's what I have for the NN percentage figure:
cat target/site/jacoco/index.html | xmlstarlet format --indent-tab | xmlstarlet sel -N x="
http://www.w3.org/1999/xhtml" -t -m "//x:tfoot" -v . | grep % | head -1 | xargs | tr -d '%'
Then, I'll take an template SVG with the figure in it like so:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "
http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="
http://www.w3.org/2000/svg" xmlns:dc="
http://purl.org/dc/elements/1.1/" xmlns:xl="
http://www.w3.org/1999/xlink" version="1.1" viewBox="314.084 115 32.832 30" width="32.832" height="30">
<defs>
<font-face font-family="Helvetica Neue" font-size="16" panose-1="2 0 5 3 0 0 0 2 0 4" units-per-em="1000" underline-position="-100" underline-thickness="50" slope="0" x-height="517" cap-height="714" ascent="951.9958" descent="-212.99744" font-weight="400">
<font-face-src>
<font-face-name name="HelveticaNeue"/>
</font-face-src>
</font-face>
</defs>
<g id="Canvas_1" fill-opacity="1" stroke="none" stroke-dasharray="none" fill="none" stroke-opacity="1">
<title>Canvas 1</title>
<g id="Canvas_1: Layer 1">
<title>Layer 1</title>
<g id="Graphic_2">
<text transform="translate(319.084 120)" fill="black">
<tspan font-family="Helvetica Neue" font-size="16" font-weight="400" fill="black" x="0" y="15">NN</tspan>
</text>
</g>
</g>
</g>
</svg>
.. and replace the NN (using sed) to make an SVG with the number in it, and refer to that image as "coverage-percentage.svg" in the README. I'll need to check it in again. Obviously the file only gets committed when the coverage percenage actually changes.
Is there a better way, anyone has evolved? Maybe the SVG piece is solid, and there's a better way of plucking the coverage out the HTML build report (the total is not in the CSV).