Update main.yml #57
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
tests: | |
runs-on: ubuntu-20.04 | |
name: Tests | |
needs: lint | |
strategy: | |
matrix: | |
name: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
include: | |
- name: "3.8" | |
python: "3.8" | |
tox_env: "py38" | |
- name: "3.9" | |
python: "3.9" | |
tox_env: "py39" | |
- name: "3.10" | |
python: "3.10" | |
tox_env: "py310" | |
use_coverage: true | |
- name: "3.11" | |
python: "3.11" | |
tox_env: "py311" | |
- name: "3.12" | |
python: "3.12" | |
tox_env: "py312" | |
steps: | |
- uses: actions/setup-python@v4 | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install packages | |
run: pip install tox coverage | |
- name: Run tests without coverage | |
if: "! matrix.use_coverage" | |
run: "python -m tox -e ${{ matrix.tox_env }}" | |
- name: Run tests with coverage | |
if: "matrix.use_coverage" | |
run: "python -m tox -e ${{ matrix.tox_env }}-coverage" | |
- name: Generate coverage report | |
if: "matrix.use_coverage" | |
run: python -m coverage xml | |
- name: Upload coverage to Codecov | |
if: "matrix.use_coverage" | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
files: ./coverage.xml | |
verbose: true | |
lint: | |
runs-on: ubuntu-latest | |
name: flake8 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install packages | |
run: pip install tox | |
- name: Run linter | |
run: tox -e flake8 |