现在我正在.gitlab-ci.yml
为 Gitlab 上托管的 Python 项目编写一个代码。
我真的不知道在哪里放置虚拟环境的设置和requirements.txt
.
我的主要资源是GitlabPython.gitlab-ci.yml
模板。
在那里,使用关键字在每个作业之前安装 virtualenv,before_script
并创建一个名为“venv”的 virtualenv:
before_script:
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
Run Code Online (Sandbox Code Playgroud)
此外,还设置了“venv”缓存:
cache:
paths:
- .cache/pip
- venv/
Run Code Online (Sandbox Code Playgroud)
我想在我的脚本中执行相同的操作,并另外从requirements.txt
我的存储库中安装。之后,我想执行代码分析(pylint,flake8)并在不同阶段进行测试。如果我附加pip install -r requirements.txt
到before_script
,它会在每个作业中执行,这会产生不必要的日志。
这不是更有意义吗
source venv/bin/activate
进来before_script
。virtualenv venv
生成环境。这个工作也叫一次。pip install -r requirements.txt
您将在哪里创建 …
运行时npm install -g appium
,安装失败并显示以下日志:
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/Cellar/node/15.1.0/lib/node_modules/appium/build/lib/main.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/Cellar/node/15.1.0/lib/node_modules/appium/build/lib/main.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/lgn/.npm/_logs/2020-11-09T08_33_15_328Z-debug.log
Run Code Online (Sandbox Code Playgroud)