在gitlab-ci中使用轮子以避免长时间的编译

时间:2017-01-02 18:17:21

标签: python numpy gitlab-ci python-wheel

在我的gitlab-ci.yml中,我使用pandas scikit和scipy测试了一些代码。 构建/管道中的大部分时间都花在编译numpy,scipy上,......

我是否可以创建一个轮子并使用ADD来复制和pip安装已经制作的轮子?

我为最新版本的pip ::

发了言
$ cat requirements/base.txt
pip>=8.1.2
setuptools>=20.7.0
wheel>=0.29
numpy
scipy
scikit-learn

这里我的.gitlab-ci并且每次都有效地花费了很多时间:

$ cat .gitlab-ci

image : python:2

test:
  script:
  - apt-get update -qy
  - apt-get install -y python-dev python-pip python-virtualenv
  - pip install -r requirements/base.txt
  - ...

尝试回答@ ev-br这里的gitlab-ci管道输出,你可以看到pandas不是一个轮子而是 pandas-0.19.1.tar.gz

$ pip install -r requirements.txt --cache-dir=/cache
Requirement already satisfied: pip>=9 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: setuptools>=26 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Collecting wheel>=0.29 (from -r requirements.txt (line 3))
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Collecting setuptools_scm (from -r requirements.txt (line 4))
  Using cached setuptools_scm-1.15.0-py2.py3-none-any.whl
Collecting setuptools_scm_git_archive (from -r requirements.txt (line 5))
  Using cached setuptools_scm_git_archive-1.0-py2.py3-none-any.whl
Collecting pandas==0.19.1 (from -r requirements.txt (line 6))
  Downloading pandas-0.19.1.tar.gz (8.4MB)
Collecting python-dateutil>=2 (from pandas==0.19.1->-r requirements.txt (line 6))
  Using cached python_dateutil-2.6.0-py2.py3-none-any.whl

1 个答案:

答案 0 :(得分:0)

如果您的点数最近(版本8或更高版本IIRC),您可以通过pip install numpy和scipy自动使用manulinux车轮。在CI上尝试pip install --upgrade pip或类似内容。