在 gitlab 中使用 pipenv ci
using pipenv with gitlab ci
我在本地开发中使用 pipenv
并集成 Gitlab CI/CD 进行部署和测试。
我不想每次安装新包时都生成 requirements.py
文件。因此我也想将 pipenv
与 Gitlab
跑步者一起使用。
我的 gitlab-ci.yml
文件包含
stages:
- test
- deploy
test:
stage: test
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- apt-get install -y python-dev python-pip
- pip install pipenv
- pipenv install
- pipenv run py.test src/
...
但是管道失败并出现错误
$ pipenv install
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Warning: Python 3.6 was not found on your system…
You can specify specific versions of Python with:
$ pipenv --python path/to/python
/usr/local/lib/python2.7/dist-packages/pipenv/_compat.py:86: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-fmGiYD-requirements'>
warnings.warn(warn_message, ResourceWarning)
我什至尝试使用 --python 3.6
标志,但同样的错误。
我的Pipfile
内容是
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django = "*"
...
pytest = "*"
pytest-django = "*"
pytest-cov = "*"
pdbpp = "*"
mixer = "*"
[dev-packages]
[requires]
python_version = "3.6"
Update 2
用 python3-dev python3-pip
替换 python-dev python-pip
正在安装 python 版本 3.5 而 运行 命令 pipenv install
给出以下错误
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.
This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
ERROR: Job failed: exit code 1
要将环境变量添加到您的 gitlab-ci.yml 文件:
https://docs.gitlab.com/ce/ci/variables/#gitlab-ci-yml-defined-variables
也使用 python docker 映像而不是安装 python:
https://docs.gitlab.com/ce/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ci-yml
image: python:3.6
test:
stage: test
variables:
LC_ALL=C.UTF-8
LANG=C.UTF-8
我在本地开发中使用 pipenv
并集成 Gitlab CI/CD 进行部署和测试。
我不想每次安装新包时都生成 requirements.py
文件。因此我也想将 pipenv
与 Gitlab
跑步者一起使用。
我的 gitlab-ci.yml
文件包含
stages:
- test
- deploy
test:
stage: test
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- apt-get install -y python-dev python-pip
- pip install pipenv
- pipenv install
- pipenv run py.test src/
...
但是管道失败并出现错误
$ pipenv install
Warning: the environment variable LANG is not set!
We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.
Warning: Python 3.6 was not found on your system…
You can specify specific versions of Python with:
$ pipenv --python path/to/python
/usr/local/lib/python2.7/dist-packages/pipenv/_compat.py:86: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-fmGiYD-requirements'>
warnings.warn(warn_message, ResourceWarning)
我什至尝试使用 --python 3.6
标志,但同样的错误。
我的Pipfile
内容是
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django = "*"
...
pytest = "*"
pytest-django = "*"
pytest-cov = "*"
pdbpp = "*"
mixer = "*"
[dev-packages]
[requires]
python_version = "3.6"
Update 2
用 python3-dev python3-pip
替换 python-dev python-pip
正在安装 python 版本 3.5 而 运行 命令 pipenv install
给出以下错误
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps.
This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
ERROR: Job failed: exit code 1
要将环境变量添加到您的 gitlab-ci.yml 文件: https://docs.gitlab.com/ce/ci/variables/#gitlab-ci-yml-defined-variables
也使用 python docker 映像而不是安装 python: https://docs.gitlab.com/ce/ci/docker/using_docker_images.html#define-image-and-services-from-gitlab-ci-yml
image: python:3.6
test:
stage: test
variables:
LC_ALL=C.UTF-8
LANG=C.UTF-8