name: Node CI Pipeline

on:
  push:
    branches:
      - main
      - master
      - develop
  pull_request:
    branches:
      - main
      - master
      - develop

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # Checkout code
      - name: Checkout
        uses: actions/checkout@v4

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

      # Diagnostics
      - name: Diagnostics
        run: |
          set -e
          node -v
          npm -v
          pwd

      # Install dependencies
      - name: Install dependencies
        run: npm ci

      # Lint
      - name: ESLint
        run: npm run lint

      # Optional Test (uncomment if needed)
      # - name: Jest Tests
      #   run: npm test -- --ci --coverage