forked from plone/buildout.jenkins
/
jenkins.cfg
72 lines (65 loc) · 2.61 KB
/
jenkins.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# -----------------------------------------------------------------------------
# JENKINS BUILDOUT FOR PLONE PROJECTS
# -----------------------------------------------------------------------------
[buildout]
parts +=
zopepy
instance
jenkins-test
jenkins-test-coverage
coverage
# These values need to be overridden in the buildout file that extends this
# buildout.
package-name =
package-directory =
[instance]
eggs += ${buildout:package-name}
[zopepy]
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
scripts = zopepy
# -----------------------------------------------------------------------------
# JENKINS TESTS
# -----------------------------------------------------------------------------
# Creates a "jenkins-test" script in the bin directory of the buildout that
# runs the tests and outputs the results in an XML format that Jenkins can read
# and process.
#
# The output files can be included in Jenkins by enabling the
# "Publish JUnit test result report" setting in the "Post-build Actions"
# section of the Job configuration. The "Test report XMLs" field needs to point
# to "parts/jenkins-tests/testreports/*.xml".
# -----------------------------------------------------------------------------
[jenkins-test]
recipe = collective.xmltestreport
eggs = ${buildout:package-name} [test]
script = jenkins-test
defaults = ['--auto-color', '--auto-progress', '--xml']
# -----------------------------------------------------------------------------
# JENKINS TEST COVERAGE
# -----------------------------------------------------------------------------
# Creates a "jenkins-test-coverage" script in the bin directory of the buildout
# that runs a code coverage analysis and creates a report in an XML format that
# Jenkins can read and process. There is no need to run "bin/jenkins-test"
# before
[jenkins-test-coverage]
recipe = collective.recipe.template
input = inline:
#!/bin/sh
echo "Test coverage analysis started."
# Runs a code coverage analysis on top of the "jenkins-test" script. This will
# create a ".coverage" output file in the buildout directory.
bin/coverage run --source=${buildout:package-directory} bin/jenkins-test --all
echo "Test coverage analysis finished."
echo "Test coverage report started."
# Generates a "coverage.xml" file that Jenkins can read and process from the
# ".coverage" file that the coverage report created.
bin/coverage xml -i
echo "Test coverage report finished."
output = ${buildout:directory}/bin/jenkins-test-coverage
mode = 755
[coverage]
recipe = zc.recipe.egg
eggs = coverage
interpreter = ${buildout:directory}/bin/zopepy