python-3.x - 如何从 github 操作中运行 tox

标签 python-3.x github continuous-integration github-actions tox

我是 tox 和 GitHub 操作的新手,我正在寻找一种使它们协同工作的简单方法。我写了这个 simple workflow :

name: Python package

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 4
      matrix:
        python-version: [3.7]

    steps:
    - uses: actions/checkout@v1
    - name: Install tox
      run: pip install tox
    - name: Run tox
      run: tox

它只是安装 tox 然后运行它。但是当我run this workflow ,tox 安装工作正常,但运行命令返回错误:
tox: command not found

从 GitHub 操作运行 tox 的正确方法是什么?

最佳答案

您也可以使用 tox-gh-actions .
在您的工作流文件中:

 steps:
  - uses: actions/checkout@v1
  - name: Set up Python ${{ matrix.python-version }}
    uses: actions/setup-python@v2
    with:
      python-version: ${{ matrix.python-version }}
  - name: Install dependencies
    run: |
      python -m pip install --upgrade pip
      pip install tox tox-gh-actions
  - name: Test with tox
    run: tox
在您的 tox.ini (其他配置格式也适用):
[gh-actions]
python = 
  3.8: py38

关于python-3.x - 如何从 github 操作中运行 tox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59532176/

相关文章:

github - 创建官方github镜像

continuous-integration - 包含触发构建的Perforce变更列表的Jenkins变量是什么?

iis-7 - 我的 IIS7 网站的元数据库 key 在哪里?

python - 函数每次运行时不返回相同的结果

Python在包内添加单元测试

html - Github 页面不显示我的 div 中的图像

git - 对于 Git LFS,如何使用文件太大(>100mb)的 Git?

python - 我可以使用 travis-ci 来测试特定(包括次要版本)的 python 版本吗?

python - Pandas 未从 xlsx 文件中读取第一列

python - 在输出末尾获取额外的空行