trigger:
- development

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: UseDotNet@2
  displayName: 'Use .Net Core SDK 2.2.110 (SonarCloud)'
  inputs:
    version: 2.2.110

- task: UseDotNet@2
  displayName: 'Use .Net Core 3.1.302'
  inputs:
    version: 3.1.302

- task: DotNetCoreCLI@2
  displayName: 'Install NBGV tool'
  inputs:
    command: custom
    custom: tool
    arguments: 'install --global nbgv'

- script: 'nbgv cloud'
  displayName: 'Set Version using NBGV'

- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore
    projects: '$(Parameters.projects)'

- task: DownloadSecureFile@1
  displayName: 'Download cuemon.snk'
  inputs:
    secureFile: '15606b59-2e5f-4cf8-a50d-66fa026bb391'

- task: CopyFiles@2
  displayName: 'Copy cuemon.snk to $(System.DefaultWorkingDirectory)\$(BuildSource)'
  inputs:
    SourceFolder: '$(Agent.TempDirectory)'
    Contents: cuemon.snk
    TargetFolder: '$(System.DefaultWorkingDirectory)\$(BuildSource)'

# INSERT SONAR CLOUD PREPARE HERE

- task: DotNetCoreCLI@2
  displayName: 'Build netcoreapp3.0'
  inputs:
    projects: |
     src/**/Cuemon.AspNetCore*.csproj
     src/**/Cuemon.Extensions.AspNetCore*.csproj
     src/**/Cuemon.Extensions.Xunit.csproj
    arguments: '--configuration $(BuildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)\netcoreapp3.0 --framework netcoreapp3.0'
    workingDirectory: '$(BuildSource)'

- task: DotNetCoreCLI@2
  displayName: 'Build netstandard2.1'
  inputs:
    projects: |
     src/**/Cuemon.Extensions.IO.csproj
     src/**/Cuemon.IO.csproj
    arguments: '--configuration $(BuildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)\netstandard2.1 --framework netstandard2.1'
    workingDirectory: '$(BuildSource)'

- task: DotNetCoreCLI@2
  displayName: 'Build netstandard2.0'
  inputs:
    projects: 'src/**/*.csproj'
    arguments: '--configuration $(BuildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)\netstandard2.0 --framework netstandard2.0'
    workingDirectory: '$(BuildSource)'

- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: test
    projects: 'test/**/*.csproj'
    arguments: '--configuration $(BuildConfiguration)  --collect "Code coverage" '

# INSERT SONAR CLOUD RUN ANALYSIS


# INSERT SONAR CLOUD PUBLISH QUALITY GATE RESULT

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: Cuemon'
  inputs:
    ArtifactName: Cuemon
Set up CI with Azure Pipelines
Set up CI with Azure Pipelines

Migration from current classic pipe to yaml [skip ci]