dotnet-installer/eng/build.yml

140 lines
5.4 KiB
YAML

parameters:
agentOs: ''
queue: {}
variables: {}
phases:
- template: /eng/common/templates/phases/base.yml
parameters:
name: ${{ parameters.agentOs }}
enableTelemetry: true
enableMicrobuild: true
publicBuildReasons: PullRequest
queue: ${{ parameters.queue }}
variables:
${{ insert }}: ${{ parameters.variables }}
_AgentOSName: ${{ parameters.agentOs }}
_HelixType: build/product
_HelixBuildConfig: $(_BuildConfig)
BuildConfig: $(_BuildConfig)
BuildArchitecture: $(_BuildArchitecture)
DockerParameter: $(_DockerParameter)
LinuxPortable: $(_LinuxPortable)
RuntimeId: $(_RuntimeIdentifier)
AdditionalBuildParameters: $(_AdditionalBuildParameters)
${{ if eq(variables['System.TeamProject'], 'public') }}:
_HelixSource: pr/dotnet/core-sdk/$(Build.SourceBranch)
_OfficialBuildIdArgs: ''
_PublishArgs: ''
_SignArgs: ''
${{ if ne(variables['System.TeamProject'], 'public') }}:
_HelixSource: official/dotnet/core-sdk/$(Build.SourceBranch)
_OfficialBuildIdArgs: /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
_PublishArgs: /p:DotNetPublishBlobFeedKey=$(dotnetcli-storage-key)
/p:DotNetPublishBlobFeedUrl=$(PB_PublishBlobFeedUrl)
/p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:PB_PublishType=$(_PublishType)
_SignArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
steps:
- script: 'eng\setbuildinfo.bat $(BuildArchitecture) $(BuildConfig)'
condition: eq(variables['_AgentOSName'], 'Windows_NT')
displayName: Set test info (Windows)
- script: 'eng/setbuildinfo.sh $(BuildArchitecture) $(BuildConfig)'
condition: ne(variables['_AgentOSName'], 'Windows_NT')
displayName: Set test info (Non-Windows)
- script: 'echo TestParameter: $(TestParameter)'
displayName: Show TestParameter
- script: 'echo RunTests: $(RunTests)'
displayName: Show RunTests
- script: 'echo AdditionalBuildParameters: $(AdditionalBuildParameters)'
displayName: Show AdditionalBuildParameters
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: AzureKeyVault@1
inputs:
azureSubscription: 'DotNet-Engineering-Services_KeyVault'
KeyVaultName: EngKeyVault
SecretsFilter: 'dotnetcli-storage-key,microsoft-symbol-server-pat,symweb-symbol-server-pat'
condition: succeeded()
- task: AzureKeyVault@1
inputs:
azureSubscription: 'HelixProd_KeyVault'
KeyVaultName: HelixProdKV
SecretsFilter: 'HelixApiAccessToken'
condition: always()
- ${{ if eq(parameters.agentOs, 'Windows_NT') }}:
- script: build.cmd
$(TestParameter)
-pack -publish -ci
-Configuration $(BuildConfig)
-Architecture $(BuildArchitecture)
$(_PublishArgs)
$(_SignArgs)
$(_OfficialBuildIdArgs)
$(AdditionalBuildParameters)
displayName: Build
env:
DOTNET_CLI_UI_LANGUAGE: $(_DOTNET_CLI_UI_LANGUAGE)
DropSuffix: $(_DropSuffix)
- ${{ if eq(parameters.agentOs, 'Linux') }}:
- script: ./build.sh
$(TestParameter)
--pack --publish --ci
--noprettyprint
--configuration $(BuildConfig)
$(DockerParameter)
--architecture $(BuildArchitecture)
$(LinuxPortable)
$(RuntimeId)
$(_PublishArgs)
$(_SignArgs)
$(_OfficialBuildIdArgs)
$(AdditionalBuildParameters)
displayName: Build
env:
DropSuffix: $(_DropSuffix)
- ${{ if eq(parameters.agentOs, 'Darwin') }}:
- script: ./build.sh
$(TestParameter)
--pack --publish --ci
--noprettyprint
--configuration $(BuildConfig)
$(_PublishArgs)
$(_SignArgs)
$(_OfficialBuildIdArgs)
displayName: Build
- task: PublishTestResults@1
displayName: Publish Test Results
inputs:
testRunner: XUnit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
testRunTitle: '$(_AgentOSName)_$(Agent.JobName)'
platform: '$(BuildPlatform)'
configuration: '$(_BuildConfig)'
condition: and(succeededOrFailed(), ne(variables['PB_SkipTests'], 'true'), ne(variables['RunTests'], 'false'))
- task: CopyFiles@2
displayName: Gather Logs
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
artifacts/log/$(_BuildConfig)/**/*
artifacts/TestResults/$(_BuildConfig)/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
continueOnError: true
condition: always()
- task: PublishBuildArtifacts@1
displayName: Publish Logs to VSTS
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '$(_AgentOSName)_$(Agent.JobName)_$(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
condition: always()