Add support for CodeCover plugin

Change-Id: I2dc7a8e992e9c148742e4824c17c3f61ee616585
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-25 14:10:53 -04:00
parent a88104422e
commit 9d4eac085d
5 changed files with 98 additions and 0 deletions

View File

@ -298,6 +298,55 @@ def campfire(parser, xml_parent, data):
XML.SubElement(room, 'campfire reference="../../campfire"')
def codecover(parser, xml_parent, data):
"""yaml: codecover
This plugin allows you to capture code coverage report from CodeCover.
Jenkins will generate the trend report of coverage.
Requires the Jenkins :jenkins-wiki:`CodeCover Plugin <CodeCover+Plugin>`.
:arg str include: Specify the path to the CodeCover HTML report file,
relative to the workspace root (default '')
:arg int min-statement: Minimum statement threshold (default 0)
:arg int max-statement: Maximum statement threshold (default 90)
:arg int min-branch: Minimum branch threshold (default 0)
:arg int max-branch: Maximum branch threshold (default 80)
:arg int min-loop: Minimum loop threshold (default 0)
:arg int max-loop: Maximum loop threshold (default 50)
:arg int min-condition: Minimum condition threshold (default 0)
:arg int max-condition: Maximum conditon threshold (default 50)
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/codecover-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/codecover-full.yaml
:language: yaml
"""
codecover = XML.SubElement(
xml_parent, 'hudson.plugins.codecover.CodeCoverPublisher')
codecover.set('plugin', 'codecover')
XML.SubElement(codecover, 'includes').text = str(data.get('include', ''))
health_report = XML.SubElement(codecover, 'healthReports')
mapping = [
('min-statement', 'minStatement', 0),
('max-statement', 'maxStatement', 90),
('min-branch', 'minBranch', 0),
('max-branch', 'maxBranch', 80),
('min-loop', 'minLoop', 0),
('max-loop', 'maxLoop', 50),
('min-condition', 'minCondition', 0),
('max-condition', 'maxCondition', 50),
]
helpers.convert_mapping_to_xml(
health_report, data, mapping, fail_required=True)
def emotional_jenkins(parser, xml_parent, data):
"""yaml: emotional-jenkins
Emotional Jenkins. This funny plugin changes the expression of Mr. Jenkins

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.codecover.CodeCoverPublisher plugin="codecover">
<includes>./path/report.html</includes>
<healthReports>
<minStatement>1</minStatement>
<maxStatement>100</maxStatement>
<minBranch>2</minBranch>
<maxBranch>90</maxBranch>
<minLoop>3</minLoop>
<maxLoop>80</maxLoop>
<minCondition>4</minCondition>
<maxCondition>70</maxCondition>
</healthReports>
</hudson.plugins.codecover.CodeCoverPublisher>
</publishers>
</project>

View File

@ -0,0 +1,11 @@
publishers:
- codecover:
include: ./path/report.html
min-statement: 1
max-statement: 100
min-branch: 2
max-branch: 90
min-loop: 3
max-loop: 80
min-condition: 4
max-condition: 70

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.codecover.CodeCoverPublisher plugin="codecover">
<includes/>
<healthReports>
<minStatement>0</minStatement>
<maxStatement>90</maxStatement>
<minBranch>0</minBranch>
<maxBranch>80</maxBranch>
<minLoop>0</minLoop>
<maxLoop>50</maxLoop>
<minCondition>0</minCondition>
<maxCondition>50</maxCondition>
</healthReports>
</hudson.plugins.codecover.CodeCoverPublisher>
</publishers>
</project>

View File

@ -0,0 +1,2 @@
publishers:
- codecover