name: Lints

on:
  pull_request:
    branches: [master]
  push:
    branches: [master]
    paths-ignore:
    - '**.rst'

jobs:
  ruff:
    runs-on: ubuntu-24.04

    steps:
    - name: Checkout pygit2
      uses: actions/checkout@v6

    - name: Set up Python
      uses: actions/setup-python@v6
      with:
        python-version: '3.13'

    - name: Install ruff
      run: pip install ruff

    - name: Format code with ruff
      run: ruff format --diff

    - name: Check code style with ruff
      run: ruff check

    - name: Check typing with mypy
      run: LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.2 /bin/sh build.sh mypy
