# This workflow will test if running the integration tests works.
name: Integration Tests

on:
  push:
    branches: [ "main" ]
    paths:
      - 'apps/server/**'
      - 'core/**'
      - 'install.sh'
      - '.github/workflows/dotnet-integration-tests.yml'
  pull_request:
    branches: [ "main" ]
    paths:
      - 'apps/server/**'
      - 'core/**'
      - 'install.sh'
      - '.github/workflows/dotnet-integration-tests.yml'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6

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

    - name: Install dependencies
      working-directory: apps/server
      run: dotnet workload install wasm-tools

    - name: Build
      working-directory: apps/server
      run: dotnet build

    - name: Start dev database
      run: ./scripts/dev.sh db-start

    - name: Run integration tests
      working-directory: apps/server
      run: dotnet test Tests/AliasVault.IntegrationTests --no-build --verbosity normal
