name: mobile quality
defaults:
  run:
    working-directory: projects/mobile

on:
  push:
    paths:
      - "../../basango/apps/mobile/**"
      - ".github/workflows/mobile_*.yaml"
  pull_request:
    paths:
      - "../../basango/apps/mobile/**"
      - ".github/workflows/mobile_*.yaml"

jobs:
  quality:
    name: eslint and prettier
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

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

      - name: Setup Bun
        uses: oven-sh/setup-bun@v2

      - name: Cache Bun Dependencies
        uses: actions/cache@v4
        with:
          path: ~/.bun/install/cache
          key: ${{ runner.os }}-bun-${{ hashFiles('projects/mobile/bun.lock') }}
          restore-keys: |
            ${{ runner.os }}-bun-

      - name: Install Dependencies
        run: bun install --frozen-lockfile

      - name: Run Code Quality Checks
        run: |
          bun run check-types
          bun run check
          bun run lint:check

