我有基于docker-compose文件的Django应用程序。 travis会以某种方式从项目存储库中的requirements.txt中自动安装软件包,并且由于我的构建失败而导致我没有gcc软件包。 我想在Docker容器中而不是直接在项目仓库中运行所有动作(测试,短毛绒)。
这是我的travis-ci.yml文件:
---
dist: xenial
services:
- docker
language: python
python:
- "3.7"
script:
- docker compose up --build
- docker exec web flake8
- docker exec web mypy my_project
- docker exec web safety check -r requirements.txt
- docker exec web python -m pytest --cov my_project -vvv -s
然后开始travis日志:
$ git checkout -qf bab09dee57a707a5cd0a353d6f50bb66fd90a095
0.01s$ source ~/virtualenv/python3.7/bin/activate
$ python --version
Python 3.7.1
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/pip (python 3.7)
$ pip install -r requirements.txt
...
py_GeoIP.c:23:19: fatal error: GeoIP.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
...
你知道为什么特拉维斯会这样表现吗?
答案 0 :(得分:0)
根据https://docs.travis-ci.com/user/languages/python/#dependency-management travisci自动安装requirements.txt依赖项。
要忽略此行为,我必须在travis.yml中添加以下行以覆盖它:
div.st-header-image {
width: 100%;
background-color: #a7b885;
margin: 0px;
text-align: center;
overflow: hidden;
padding-top: 40%;
position: relative;
}
p.st-description {
margin: 0px;
color: red;
font-size: 40px;
position: absolute;
top: 0;
left: 0;
right: 0;
text-align: center;
padding-top: 15%;
}