【发布时间】:2022-10-02 05:40:41
【问题描述】:
我有以下 Github 操作,其中我指定了 Python 3.10:
name: Unit Tests
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: app
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v3
with:
python-version: \"3.10\"
cache: \"poetry\"
- run: poetry install
- name: Run tests
run: |
make mypy
make test
pyproject.toml 也指定了 Python 3.10:
[tool.poetry.dependencies]
python = \">=3.10,<3.11\"
当动作运行时,我得到以下信息:
The currently activated Python version 3.8.10 is not supported by the project
(>=3.10,<3.11).
Trying to find and use a compatible version.
Using python3 (3.10.5)
看起来它使用的是 3.10,但 py.test 使用的是 3.8.10:
platform linux -- Python 3.8.10, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 --
/home/runner/.cache/pypoetry/virtualenvs/vital-background-pull-yluVa_Vi-py3.10/bin/python
对于上下文,此 Github 操作之前在 3.8 上运行。我已经更新了test.yaml 和pyproject.toml 中的python 版本,但它仍在使用3.8。我还应该更改什么以使其使用 3.10?
谢谢
-
疯狂的猜测:将 actions/checkout@v3 移动为第一步,看看是否有帮助?
-
我发现问题可能出在
pipx install poetry:installed package poetry 1.1.14, installed using Python 3.8.10 -
您是否在使用 setup 操作设置 python 版本后尝试安装诗歌?
标签: python github devops github-actions