image: Visual Studio 2022


install:
  - choco install gitversion.portable -y --version 5.12.0

before_build:
  - nuget restore
  - ps: gitversion /l console /output buildserver
  - ps: build\UpdateVersion.ps1

environment:
  pack_params: -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:PublishRepositoryUrl=true -p:EmbedUntrackedSources=true --output output -p:Configuration=Release -p:ContinuousIntegrationBuild=true

after_build:
  # Create NuGet packages
  - cmd: dotnet pack Tapeti\Tapeti.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.DataAnnotations\Tapeti.DataAnnotations.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Flow\Tapeti.Flow.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Flow.SQL\Tapeti.Flow.SQL.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Transient\Tapeti.Transient.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Serilog\Tapeti.Serilog.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.SimpleInjector\Tapeti.SimpleInjector.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Autofac\Tapeti.Autofac.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.CastleWindsor\Tapeti.CastleWindsor.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  - cmd: dotnet pack Tapeti.Ninject\Tapeti.Ninject.csproj %pack_params% -p:Version=%GitVersion_NuGetVersion%
  # Push artifacts
  - ps: Get-ChildItem output\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
  - ps: Get-ChildItem output\*.snupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

build:
  project: Tapeti.sln

test_script:
  - dotnet test Tapeti.Tests\bin\Release\net6.0\Tapeti.Tests.dll --filter "Category!=Requires Docker"
  - dotnet test Tapeti.Tests\bin\Release\net7.0\Tapeti.Tests.dll --filter "Category!=Requires Docker"

platform:
  - Any CPU

configuration:
  - Release

deploy:
  - provider: NuGet
    api_key:
      secure: Bl47U4FsBedTdYMisLIrrm8vOUlnnJa6dcRwk8rfFb8hIn38R6PrMc8D+zltoR9n

    skip_symbols: false
    artifact: /.*(\.|\.s)nupkg/