# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
    
jobs:
  build:
    
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
    
    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 7.0.x
    - name: Install Java
      if: runner.os == 'Windows'
      uses: actions/setup-java@v2
      with:
        distribution: 'microsoft'
        java-version: '11'
    - name: Install .NET Workloads
      if: runner.os == 'Windows'
      run: | 
          dotnet workload install android --ignore-failed-sources
          dotnet workload install ios --ignore-failed-sources
          dotnet workload install tvos --ignore-failed-sources
          dotnet workload install maccatalyst --ignore-failed-sources
    - name: Restore dependencies
      run: dotnet restore ./Whisper.net.sln
    - name: Build
      run: dotnet build ./Whisper.net.sln --no-restore -warnaserror 
    - name: Test
      run: |
        dotnet test ./Whisper.net.sln --no-build
