name: Dev testing pipeline
run-name: ${{ gitea.actor }} is testing out Yuna 🚀
on:
  push:
    branches:
      - dev

jobs:
  BuildAndTest:
    runs-on: ubuntu-latest
    steps:
      - name: List Base info 👓
        run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
        run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
        run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
        run: echo "${{ gitea.workspace }} is a workspace folder"

      - name: Check out repo code 📝
        uses: actions/checkout@v3

      - name: Set up PostgreSQL 🐘
      uses: postgres-actions/setup-postgres@v1
      with:
        postgres-version: '15'
        postgres-user: 'developer'
        postgres-password: 'magazinchik_forever'
        postgres-port: '5432'

      - name: Init db 📜
        env:
          PGPSSWORD: magazinchik_forever
          run: |
          psql -h localhost -U developer -p 5432 -f ${{ gitea.workspace }}/Db/_localhost-2024_07_27_12_51_02-dump.sql

      - name: Setup .NET 🛠️
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: '8.0.x'
        
      - name: Restore dependencies 🔪
        run: dotnet restore
      
      - name: Build debug app ☢️
        run: donet build -c Debug --no-restore
      
      - name: Run unit tests 💊
        run: dotnet test -c Debug --no-build