我是 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/