188 lines
7.9 KiB
YAML
188 lines
7.9 KiB
YAML
# default-build.yml
|
|
# Description: Defines a build phase for invoking build.sh/cmd
|
|
# Parameters:
|
|
# jobName: string
|
|
# The name of the job. Defaults to the name of the OS. No spaces allowed
|
|
# jobDisplayName: string
|
|
# The friendly job name to display in the UI. Defaults to the name of the OS.
|
|
# poolName: string
|
|
# The name of the VSTS agent queue to use.
|
|
# agentOs: string
|
|
# Used in templates to define variables which are OS specific. Typically from the set { Windows, Linux, macOS }
|
|
# buildArgs: string
|
|
# Additional arguments to pass to the build.sh/cmd script.
|
|
# Note: -ci is always passed
|
|
# beforeBuild: [steps]
|
|
# Additional steps to run before build.sh/cmd
|
|
# steps: [steps]
|
|
# Instead of running build.cmd/sh, run these build steps.
|
|
# afterBuild: [steps]
|
|
# Additional steps to run after build.sh/cmd
|
|
# artifacts: [array]
|
|
# - path: string
|
|
# The file path to artifacts output
|
|
# includeForks: boolean
|
|
# Should artifacts from forks be published
|
|
# name: string
|
|
# The name of the artifact container
|
|
# variables: { string: string }
|
|
# A map of custom variables
|
|
# matrix: { string: { string: string } }
|
|
# A map of matrix configurations and variables. https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema?view=vsts#matrix
|
|
# dependsOn: string | [ string ]
|
|
# For fan-out/fan-in. https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema?view=vsts#phase
|
|
# condition: string
|
|
# A condition which can be used to skip the job completely
|
|
# codeSign: boolean
|
|
# This build definition is enabled for code signing. (Only applies to Windows)
|
|
# buildDirectory: string
|
|
# Specifies what directory to run build.sh/cmd
|
|
# buildScript: string
|
|
# Specifies the build script to run. Defaults to build.sh or build.cmd.
|
|
|
|
#
|
|
# See https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema for details
|
|
#
|
|
|
|
parameters:
|
|
agentOs: 'Windows'
|
|
poolName: ''
|
|
buildArgs: ''
|
|
configuration: 'Release'
|
|
beforeBuild: []
|
|
# steps: [] don't define an empty object default because there is no way in template expression yet to check "if isEmpty(parameters.steps)"
|
|
afterBuild: []
|
|
codeSign: false
|
|
variables: {}
|
|
dependsOn: ''
|
|
condition: ''
|
|
# jobName: '' - use agentOs by default.
|
|
# jobDisplayName: '' - use agentOs by default.
|
|
# matrix: {} - don't define an empty object default because there is no way in template expression yet to check "if isEmpty(parameters.matrix)"
|
|
artifacts: []
|
|
buildDirectory: ''
|
|
buildScript: ''
|
|
installNodeJs: true
|
|
installJdk: true
|
|
timeoutInMinutes: 120
|
|
|
|
jobs:
|
|
- job: ${{ coalesce(parameters.jobName, parameters.agentOs) }}
|
|
displayName: ${{ coalesce(parameters.jobDisplayName, parameters.agentOs) }}
|
|
dependsOn: ${{ parameters.dependsOn }}
|
|
${{ if ne(parameters.condition, '') }}:
|
|
condition: ${{ parameters.condition }}
|
|
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
|
workspace:
|
|
clean: all
|
|
strategy:
|
|
${{ if ne(parameters.matrix, '') }}:
|
|
maxParallel: 8
|
|
matrix: ${{ parameters.matrix }}
|
|
# Map friendly OS names to the right queue
|
|
# See https://github.com/dotnet/arcade/blob/master/Documentation/ChoosingAMachinePool.md
|
|
pool:
|
|
${{ if ne(parameters.poolVmImage, '') }}:
|
|
vmImage: ${{ parameters.poolVmImage }}
|
|
${{ if and(eq(parameters.poolVmImage, ''), eq(parameters.agentOs, 'macOS')) }}:
|
|
vmImage: macOS-10.13
|
|
${{ if and(eq(parameters.poolVmImage, ''), eq(parameters.agentOs, 'Linux')) }}:
|
|
vmImage: ubuntu-16.04
|
|
${{ if ne(parameters.poolName, '') }}:
|
|
name: ${{ parameters.poolName }}
|
|
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Windows')) }}:
|
|
${{ if eq(variables['System.TeamProject'], 'internal') }}:
|
|
name: dotnet-internal-vs2019-preview
|
|
${{ if ne(variables['System.TeamProject'], 'internal') }}:
|
|
name: dotnet-external-vs2019-preview
|
|
variables:
|
|
AgentOsName: ${{ parameters.agentOs }}
|
|
ASPNETCORE_TEST_LOG_MAXPATH: "200" # Keep test log file name length low enough for artifact zipping
|
|
DOTNET_HOME: $(Agent.BuildDirectory)/.dotnet
|
|
BuildScript: ${{ parameters.buildScript }}
|
|
BuildScriptArgs: ${{ parameters.buildArgs }}
|
|
BuildConfiguration: ${{ parameters.configuration }}
|
|
BuildDirectory: ${{ parameters.buildDirectory }}
|
|
TeamName: AspNetCore
|
|
${{ if eq(parameters.agentOs, 'Windows') }}:
|
|
JAVA_HOME: $(Agent.BuildDirectory)\.tools\jdk
|
|
${{ if or(ne(parameters.codeSign, 'true'), ne(variables['System.TeamProject'], 'internal')) }}:
|
|
_SignType: ''
|
|
${{ if and(eq(parameters.codeSign, 'true'), eq(variables['System.TeamProject'], 'internal')) }}:
|
|
_SignType: real
|
|
${{ insert }}: ${{ parameters.variables }}
|
|
steps:
|
|
- checkout: self
|
|
clean: true
|
|
- ${{ if eq(parameters.installNodeJs, 'true') }}:
|
|
- task: NodeTool@0
|
|
displayName: Install Node 10.x
|
|
inputs:
|
|
versionSpec: 10.x
|
|
- ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}:
|
|
- powershell: ./eng/scripts/InstallJdk.ps1 '11.0.1'
|
|
displayName: Install JDK 11
|
|
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
|
|
- task: MicroBuildSigningPlugin@1
|
|
displayName: Install MicroBuild Signing plugin
|
|
condition: and(succeeded(), in(variables['_SignType'], 'test', 'real'))
|
|
inputs:
|
|
signType: $(_SignType)
|
|
zipSources: false
|
|
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
|
|
|
|
- ${{ parameters.beforeBuild }}
|
|
|
|
- ${{ if ne(parameters.steps, '')}}:
|
|
- ${{ parameters.steps }}
|
|
- ${{ if eq(parameters.steps, '')}}:
|
|
- ${{ if eq(parameters.buildScript, '') }}:
|
|
- ${{ if eq(parameters.agentOs, 'Windows') }}:
|
|
- script: .\$(BuildDirectory)\build.cmd -ci /p:SignType=$(_SignType) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs)
|
|
displayName: Run build.cmd
|
|
- powershell: eng\scripts\KillProcesses.ps1
|
|
displayName: Kill processes
|
|
condition: always()
|
|
- ${{ if ne(parameters.agentOs, 'Windows') }}:
|
|
- script: ./$(BuildDirectory)/build.sh -ci -p:Configuration=$(BuildConfiguration) $(BuildScriptArgs)
|
|
displayName: Run build.sh
|
|
- script: eng/scripts/KillProcesses.sh
|
|
displayName: Kill processes
|
|
condition: always()
|
|
- ${{ if ne(parameters.buildScript, '') }}:
|
|
- script: $(BuildScript) /p:Configuration=$(BuildConfiguration) $(BuildScriptArgs)
|
|
displayName: run $(BuildScript)
|
|
|
|
- ${{ parameters.afterBuild }}
|
|
|
|
- task: PublishTestResults@2
|
|
displayName: Publish test results
|
|
condition: always()
|
|
continueOnError: true
|
|
inputs:
|
|
testRunTitle: $(AgentOsName)-$(BuildConfiguration)
|
|
testRunner: vstest
|
|
testResultsFiles: '**/artifacts/**/*.trx'
|
|
mergeTestResults: true
|
|
- ${{ each artifact in parameters.artifacts }}:
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: Upload artifacts from ${{ artifact.path }}
|
|
condition: and(or(succeeded(), eq('${{ artifact.publishOnError }}', 'true')), or(eq(variables['system.pullrequest.isfork'], false), eq('${{ artifact.includeForks }}', 'true')))
|
|
continueOnError: true
|
|
inputs:
|
|
${{ if eq(parameters.buildDirectory, '') }}:
|
|
pathtoPublish: ${{ artifact.path }}
|
|
${{ if ne(parameters.buildDirectory, '') }}:
|
|
pathtoPublish: ${{ parameters.buildDirectory }}\${{ artifact.path }}
|
|
${{ if eq(artifact.name, '') }}:
|
|
artifactName: artifacts-$(AgentOsName)-$(BuildConfiguration)
|
|
${{ if ne(artifact.name, '') }}:
|
|
artifactName: ${{ artifact.name }}
|
|
artifactType: Container
|
|
parallel: true
|
|
|
|
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows')) }}:
|
|
- task: MicroBuildCleanup@1
|
|
displayName: Cleanup MicroBuild tasks
|
|
condition: always()
|