name: Samples C# .Net 6

on:
  push:
    paths:
      - 'samples/server/petstore/aspnetcore-6.0/**'
      - 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
      - 'samples/server/petstore/aspnetcore-6.0-useSwashBuckle/**'
  pull_request:
    paths:
      - 'samples/server/petstore/aspnetcore-6.0/**'
      - 'samples/server/petstore/aspnetcore-6.0-pocoModels/**'
      - 'samples/server/petstore/aspnetcore-6.0-project4Models/**'
      - 'samples/server/petstore/aspnetcore-6.0-useSwashBuckle/**'
      - 'samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse/**'
      - 'samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes/**'
jobs:
  build:
    name: Build .Net servers
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        sample:
          - samples/server/petstore/aspnetcore-6.0
          - samples/server/petstore/aspnetcore-6.0-pocoModels
          - samples/server/petstore/aspnetcore-6.0-project4Models
          - samples/server/petstore/aspnetcore-6.0-useSwashBuckle
          - samples/server/petstore/aspnetcore-6.0-NewtonsoftFalse
          - samples/server/petstore/aspnetcore-6.0-nullableReferenceTypes
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-dotnet@v3.2.0
        with:
          dotnet-version: '6.0.x'
      - name: Build
        working-directory: ${{ matrix.sample }}
        run: dotnet build Org.OpenAPITools.sln
      - name: Test
        working-directory: ${{ matrix.sample }}
        run: dotnet test Org.OpenAPITools.sln
