1
我使用Travis-ci.org作爲開發一些Python包的持續集成服務器。我想從PyPi服務器有條件地安裝項目依賴項。來自master分支的構建應該從真正的PyPI服務器安裝依賴關係,而來自其他分支的構建應該從TestPyPI安裝依賴關係。根據條件安裝依賴關係
我試圖從外部bash腳本使用TRAVIS_BRANCH環境變量,但沒有成功。任何幫助,將不勝感激。
.travis.yml
language: python
python:
- "2.7"
install:
- ~/install_dependencies.sh
script:
- python runtests.py --with-coverage --cover-package=package
- python setup.py test
- python setup.py sdist --format zip
after_success:
coveralls
install_dependencies.sh
#!/usr/bin/env bash
if [ "${TRAVIS_BRANCH}" = "master" ]; then
pip install -r requirements.txt
pip install cloudshell-automation-api>=7.0.0.0,<7.1.0.0
else
pip install -r requirements.txt --index-url https://testpypi.python.org/simple
pip install cloudshell-automation-api>=7.0.0.0,<7.1.0.0 --index-url https://testpypi.python.org/simple
fi
pip install -r test_requirements.txt
pip install coveralls
謝謝!
不是一個bash的傢伙,但是否缺少一個'== '而不是'='在你的if語句中? –
@Oasiscircle me既不。但似乎兩者都是一樣的。在我的情況下,問題是與目錄。我會盡快發佈答案 –