Python代码库的持续集成系统。

时间:2021-10-22 21:22:25

I am starting to work on a hobby project with a Python codebase and I would like to set up some form of continuous integration (i.e. running a battery of test-cases each time a check-in is made and sending nag e-mails to responsible persons when the tests fail) similar to CruiseControl or TeamCity.

我开始工作在一个爱好项目与Python代码库和我想建立某种形式的持续集成(即每次运行一个电池的测试用例进行登记和发送电子邮件给负责人唠叨当测试失败)类似于CruiseControl或TeamCity。

I realize I could do this with hooks in most VCSes, but that requires that the tests run on the same machine as the version control server, which isn't as elegant as I would like. Does anyone have any suggestions for a small, user-friendly, open-source continuous integration system suitable for a Python codebase?

我意识到我可以在大多数vcse中使用hook来实现这一点,但是这需要在与版本控制服务器相同的机器上运行测试,这并不像我希望的那样优雅。对于适合Python代码库的小型、用户友好的、开源的连续集成系统,有人有什么建议吗?

7 个解决方案

#1


25  

We run Buildbot - Trac at work. I haven't used it too much since my codebase isn't part of the release cycle yet. But we run the tests on different environments (OSX/Linux/Win) and it sends emails — and it's written in Python.

我们在工作中运行建筑机器人。我还没有过多地使用它,因为我的代码库还不是发布周期的一部分。但是我们在不同的环境(OSX/Linux/Win)上运行测试,它会发送电子邮件——它是用Python编写的。

#2


26  

One possibility is Hudson. It's written in Java, but there's integration with Python projects:

一种可能性是哈德逊。它是用Java编写的,但是与Python项目集成:

Hudson embraces Python

哈德逊拥抱Python

I've never tried it myself, however.

我自己从来没有试过。

(Update, Sept. 2011: After a trademark dispute Hudson has been renamed to Jenkins.)

(2011年9月更新:在一场商标纠纷之后,Hudson被重新命名为Jenkins。)

#3


17  

Second the Buildbot - Trac integration. You can find more information about the integration on the Buildbot website. At my previous job, we wrote and used the plugin they mention (tracbb). What the plugin does is rewriting all of the Buildbot urls so you can use Buildbot from within Trac. (http://example.com/tracbb).

第二,构建bot - Trac集成。您可以在Buildbot网站上找到关于集成的更多信息。在我之前的工作中,我们编写并使用了他们提到的插件(tracbb)。插件所做的就是重写所有的Buildbot url,这样你就可以在Trac中使用Buildbot了。(http://example.com/tracbb)。

The really nice thing about Buildbot is that the configuration is written in Python. You can integrate your own Python code directly to the configuration. It's also very easy to write your own BuildSteps to execute specific tasks.

Buildbot的真正好处是,配置是用Python编写的。您可以将自己的Python代码直接集成到配置中。编写自己的构建步骤来执行特定任务也非常容易。

We used BuildSteps to get the source from SVN, pull the dependencies, publish test results to WebDAV, etcetera.

我们使用构建步骤从SVN获取源代码,提取依赖项,将测试结果发布到WebDAV等等。

I wrote an X10 interface so we could send signals with build results. When the build failed, we switched on a red lava lamp. When the build succeeded, a green lava lamp switched on. Good times :-)

我编写了一个X10接口,以便我们可以发送带有构建结果的信号。当建造失败时,我们打开了一盏红色的熔岩灯。建造成功后,一盏绿色的熔岩灯亮了起来。好时光:-)

#4


17  

We use both Buildbot and Hudson for Jython development. Both are useful, but have different strengths and weaknesses.

我们使用Buildbot和Hudson进行Jython开发。两者都是有用的,但有不同的优缺点。

Buildbot's configuration is pure Python and quite simple once you get the hang of it (look at the epydoc-generated API docs for the most current info). Buildbot makes it easier to define non-testing tasks and distribute the testers. However, it really has no concept of individual tests, just textual, HTML, and summary output, so if you want to have multi-level browsable test output and so forth you'll have to build it yourself, or just use Hudson.

Buildbot的配置是纯Python,一旦掌握了它,就非常简单(查看epydoc生成的API文档,了解最新的信息)。Buildbot使定义非测试任务和分发测试人员变得更容易。但是,它确实没有单独测试的概念,只是文本、HTML和汇总输出,所以如果您想要具有多个级别的可浏览测试输出,那么您就必须自己构建它,或者只使用Hudson。

Hudson has terrific support for drilling down from overall results into test suites and individual tests; it also is great for comparing test output between builds, but the distributed (master/slave) stuff is comparatively more complicated because you need a Java environment on the slaves too; also, Hudson is less tolerant of flaky network links between the master and slaves.

Hudson对从总体结果深入到测试套件和单个测试提供了非常好的支持;它对于比较构建之间的测试输出也很有用,但是分布式的(主/从)内容相对比较复杂,因为您还需要在从服务器上使用Java环境;此外,哈德逊对主人和奴隶之间脆弱的网络联系也不那么宽容。

So, to get the benefits of both tools, we run a single instance of Hudson, which catches the common test failures, then we do multi-platform regression with Buildbot.

因此,为了获得这两个工具的好处,我们运行一个Hudson实例,它捕获了常见的测试失败,然后我们使用Buildbot进行多平台回归。

Here are our instances:

这是我们的实例:

#5


7  

We are using Bitten wich is integrated with trac. And it's python based.

我们使用的是与trac集成的bite wich。它是一个基于python的。

#6


6  

TeamCity has some Python integration.

TeamCity有一些Python集成。

But TeamCity is:

但TeamCity是:

  • not open-source
  • 不是开源的
  • is not small, but rather feature rich
  • 不是小,而是特征丰富
  • is free for small-mid teams.
  • 对于中小团队是免费的。

#7


5  

I have very good experiences with Travis-CI for smaller code bases. The main advantages are:

对于较小的代码库,我有非常好的经验。主要优点有:

  • setup is done in less than half a screen of config file
  • 设置在配置文件的不到半个屏幕中完成
  • you can do your own installation or just use the free hosted version
  • 您可以自己安装,也可以使用免费的托管版本
  • semi-automatic setup for github repositories
  • github存储库的半自动设置
  • no account needed on website; login via github
  • 网站上不需要账号;通过github登录

Some limitations:

一些限制:

  • Python is not supported as a first class language (as of time of writing; but you can use pip and apt-get to install python dependencies; see this tutorial)

    Python不支持作为第一等级语言(在编写时;但是您可以使用pip和apt-get来安装python依赖项;请参阅本教程)

  • code has to be hosted on github (at least when using the official version)

    代码必须托管在github上(至少在使用官方版本时)

#1


25  

We run Buildbot - Trac at work. I haven't used it too much since my codebase isn't part of the release cycle yet. But we run the tests on different environments (OSX/Linux/Win) and it sends emails — and it's written in Python.

我们在工作中运行建筑机器人。我还没有过多地使用它,因为我的代码库还不是发布周期的一部分。但是我们在不同的环境(OSX/Linux/Win)上运行测试,它会发送电子邮件——它是用Python编写的。

#2


26  

One possibility is Hudson. It's written in Java, but there's integration with Python projects:

一种可能性是哈德逊。它是用Java编写的,但是与Python项目集成:

Hudson embraces Python

哈德逊拥抱Python

I've never tried it myself, however.

我自己从来没有试过。

(Update, Sept. 2011: After a trademark dispute Hudson has been renamed to Jenkins.)

(2011年9月更新:在一场商标纠纷之后,Hudson被重新命名为Jenkins。)

#3


17  

Second the Buildbot - Trac integration. You can find more information about the integration on the Buildbot website. At my previous job, we wrote and used the plugin they mention (tracbb). What the plugin does is rewriting all of the Buildbot urls so you can use Buildbot from within Trac. (http://example.com/tracbb).

第二,构建bot - Trac集成。您可以在Buildbot网站上找到关于集成的更多信息。在我之前的工作中,我们编写并使用了他们提到的插件(tracbb)。插件所做的就是重写所有的Buildbot url,这样你就可以在Trac中使用Buildbot了。(http://example.com/tracbb)。

The really nice thing about Buildbot is that the configuration is written in Python. You can integrate your own Python code directly to the configuration. It's also very easy to write your own BuildSteps to execute specific tasks.

Buildbot的真正好处是,配置是用Python编写的。您可以将自己的Python代码直接集成到配置中。编写自己的构建步骤来执行特定任务也非常容易。

We used BuildSteps to get the source from SVN, pull the dependencies, publish test results to WebDAV, etcetera.

我们使用构建步骤从SVN获取源代码,提取依赖项,将测试结果发布到WebDAV等等。

I wrote an X10 interface so we could send signals with build results. When the build failed, we switched on a red lava lamp. When the build succeeded, a green lava lamp switched on. Good times :-)

我编写了一个X10接口,以便我们可以发送带有构建结果的信号。当建造失败时,我们打开了一盏红色的熔岩灯。建造成功后,一盏绿色的熔岩灯亮了起来。好时光:-)

#4


17  

We use both Buildbot and Hudson for Jython development. Both are useful, but have different strengths and weaknesses.

我们使用Buildbot和Hudson进行Jython开发。两者都是有用的,但有不同的优缺点。

Buildbot's configuration is pure Python and quite simple once you get the hang of it (look at the epydoc-generated API docs for the most current info). Buildbot makes it easier to define non-testing tasks and distribute the testers. However, it really has no concept of individual tests, just textual, HTML, and summary output, so if you want to have multi-level browsable test output and so forth you'll have to build it yourself, or just use Hudson.

Buildbot的配置是纯Python,一旦掌握了它,就非常简单(查看epydoc生成的API文档,了解最新的信息)。Buildbot使定义非测试任务和分发测试人员变得更容易。但是,它确实没有单独测试的概念,只是文本、HTML和汇总输出,所以如果您想要具有多个级别的可浏览测试输出,那么您就必须自己构建它,或者只使用Hudson。

Hudson has terrific support for drilling down from overall results into test suites and individual tests; it also is great for comparing test output between builds, but the distributed (master/slave) stuff is comparatively more complicated because you need a Java environment on the slaves too; also, Hudson is less tolerant of flaky network links between the master and slaves.

Hudson对从总体结果深入到测试套件和单个测试提供了非常好的支持;它对于比较构建之间的测试输出也很有用,但是分布式的(主/从)内容相对比较复杂,因为您还需要在从服务器上使用Java环境;此外,哈德逊对主人和奴隶之间脆弱的网络联系也不那么宽容。

So, to get the benefits of both tools, we run a single instance of Hudson, which catches the common test failures, then we do multi-platform regression with Buildbot.

因此,为了获得这两个工具的好处,我们运行一个Hudson实例,它捕获了常见的测试失败,然后我们使用Buildbot进行多平台回归。

Here are our instances:

这是我们的实例:

#5


7  

We are using Bitten wich is integrated with trac. And it's python based.

我们使用的是与trac集成的bite wich。它是一个基于python的。

#6


6  

TeamCity has some Python integration.

TeamCity有一些Python集成。

But TeamCity is:

但TeamCity是:

  • not open-source
  • 不是开源的
  • is not small, but rather feature rich
  • 不是小,而是特征丰富
  • is free for small-mid teams.
  • 对于中小团队是免费的。

#7


5  

I have very good experiences with Travis-CI for smaller code bases. The main advantages are:

对于较小的代码库,我有非常好的经验。主要优点有:

  • setup is done in less than half a screen of config file
  • 设置在配置文件的不到半个屏幕中完成
  • you can do your own installation or just use the free hosted version
  • 您可以自己安装,也可以使用免费的托管版本
  • semi-automatic setup for github repositories
  • github存储库的半自动设置
  • no account needed on website; login via github
  • 网站上不需要账号;通过github登录

Some limitations:

一些限制:

  • Python is not supported as a first class language (as of time of writing; but you can use pip and apt-get to install python dependencies; see this tutorial)

    Python不支持作为第一等级语言(在编写时;但是您可以使用pip和apt-get来安装python依赖项;请参阅本教程)

  • code has to be hosted on github (at least when using the official version)

    代码必须托管在github上(至少在使用官方版本时)