name: Ruff

on:
  pull_request:
    branches:
      - "*"
    paths:
      - "pyproject.toml"
      - "setup.py"
      - "py_ballisticcalc/**"
      - "tests/**"
      - "py_ballisticcalc.exts/**"
      - ".github/**"
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0 # required for setuptools-scm

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          python-version: "3.10"
          github-token: ${{ github.token }}

      - name: Install the project
        run: uv sync --dev
        shell: bash

      - name: Analysing the code with ruff
        run: uv run ruff check
        shell: bash
