name: 'Build'

trigger:
- main

variables:
  DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
  DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1

jobs:
- job: BuildWindows
  displayName: 'Windows Server 2019'
  pool:
    vmImage: 'windows-latest'

  steps:
  - task: UseDotNet@2
    displayName: 'Install .NET 5'
    inputs:
      packageType: sdk
      version: 5.0.302
  - task: NuGetAuthenticate@0
  - script: ./publish.cmd Release win
    displayName: 'Build'
  - script: dotnet test --no-restore
    displayName: 'Test'

- job: BuildLinux
  strategy:
    matrix:
      'CentOS 8':
        containerImage: centos:8
        os: centos.8
      'CentOS 7':
        containerImage: centos:7
        os: centos.7
      'Debian 10':
        containerImage: mcr.microsoft.com/dotnet/sdk:5.0-buster-slim
        os: debian.10
      # 'Debian 11':
      #   containerImage: amd64/buildpack-deps:bullseye
      #   os: debian.11-x64
      'Ubuntu 20':
        containerImage: mcr.microsoft.com/dotnet/sdk:5.0-focal
        os: ubuntu.20.04
      'Fedora 32':
        containerImage: fedora:32
        os: fedora.32
      'Fedora 33':
        containerImage: fedora:33
        os: fedora.33

  displayName: Linux

  pool:
    vmImage: 'ubuntu-latest'

  container: $[ variables['containerImage'] ]

  steps:
  - task: UseDotNet@2
    displayName: 'Install .NET 5'
    inputs:
      packageType: sdk
      version: 5.0.302
  - task: NuGetAuthenticate@0
  - script: ./publish.cmd Release $(os)
    displayName: 'Build'
  - script: dotnet test --no-restore
    displayName: 'Test'
