Skip to content

Instantly share code, notes, and snippets.

@izikeros
Last active July 17, 2024 19:57
Show Gist options
  • Save izikeros/368a82113fdbcb528f6e3b5db6bb4dd3 to your computer and use it in GitHub Desktop.
Save izikeros/368a82113fdbcb528f6e3b5db6bb4dd3 to your computer and use it in GitHub Desktop.
[Run tests with tox (GitHub action)] GitHub action for running pytest tests with tox, run codecov #action #tox #workflow #pytest #codecov
name: Run Tests with Tox
on:
push:
branches:
- '*' # This will trigger the action on push to any branch
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] # Adjust these versions as needed
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
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
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment