name: Linters

on:
  push:
  pull_request:

jobs:
  black:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install black codespell
    - name: Check with black
      run: black --check .

  codespell:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: codespell-project/actions-codespell@master
      with:
        skip: '*.po'
        ignore_words_list: ba,te,deltion

  mypy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python
      uses: actions/setup-python@v2
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install mypy
        pip install -r requirements.txt
        pip install urwid twisted watchdog "jedi >=0.16" babel "sphinx >=1.5" numpy
        pip install types-backports types-requests types-setuptools types-toml types-pygments
    - name: Check with mypy
      # for now only run on a few files to avoid slipping backward
      run: mypy
