name: Quality Checks

on:
  pull_request:
    branches:
      - main
  merge_group:
    types: [ checks_requested ]

jobs:
  release:
    # Using the same Ubuntu version as in the Dockerfile for consistency
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 24
          
      - name: Install dependencies
        run: npm ci
      
      - name: Linting
        run: npm run lint
      
      - name: Code formatting
        run: npm run format
        
      - name: Build
        run: npm run build

      - name: Unit tests + integration tests (Genesis)
        run: npm run test:all
        env:
          TOMTOM_API_KEY: ${{ secrets.TOMTOM_API_KEY }}

      - name: Integration tests (Orbis)
        run: npm run test:tools:stdio && npm run test:tools:http
        env:
          TOMTOM_API_KEY: ${{ secrets.TOMTOM_API_KEY }}
          MAPS: tomtom-orbis-maps

