msbuild/.vsts-dotnet.yml

271 строка
10 KiB
YAML

trigger:
- main
- vs*
- exp/*
# If defined here, these values are not overrideable
# Once they exist, we should define these as "runtime parameters"
# https://github.com/Microsoft/azure-pipelines-yaml/pull/129
# variables:
# SignType: real
# SkipApplyOptimizationData: false
parameters:
- name: OptProfDropName
displayName: Optional OptProfDrop Override
type: string
default: 'default'
variables:
# if OptProfDrop is not set, string '$(OptProfDrop)' will be passed to the build script.
- name: OptProfDrop
value: ''
- name: SourceBranch
value: $(IbcSourceBranchName)
# If we're not on a vs* branch, use main as our optprof collection branch
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs')) }}:
- name: SourceBranch
value: main
# if OptProfDropName is set as a parameter, set OptProfDrop to the parameter and unset SourceBranch
- ${{ if ne(parameters.OptProfDropName, 'default') }}:
- name: OptProfDrop
value: ${{parameters.OptProfDropName}}
- name: SourceBranch
value: ''
- name: _DotNetArtifactsCategory
value: .NETCore
- name: _DotNetValidationArtifactsCategory
value: .NETCoreValidation
stages:
- stage: build
displayName: Build
jobs:
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: # should track next-release's active dev branch
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-MSBUILD'
MirrorRepo: 'msbuild'
MirrorBranch: 'main' # should match condition above
- job: Windows_NT
pool:
name: VSEngSS-MicroBuild2022-1ES
demands:
- agent.os -equals Windows_NT
timeoutInMinutes: 180
variables:
- group: DotNet-Blob-Feed
- group: DotNet-Symbol-Publish
- group: Publish-Build-Assets
- name: TeamName
value: MSBuild
- name: VisualStudio.MajorVersion
value: 17
- name: VisualStudio.ChannelName
value: 'int.main'
- name: VisualStudio.DropName
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
steps:
- task: NuGetToolInstaller@0
inputs:
versionSpec: '4.9.2'
- task: NuGetCommand@2
displayName: Restore internal tools
inputs:
command: restore
feedsToUse: config
restoreSolution: 'eng\common\internal\Tools.csproj'
nugetConfigPath: 'NuGet.config'
restoreDirectory: '$(Build.SourcesDirectory)\.packages'
- task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@1
inputs:
signType: $(SignType)
zipSources: false
condition: and(succeeded(), in(variables['SignType'], 'test', 'real'))
- task: MicroBuildOptProfPlugin@6
inputs:
ProfilingInputsDropName: '$(VisualStudio.DropName)'
ShouldSkipOptimize: true
AccessToken: '$(System.AccessToken)'
feedSource: 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
displayName: 'Install OptProf Plugin'
# Required by MicroBuildBuildVSBootstrapper
- task: MicroBuildSwixPlugin@4
inputs:
dropName: $(VisualStudio.DropName)
- script: eng/CIBuild.cmd
-configuration $(BuildConfiguration)
-officialBuildId $(Build.BuildNumber)
-officialSkipApplyOptimizationData $(SkipApplyOptimizationData)
/p:RepositoryName=$(Build.Repository.Name)
/p:VisualStudioIbcSourceBranchName=$(SourceBranch)
/p:VisualStudioDropAccessToken=$(System.AccessToken)
/p:VisualStudioDropName=$(VisualStudio.DropName)
/p:DotNetSignType=$(SignType)
/p:DotNetPublishToBlobFeed=true
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:PublishToSymbolServer=true
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:TeamName=MSBuild
/p:DotNetPublishUsingPipelines=true
/p:VisualStudioIbcDrop=$(OptProfDrop)
displayName: Build
condition: succeeded()
# Required by Microsoft policy
- template: eng\common\templates\steps\generate-sbom.yml
# Publish OptProf configuration files
- task: ms-vscs-artifact.build-tasks.artifactDropTask-1.artifactDropTask@0
inputs:
dropServiceURI: 'https://devdiv.artifacts.visualstudio.com'
buildNumber: 'ProfilingInputs/DevDiv/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)'
sourcePath: '$(Build.SourcesDirectory)\artifacts\OptProf\$(BuildConfiguration)\Data'
toLowerCase: false
usePat: true
displayName: 'OptProf - Publish to Artifact Services - ProfilingInputs'
condition: succeeded()
# Build VS bootstrapper
# Generates $(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json
- task: MicroBuildBuildVSBootstrapper@2
inputs:
vsMajorVersion: $(VisualStudio.MajorVersion)
channelName: $(VisualStudio.ChannelName)
manifests: $(VisualStudio.SetupManifestList)
outputFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\Insertion'
bootstrapperCoreVersion:
displayName: 'OptProf - Build VS bootstrapper'
condition: succeeded()
# Publish run settings
- task: PowerShell@2
inputs:
filePath: eng\common\sdk-task.ps1
arguments: -configuration $(BuildConfiguration)
-task VisualStudio.BuildIbcTrainingSettings
/p:VisualStudioDropName=$(VisualStudio.DropName)
/p:BootstrapperInfoPath=$(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json
displayName: 'OptProf - Build IBC training settings'
condition: succeeded()
# Publish bootstrapper info
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.StagingDirectory)\MicroBuild\Output
ArtifactName: MicroBuildOutputs
ArtifactType: Container
displayName: 'OptProf - Publish Artifact: MicroBuildOutputs'
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: logs'
inputs:
PathtoPublish: 'artifacts\log\$(BuildConfiguration)'
ArtifactName: logs
condition: succeededOrFailed()
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: bin'
inputs:
path: 'artifacts\bin'
artifactName: bin
condition: succeededOrFailed()
# Publishes setup VSIXes to a drop.
# Note: The insertion tool looks for the display name of this task in the logs.
- task: MicroBuildUploadVstsDropFolder@2
displayName: Upload VSTS Drop
inputs:
DropName: $(VisualStudio.DropName)
DropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion'
AccessToken: '$(System.AccessToken)'
DropServiceUri: 'https://devdiv.artifacts.visualstudio.com'
VSDropServiceUri: 'https://vsdrop.corp.microsoft.com/file/v1'
condition: succeeded()
# Publish an artifact that the RoslynInsertionTool is able to find by its name.
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: VSSetup'
inputs:
PathtoPublish: 'artifacts\VSSetup\$(BuildConfiguration)'
ArtifactName: VSSetup
condition: succeeded()
# Archive NuGet packages to DevOps.
# Publish our NuPkgs as an artifact. The name of this artifact must be PackageArtifacts as the
# arcade templates depend on the name.
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: packages'
inputs:
PathtoPublish: 'artifacts\packages\$(BuildConfiguration)'
ArtifactName: PackageArtifacts
condition: succeeded()
# Publish "IntelliSense" XSD files to their own artifact
# so it can be consumed by the insertion-to-VS job
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: xsd'
inputs:
path: 'artifacts\xsd'
artifactName: xsd
condition: succeeded()
# Publish Asset Manifests for Build Asset Registry job
- task: PublishBuildArtifacts@1
displayName: Publish Asset Manifests
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest'
ArtifactName: AssetManifests
condition: succeeded()
# Tag the build at the very end when we know it's been successful.
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: Tag build as ready for optimization training
inputs:
tags: 'ready-for-training'
condition: succeeded()
- task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1
displayName: Execute cleanup tasks
condition: succeededOrFailed()
- template: /eng/common/templates/job/source-build.yml
parameters:
platform:
name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343'
- template: /eng/common/templates/job/publish-build-assets.yml
parameters:
enablePublishBuildArtifacts: true
publishUsingPipelines: true
dependsOn:
- Windows_NT
- Source_Build_Managed
pool:
vmImage: windows-latest
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
publishingInfraVersion: 3
# Symbol validation is not entirely reliable as of yet, so should be turned off until
# https://github.com/dotnet/arcade/issues/2871 is resolved.
enableSymbolValidation: false
enableSourceLinkValidation: false
enableNugetValidation: false