我正在使用以下 yml 文件
image: python:latest
stages:
- install
- lint
- test
before_script:
- python --version ; pip --version # For debugging
# install dependencies and create virtual environment
install_dependencies:
stage: install
script:
- pip install poetry
- poetry install # it creates virtual environment too
# run pre-commit checks
pre-commit:
stage: lint
script:
- poetry run pre-commit run --all-files
# test the code
pytest:
stage: test
script:
- poetry run pytest
安装阶段比 lint 阶段按预期进行我得到一个错误
$ poetry run pre-commit run --all-files
/bin/bash: line 127: poetry: command not found
但是我在我的 linux-mint 虚拟机上安装了 poetry。 我如何正确编写此 yml 文件以便检查预提交挂钩并运行 pytest?