name: Backend CI

on:
  push:
    branches: [ "main", "dev" ]
    paths:
      - 'backend/**'
  pull_request:
    branches: [ "main", "dev" ]
    paths:
      - 'backend/**'

jobs:
  build-and-test:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Setup .NET
      uses: actions/setup-dotnet@v4
      with:
        dotnet-version: '10.0.x'

    - name: Restore dependencies
      run: dotnet restore backend/UniVerse.sln

    - name: Build
      run: dotnet build backend/UniVerse.sln --no-restore --configuration Release

    - name: Test
      run: dotnet test backend/UniVerse.sln --no-build --configuration Release --verbosity normal
