This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
jenkins.cfg
113 lines (106 loc) · 4.62 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -----------------------------------------------------------------------------
# JENKINS BUILDOUT FOR PLONE PROJECTS
# -----------------------------------------------------------------------------
# This buildout needs to be extended by overriding the
# jenkins-test-eggs variable. See README.txt for more details.
# -----------------------------------------------------------------------------
[buildout]
parts +=
zopepy
jenkins-test
jenkins-test-robot
jenkins-test-coverage
coverage
# This value needs to be overridden in the buildout file that extends this
# buildout.
jenkins-test-eggs =
jenkins-test-directories =
[zopepy]
recipe = zc.recipe.egg
eggs = ${buildout:jenkins-test-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-test/testreports/*.xml".
# -----------------------------------------------------------------------------
[jenkins-test]
recipe = collective.xmltestreport
eggs = ${buildout:jenkins-test-eggs}
script = jenkins-test
environment = jenkins-test-env
relative-paths = true
# XXX: For now we run robot tests together with all other tests
#defaults = ['--auto-color', '--auto-progress', '--xml', '-t', '!robot_']
defaults = ['--auto-color', '--auto-progress', '--xml', '--ignore_dir=bower_components', '--ignore_dir=node_modules']
[jenkins-test-env]
zope_i18n_compile_mo_files = true
BUILDOUT_DIR = ${buildout:directory}
ROBOTSUITE_LOGLEVEL = ERROR
# -----------------------------------------------------------------------------
# JENKINS ROBOT TESTS: XXX: Not working yet!!!
# -----------------------------------------------------------------------------
# Creates a "jenkins-test-robot" 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 Robot Framework test results" setting in the "Post-build Actions"
# section of the Job configuration. You then have to set fields as shown below:
# - Directory of Robot output: parts/test
# - Log/Report link: robot_log.html
# - Output xml name: robot_output.xml
# - Report html name: robott_report.html
# - Log html name: robot_log.html
# -----------------------------------------------------------------------------
[jenkins-test-robot]
<= jenkins-test
script = jenkins-test-robot
environment = jenkins-test-env
defaults = ['--auto-color', '--auto-progress', '--xml', '-t', 'robot_', '--ignore_dir=bower_components', '--ignore_dir=node_modules']
# -----------------------------------------------------------------------------
# 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
# Remove old results
echo "Erase old coverage results."
bin/coverage erase
# Collect test coverage results for all packages
echo "Run test coverage analysis for all packages."
DIRECTORIES="${buildout:jenkins-test-directories}"
for pkgdir in $DIRECTORIES
do
# Runs a code coverage analysis on top of the "jenkins-test" script for
# all packages. The data will be collected in a ".coverage" output file
# in the buildout directory.
echo "Analyse $pkgdir"
bin/coverage run -p --source=$pkgdir bin/jenkins-test --all
done
echo "Create test coverage report."
# Combine all package analysis
bin/coverage combine
# Generates a "coverage.xml" file that Jenkins can read and process from the
# ".coverage" file that the coverage report created.
bin/coverage xml -i -o ${buildout:directory}/parts/jenkins-test/coverage.xml
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