简体   繁体   English

如何为python软件包开发实现跨平台的持续集成?

[英]How to implement cross-platform continuous integration for python package development?

I am developing some python packages and I do want to perform proper testing before releasing them to PyPi. 我正在开发一些python软件包,并且确实希望在将它们发布到PyPi之前执行适当的测试。

This would require running the unittests across 这将需要跨多个单元测试

  • different python versions: 2.5, 2.6, 2.7, 3.2 不同的python版本:2.5、2.6、2.7、3.2
  • different operating systems: OS X, Debian, Ubuntu and Windows 不同的操作系统:OS X,Debian,Ubuntu和Windows

Right now I am using pytest 现在我在用pytest

Question: how can I implement this easily and preferably making the results publicly available and having integrated with github, so anyone who pushes will know the results. 问题:我如何才能轻松实现此目标,最好是将结果公开发​​布并与github集成,因此任何推送的人都将知道结果。

Note: I am already aware about https://travis-ci.org/ but this seems to be missing the cross-platform part, which is essential in this case. 注意:我已经知道https://travis-ci.org/,但这似乎缺少跨平台部分,在这种情况下这是必不可少的。

Another option I was considering was to use Jenkins, but I don't know how to provide the matrix testing on it. 我正在考虑的另一个选择是使用Jenkins,但我不知道如何在其上提供矩阵测试。

I have used Jenkins, and I would recommend it. 我曾经用过詹金斯,我会推荐它。 It has a plethora of plugins, and is very configurable. 它具有大量的插件,并且是非常可配置的。

I have used it for running projects over windows/linux/mac/mobile platforms, for sanity, unit, component, and regression tests. 我已经使用它在Windows / linux / mac / mobile平台上运行项目,进行健全性,单元,组件和回归测试。

It can support chaining of projects and tests, fingerprinting of items to be monitored as they progress your testing environment and also you can set up users and keep track of changes. 它可以支持项目和测试的链接,在项目进行测试环境时要监视的项目的指纹,还可以设置用户并跟踪更改。

You can use it for production and for testing at the same time, hooking it up to your git repository, any change you make is automatically run through all the gauntlets you want. 您可以将它同时用于生产和测试,并将其连接到git存储库,您所做的任何更改都会自动运行在所需的所有手套中。

You can use tox to automate setting up virtual environments and running your tests across Python versions: 您可以使用tox来自动设置虚拟环境并跨Python版本运行测试:

[tox]
envlist = py25,py26,py27,py32
[testenv]
commands=py.test

Tox supports Python versions 2.4 and up, as well as Jython and PyPy. Tox支持Python 2.4及更高版本,以及Jython和PyPy。

If you want to look at a real-world project that uses tox , take a look at the zope.configuration tox.ini configuration . 如果要查看使用tox的实际项目,请查看zope.configuration tox.ini配置 The package includes excellent documentation on how to run the tox tests . 该软件包包括有关如何运行tox测试的出色文档 These tests are automatically run by the Zope nightly test builders . 这些测试由Zope夜间测试生成器自动运行。

Configuring tox to run under Jenkins is trivial and fully documented. 将tox配置为在Jenkins下运行是微不足道的,并且已得到充分记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM