# This workflow will test if running the unit tests works.
name: Unit Tests

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

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

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4

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

    - name: Install dependencies
      run: dotnet workload install wasm-tools

    - name: Restore dependencies
      working-directory: apps/server
      run: dotnet restore

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

    - name: Run unittests
      working-directory: apps/server
      run: dotnet test Tests/AliasVault.UnitTests --no-build --verbosity normal
