name: CI

on:
  pull_request:
    branches: [ main ]
  push:
    branches: [ main ]

jobs:
  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: '22'
        cache: 'npm'

    - name: Install dependencies
      run: npm install

    - name: Run linting
      run: npm run lint

    - name: Run backend tests
      run: npm run backend:test
      env:
        FF_ENABLE_BACKUPS: 'true'
        FF_ENABLE_CALENDAR: 'true'

    - name: Build frontend
      run: npm run build
