Tooling/azure-pipelines.yml

124 строки
3.7 KiB
YAML

trigger:
- master
- refs/tags/*
- dev
variables:
Solution: 'Tooling'
ProductVersion: '0.7.0'
PackageVersion: $[format('0.7.0-{0}', variables['Build.BuildId'])]
DotNet2Version: 2.1.x
DotNet3Version: 3.1.x
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
- job: 'Linux'
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'OSX'
pool:
vmImage: 'macOS-10.14'
steps:
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'build'
projects: '$(Solution).sln'
arguments: '--configuration Release /p:TreatWarningsAsErrors=True'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- job: 'Windows'
pool:
vmImage: 'Windows-2019'
steps:
- pwsh: |
if ($env:BUILD_SOURCEBRANCH -match "^refs\/tags\/(.+)")
{
$env:PackageVersion = $Matches.1
}
Write-Host "build version set to $env:PackageVersion"
$prefix = $env:PackageVersion.Split('-')[0]
$suffix = $env:PackageVersion.Split('-')[1]
Write-Host "##vso[build.updatebuildnumber]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$env:PackageVersion"
Write-Host "##vso[task.setvariable variable=VersionPrefix;]$prefix"
Write-Host "##vso[task.setvariable variable=VersionSuffix;]$suffix"
env:
PackageVersion: $(PackageVersion)
displayName: 'Version'
- task: UseDotNet@2
displayName: 'Setup DotNet2 $(DotNet2Version)'
inputs:
packageType: sdk
version: $(DotNet2Version)
- task: UseDotNet@2
displayName: 'Setup DotNet3 $(DotNet3Version)'
inputs:
packageType: sdk
version: $(DotNet3Version)
- task: 'DotNetCoreCLI@2'
displayName: 'Build'
inputs:
command: 'pack'
packagesToPack: '$(Solution).sln'
arguments: '--configuration $(buildConfiguration) /p:TreatWarningsAsErrors=True /p:VersionPrefix=$(VersionPrefix) /p:VersionSuffix=$(VersionSuffix)'
versioningScheme: 'byEnvVar'
versionEnvVar: 'PackageVersion'
- task: 'DotNetCoreCLI@2'
displayName: 'Test'
inputs:
command: 'test'
projects: '$(Solution).sln'
- task: PowerShell@2
displayName: 'Sign'
inputs:
filePath: build/sign-packages.ps1
env:
SignClientUser: $(SignClientUser)
SignClientSecret: $(SignClientSecret)
ArtifactDirectory: $(Build.ArtifactStagingDirectory)
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], '')))
- task: 'PublishBuildArtifacts@1'
displayName: 'Publish'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Packages'
publishLocation: 'Container'
condition: 'always()'