name: Build Check

# Déclencheur pour chaque pull request
on:
  push:
    branches: ['**']
  pull_request:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # 1. Checkout du code source du dépôt
      - name: Checkout code
        uses: actions/checkout@v3

      # 2. Installation Node.js
      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'  # Spécifie la version de Node.js

      # Version node installer
      - name: Show Node version (debug)
        run: node -v

      # 3. Installation des dépendances
      - name: Install dependencies
        run: npm ci

      # 4. Exécution des tests unitaires
      - name: Run tests
        run: npm run test:ci

      # 5. CI terminée
      - name: CI completed
        run: echo "✅CI process completed successfully.✅"
