name: Code QA Roo Cline

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

jobs:
  code-qa:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Install dependencies
        run: npm run install:all

      - name: Compile TypeScript
        run: npm run compile

  unit-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Install dependencies
        run: npm run install:all

      - name: Run unit tests
        run: npx jest