本地Travis Build Runner
travis-solo的Python项目详细描述
travis solo是本地travis构建运行程序。travis solo本身是用python编写的,并且可以使用:
- cpython 2.x>;=2.6,3.x>;=3.2
- Pypy 1.9+
支持的操作系统:
- GNU/Linux
- 操作系统X
用法
在包含.travis.yml配置文件的目录中执行travis solo。成功时返回0,失败时返回非0。
travis-solo-h或travis-solo--help将显示使用信息。
示例.travis.yml文件:
language: python python: - "2.7" install: - sudo this won't be executed anyway env: - VAR=foo - VAR=bar matrix: include: - python: "2.7" env: VAR=baz script: echo "VAR is $VAR"
输出:
-> % travis-solo Build configuration python2.7 (VAR=u'foo') running Preparing the environment $ virtualenv --distribute --python=python2.7 /Users/aa/projects/travis-solo/.travis-solo/2.7 Running virtualenv with interpreter /usr/local/bin/python2.7 New python executable in /Users/aa/projects/travis-solo/.travis-solo/2.7/bin/python Installing distribute...........................................................................................................................................................................................................................done. Installing pip................done. "sudo this won't be executed anyway" ignored because it contains sudo reference $ echo "VAR is $VAR" VAR is foo Build configuration python2.7 (VAR=u'bar') running Preparing the environment "sudo this won't be executed anyway" ignored because it contains sudo reference $ echo "VAR is $VAR" VAR is bar Build configuration python2.7 (VAR=u'baz') running Preparing the environment "sudo this won't be executed anyway" ignored because it contains sudo reference $ echo "VAR is $VAR" VAR is baz Build summary: python2.7 (VAR=u'foo'): Build succeeded python2.7 (VAR=u'bar'): Build succeeded python2.7 (VAR=u'baz'): Build succeeded -> % echo $? 0
travis solo当然可以自己运行测试。
限制
首先,您需要记住,您的本地环境可能与travis非常不同,因此所有这些apt-get调用可能无法按预期工作。
目前唯一支持的项目类型是python。
支持的配置属性:
- before_install
- install
- before_script
- script
- after_script
- python
- matrix
- env
travis-solo设置以下环境变量:
- TRAVIS=true
- CI=true
- TRAVIS_SOLO=true
- TRAVIS_PYTHON_VERSION=...取决于配置
涉及sudoword的命令此时会被自动丢弃
运行并行生成时(--jobs Xwhere x!=1)您需要确保生成不会同时在同一个项目文件上操作。
例如:python包构建过程可以使用build目录来存储结果。有一个解决方法(从https://github.com/hhatto/autopep8/commit/1c895989422b0a02a32a4383a3f0467b44f20663借用)-更改
python setup.py install # or similar
到
python setup.py build –build-base=”.build-$TRAVIS_PYTHON_VERSION” install
此更改将确保每个生成环境将在单独的生成目录中运行,直到生成您的包为止。
版权所有
版权所有(c)2013 Jakub Stasiak
此源代码是在mit许可下授权的,有关详细信息,请参阅许可文件。