# ----------------------------------------------------------------------------- # 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