I am new to tox and GitHub actions, and I am looking for a simple way to make them work together. I wrote this 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
which just installs tox and then runs it. But when I run this workflow, the tox installation works fine, but the run command returns an error:
tox: command not found
What is the correct way to run tox from a GitHub action?
You can also use tox-gh-actions.
In your workflow file:
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
In your tox.ini (other config formats work too):
[gh-actions]
python =
3.8: py38
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With