“漂亮” Python的连续集成 [英] "Pretty" Continuous Integration for Python

查看:186
本文介绍了“漂亮” Python的连续集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个稍微有点问题,但是BuildBot的输出不是特别好看。



例如,与..





..和其他人, BuildBot 看起来相当.. archaic



我目前正在玩Hudson,但它是非常以Java为中心的(虽然本指南,我发现它比BuildBot更容易设置,并产生更多的信息) / p>

基本上:有没有针对python的连续集成系统,它产生了大量闪亮的图形等等?






更新:自从这次Jenkins项目已经取代了Hudson作为社区版本的包。原始作者也搬到这个项目。 Jenkins现在是Ubuntu / Debian,RedHat / Fedora / CentOS等标准软件包。以下更新仍然基本正确。使用 Jenkins 执行此操作的起点不同。



更新: 在尝试了几种替代方法后,我想我会坚持使用Hudson。 诚信是好和简单,但相当有限。我认为 Buildbot 更适合拥有众多的构建奴隶,而不是像在一个单一的机器上运行的一切使用它。



为Python项目设置Hudson非常简单:




  • http://hudson-ci.org/ 下载Hudson

  • 使用运行它$ java -jar hudson.war

  • 打开默认地址为 http:// localhost:8080

  • 前往管理Hudson,插件,按一下[更新]或类似项目

  • Git插件(我必须在Hudson全局首选项中设置 git 路径)

  • 创建一个新项目, SCM轮询时间间隔等。

  • 如果不是,请安装 nosetests 通过 easy_install 已经

  • 在构建步骤中,添加 nosetests --with-xunit --verbose

  • 选中发布JUnit测试结果报告并将测试报告XML设置为 ** / nosetests.xml



这是所有必需的。您可以设置电子邮件通知,插件值得一看。我目前使用的几个Python项目:




  • SLOCCount插件来计算代码行(并绘制它!) - 您需要安装 sloccount

  • 违规来解析PyLint输出(您可以设置警告阈值,绘制每个版本中的违规数)

  • Cobertura 可以解析coverage.py输出。 Nosetest可以在运行测试时使用 nosetests --with-coverage (这将输出写入 ** / coverage.xml


解决方案

您可能想查看鼻子 Xunit输出插件。您可以使用此命令运行单元测试和覆盖检查:

  nosetests --with-xunit --enable-覆盖

这将有助于如果你想去Jenkins路线,另一个CI服务器支持JUnit测试报告。



同样,你可以使用 Jenkins的abuse插件


This is a slightly.. vain question, but BuildBot's output isn't particularly nice to look at..

For example, compared to..

..and others, BuildBot looks rather.. archaic

I'm currently playing with Hudson, but it is very Java-centric (although with this guide, I found it easier to setup than BuildBot, and produced more info)

Basically: is there any Continuous Integration systems aimed at python, that produce lots of shiny graphs and the likes?


Update: Since this time the Jenkins project has replaced Hudson as the community version of the package. The original authors have moved to this project as well. Jenkins is now a standard package on Ubuntu/Debian, RedHat/Fedora/CentOS, and others. The following update is still essentially correct. The starting point to do this with Jenkins is different.

Update: After trying a few alternatives, I think I'll stick with Hudson. Integrity was nice and simple, but quite limited. I think Buildbot is better suited to having numerous build-slaves, rather than everything running on a single machine like I was using it.

Setting Hudson up for a Python project was pretty simple:

  • Download Hudson from http://hudson-ci.org/
  • Run it with java -jar hudson.war
  • Open the web interface on the default address of http://localhost:8080
  • Go to Manage Hudson, Plugins, click "Update" or similar
  • Install the Git plugin (I had to set the git path in the Hudson global preferences)
  • Create a new project, enter the repository, SCM polling intervals and so on
  • Install nosetests via easy_install if it's not already
  • In the a build step, add nosetests --with-xunit --verbose
  • Check "Publish JUnit test result report" and set "Test report XMLs" to **/nosetests.xml

That's all that's required. You can setup email notifications, and the plugins are worth a look. A few I'm currently using for Python projects:

  • SLOCCount plugin to count lines of code (and graph it!) - you need to install sloccount separately
  • Violations to parse the PyLint output (you can setup warning thresholds, graph the number of violations over each build)
  • Cobertura can parse the coverage.py output. Nosetest can gather coverage while running your tests, using nosetests --with-coverage (this writes the output to **/coverage.xml)

解决方案

You might want to check out Nose and the Xunit output plugin. You can have it run your unit tests, and coverage checks with this command:

nosetests --with-xunit --enable-cover

That'll be helpful if you want to go the Jenkins route, or if you want to use another CI server that has support for JUnit test reporting.

Similarly you can capture the output of pylint using the violations plugin for Jenkins

这篇关于“漂亮” Python的连续集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆