name: Lint

on:
  push:
    branches:
      - main
      - master
      - dev
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]

jobs:
  ruff:
    name: Ruff Lint & Format
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'

      - name: Install uv
        uses: astral-sh/setup-uv@v4

      - name: Install dependencies
        run: uv sync --dev

      - name: Run ruff check
        run: uv run ruff check src

      - name: Run ruff format
        run: uv run ruff format src --check

  frontend:
    name: Frontend Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '25'

      - name: Install pnpm
        uses: pnpm/action-setup@v4
        with:
          version: 9

      - name: Install dependencies
        working-directory: web
        run: pnpm install

      - name: Run lint
        working-directory: web
        run: pnpm lint
