From 91667b58a94524284a9f3a4ab3088a84f2570021 Mon Sep 17 00:00:00 2001 From: Deanna Date: Tue, 7 Apr 2015 00:50:11 -0400 Subject: [PATCH] Add support for Scoverage plugin The Jenkins Scoverage plugin allows one to publish Jenkins scoverage results as a trend graph. It allows the following options to be configured: *the location where the xml report is generated *the name of the xml report file Change-Id: I2529fe69f6dc26b79390f19129411554ccb650c9 --- jenkins_jobs/modules/publishers.py | 24 +++++++++++++++++++++ setup.cfg | 1 + tests/publishers/fixtures/scoverage001.xml | 9 ++++++++ tests/publishers/fixtures/scoverage001.yaml | 4 ++++ 4 files changed, 38 insertions(+) create mode 100644 tests/publishers/fixtures/scoverage001.xml create mode 100644 tests/publishers/fixtures/scoverage001.yaml diff --git a/jenkins_jobs/modules/publishers.py b/jenkins_jobs/modules/publishers.py index b6eea1c6c..37878e554 100644 --- a/jenkins_jobs/modules/publishers.py +++ b/jenkins_jobs/modules/publishers.py @@ -3985,6 +3985,30 @@ def conditional_publisher(parser, xml_parent, data): raise JenkinsJobsException('action must be set for each condition') +def scoverage(parser, xml_parent, data): + """yaml: scoverage + Publish scoverage results as a trend graph. + Requires the Jenkins :jenkins-wiki:`Scoverage Plugin `. + + :arg str report-directory: This is a directory that specifies the locations + where the xml scoverage report is generated + :arg str report-file: This is a file name that is given to the xml + scoverage report. + + Example: + + .. literalinclude:: /../../tests/publishers/fixtures/scoverage001.yaml + :language: yaml + """ + scoverage = XML.SubElement( + xml_parent, + 'org.jenkinsci.plugins.scoverage.ScoveragePublisher') + XML.SubElement(scoverage, 'reportDirectory').text = str( + data.get('report-directory', '')) + XML.SubElement(scoverage, 'reportFile').text = str( + data.get('report-file', '')) + + class Publishers(jenkins_jobs.modules.base.Base): sequence = 70 diff --git a/setup.cfg b/setup.cfg index 7b36c20c7..f31989b62 100644 --- a/setup.cfg +++ b/setup.cfg @@ -169,6 +169,7 @@ jenkins_jobs.publishers = ruby-metrics=jenkins_jobs.modules.publishers:ruby_metrics s3=jenkins_jobs.modules.publishers:s3 scan-build=jenkins_jobs.modules.publishers:scan_build + scoverage=jenkins_jobs.modules.publishers:scoverage scp=jenkins_jobs.modules.publishers:scp shining-panda=jenkins_jobs.modules.publishers:shining_panda sitemonitor=jenkins_jobs.modules.publishers:sitemonitor diff --git a/tests/publishers/fixtures/scoverage001.xml b/tests/publishers/fixtures/scoverage001.xml new file mode 100644 index 000000000..b421ac704 --- /dev/null +++ b/tests/publishers/fixtures/scoverage001.xml @@ -0,0 +1,9 @@ + + + + + target/scala-2.10/scoverage-report/ + scoverage.xml + + + diff --git a/tests/publishers/fixtures/scoverage001.yaml b/tests/publishers/fixtures/scoverage001.yaml new file mode 100644 index 000000000..65e8477cf --- /dev/null +++ b/tests/publishers/fixtures/scoverage001.yaml @@ -0,0 +1,4 @@ +publishers: + - scoverage: + report-directory: target/scala-2.10/scoverage-report/ + report-file: scoverage.xml