name: Tests
on:
  pull_request:
  push:
    branches:
    - main
jobs:
  tests:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
        - {name: Python 3.8, python: '3.8', os: ubuntu-latest, tox: py, codecov: true}
        - {name: Python 3.7, python: '3.7', os: ubuntu-latest, tox: py, codecov: false}
        - {name: Lint, python: '3.8', os: ubuntu-latest, tox: lint, codecov: false}
        - {name: Pylint, python: '3.8', os: ubuntu-latest, tox: pylint, codecov: false}
        - {name: Vulture, python: '3.8', os: ubuntu-latest, tox: vulture, codecov: false}
    steps:
    - name: Check out source code
      uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python }}
        architecture: x64
    - name: Install dependencies
      run: python -m pip install --upgrade wheel setuptools pip tox virtualenv
    - run: tox -e ${{ matrix.tox }}
    - name: Codecov
      uses: codecov/codecov-action@v1
      with:
        file: ./.coverage.xml
      if: ${{ matrix.codecov }}
