name: Lint (MyPy, Black, isort, Flake8)
on:
  push:
  workflow_dispatch:
jobs:
  run-mypy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name : Setup python
        uses: actions/setup-python@v2
        with:
          python-version: '3.9'
      - name: Install external dependencies
        run: sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python3-dev -y
      - name: Install python dependencies
        run: |
          pip install -r requirements/requirements.txt
          pip install -r requirements/dev_requirements.txt
      - name: Run mypy
        run: mypy .
  black:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: psf/black@stable
  isort:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - uses: isort/isort-action@master
        with:
            requirementsFiles: "requirements/requirements.txt requirements/dev_requirements.txt"
  flake8-lint:
    runs-on: ubuntu-latest
    name: Flake8
    steps:
      - name: Check out source repository
        uses: actions/checkout@v2
      - name: Set up Python environment
        uses: actions/setup-python@v1
        with:
          python-version: "3.8"
      - name: flake8 Lint
        uses: py-actions/flake8@v2