name: Lint

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main, develop ]

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.10'

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install black flake8 isort mypy

    - name: Check code formatting with black
      run: |
        black --check src/sollol tests/

    - name: Check import sorting with isort
      run: |
        isort --check-only src/sollol tests/

    - name: Lint with flake8
      run: |
        flake8 src/sollol tests/ --max-line-length=100 --extend-ignore=E203,W503,F401,F841,E501,E722,F541,E402

    - name: Type check with mypy
      run: |
        mypy src/sollol --ignore-missing-imports
      continue-on-error: true
