aspnetcore-tooling/azure-pipelines.yml

492 строки
19 KiB
YAML

#
# See https://docs.microsoft.com/azure/devops/pipelines/yaml-schema for reference.
#
variables:
- template: /eng/common/templates/variables/pool-providers.yml
- name: Build.Repository.Clean
value: true
- name: _TeamName
value: AspNetCore
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: Codeql.Enabled
value: true
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: DotNetBuilds storage account read tokens
- name: _InternalRuntimeDownloadArgs
value: /p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
/p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
- group: DotNet-DevDiv-Insertion-Workflow-Variables
- name: _DevDivDropAccessToken
value: $(dn-bot-devdiv-drop-rw-code-rw)
- group: DotNet-Roslyn-Insertion-Variables
- name: Razor.GitHubEmail
value: dotnet-build-bot@microsoft.com
- name: Razor.GitHubToken
value: $(AccessToken-dotnet-build-bot-public-repo)
- name: Razor.GitHubUserName
value: dotnet-build-bot
- name: Insertion.CreateDraftPR
value: true
- name: Insertion.TitlePrefix
value: '[Auto Insertion]'
- name: Insertion.TitleSuffix
value: ''
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: _InternalRuntimeDownloadArgs
value: ''
trigger:
batch: true
branches:
include:
- main
- main-vs-deps
- release/*
- internal/release/3.*
pr:
autoCancel: true
branches:
include:
- '*'
stages:
- stage: build
displayName: Build
jobs:
- ${{ if and(and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- template: /eng/common/templates/job/onelocbuild.yml
parameters:
LclSource: lclFilesfromPackage
LclPackageId: 'LCL-JUNO-PROD-RAZORTOOL'
MirrorRepo: razor
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enablePublishBuildArtifacts: false
enablePublishTestResults: false
enablePublishUsingPipelines: false
jobs:
# Code check
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- job: Code_check
displayName: Code check
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals windows.vs2022preview.amd64.open
${{ if ne(variables['System.TeamProject'], 'public') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2022preview.amd64
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- task: NuGetCommand@2
displayName: 'Clear NuGet caches'
condition: succeeded()
inputs:
command: custom
arguments: 'locals all -clear'
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- powershell: ./restore.cmd -msbuildEngine dotnet -ci $(_InternalRuntimeDownloadArgs); ./eng/scripts/CodeCheck.ps1 -ci
displayName: Run eng/scripts/CodeCheck.ps1
# Three jobs for each of the three OSes we want to run on
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enableTelemetry: true
enableSourcebuild: true
helixRepo: dotnet/razor
helixType: build.product/
# enableMicrobuild can't be read from a user-defined variable (Azure DevOps limitation)
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
enableMicrobuild: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
jobs:
- job: Windows
timeoutInMinutes: 120
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals windows.vs2022preview.amd64.open
${{ if ne(variables['System.TeamProject'], 'public') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals windows.vs2022preview.amd64
strategy:
matrix:
${{ if eq(variables['System.TeamProject'], 'public') }}:
debug:
_BuildConfig: Debug
_PublishArgs: ''
release:
_BuildConfig: Release
_PublishArgs: ''
${{ if ne(variables['System.TeamProject'], 'public') }}:
release:
_BuildConfig: Release
${{ if in(variables['Build.Reason'], 'PullRequest') }}:
_PublishArgs: ''
${{ if notin(variables['Build.Reason'], 'PullRequest') }}:
_PublishArgs: /p:DotNetPublishUsingPipelines=true
variables:
- _BuildArgs: ''
- XUNIT_LOGS: '$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)'
- __VSNeverShowWhatsNew: 1
# Variables for internal Official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- _SignType: real
- _BuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(Build.BuildNumber)
/p:ManifestBuildBranch=$(Build.SourceBranchName)
/p:ManifestBuildNumber=$(Build.BuildNumber)
/p:VisualStudioDropName=Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
/p:GenerateSbom=true
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- powershell: npm install -g yarn
displayName: Install yarn
condition: succeeded()
- task: NuGetCommand@2
displayName: 'Clear NuGet caches'
condition: succeeded()
inputs:
command: custom
arguments: 'locals all -clear'
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- template: /eng/restore-internal-tools.yml
- powershell: ./eng/scripts/InstallProcDump.ps1
displayName: Install ProcDump
- powershell: ./eng/scripts/StartDumpCollectionForHangingBuilds.ps1
$(ProcDumpPath)procdump.exe artifacts/log/$(_BuildConfig)
(Get-Date).AddMinutes(60)
devenv, xunit.console, xunit.console.x86
displayName: Start background dump collection
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- script: eng\cibuild.cmd
-configuration $(_BuildConfig)
-msbuildEngine vs
-prepareMachine
-restore
-build
-pack
-publish
-sign
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build and Deploy
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Upload Build BinLog
condition: always()
continueOnError: true
inputs:
pathtoPublish: artifacts/log/$(_BuildConfig)/Build.binlog
artifactName: $(Agent.Os)_$(Agent.JobName) BuildBinLog
artifactType: Container
parallel: true
- powershell: eng\SetupVSHive.ps1
displayName: Setup VS Hive
- script: eng\CIBuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
-test
-integrationTest
name: Run_Tests
displayName: Run Unit and Integration tests
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Upload Run tests BinLog
condition: always()
continueOnError: true
inputs:
pathtoPublish: artifacts/log/$(_BuildConfig)/Build.binlog
artifactName: $(Agent.Os)_$(Agent.JobName) RunTestsBinLog
artifactType: Container
parallel: true
- powershell: ./eng/scripts/FinishDumpCollectionForHangingBuilds.ps1 artifacts/log/$(_BuildConfig)
displayName: Finish background dump collection
continueOnError: true
condition: always()
- task: PublishBuildArtifacts@1
displayName: Upload Test Results
condition: always()
continueOnError: true
inputs:
pathtoPublish: artifacts/TestResults/$(_BuildConfig)/
artifactName: $(Agent.Os)_$(Agent.JobName) TestResults
artifactType: Container
parallel: true
# - task: PublishTestResults@2
# displayName: Publish VSCode Test Results
# inputs:
# testResultsFormat: 'JUnit'
# testResultsFiles: '*.xml'
# searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
# continueOnError: true
# condition: always()
# Publish an artifact that the RoslynInsertionTool is able to find by its name.
- task: PublishBuildArtifacts@1
displayName: Publish Artifact VSSetup
inputs:
PathtoPublish: 'artifacts\VSSetup\$(_BuildConfig)'
ArtifactName: 'VSSetup'
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false), eq(variables['_BuildConfig'], 'Release'))
- task: PublishBuildArtifacts@1
displayName: Publish VS for Mac Artifacts
inputs:
PathtoPublish: 'artifacts\MPack\$(_BuildConfig)'
ArtifactName: MPack_$(Agent.Os)_$(_BuildConfig)
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false), eq(variables['_BuildConfig'], 'Release'))
- task: PublishBuildArtifacts@1
displayName: Publish package artifacts
inputs:
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
ArtifactName: Packages_$(Agent.Os)_$(_BuildConfig)
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false), eq(variables['_BuildConfig'], 'Release'))
- powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)"
displayName: Setting VisualStudio.DropName variable
# Publishes setup VSIXes to a drop.
# Note: The insertion tool looks for the display name of this task in the logs.
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1
displayName: Upload VSTS Drop
inputs:
DropName: $(VisualStudio.DropName)
DropFolder: 'artifacts\VSSetup\$(_BuildConfig)\Insertion'
AccessToken: $(_DevDivDropAccessToken)
continueOnError: true
condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false), eq(variables['_BuildConfig'], 'Release'))
- job: macOS
pool:
vmImage: macOS-12
strategy:
${{ if eq(variables['System.TeamProject'], 'public') }}:
matrix:
debug:
_BuildConfig: Debug
release:
_BuildConfig: Release
${{ if ne(variables['System.TeamProject'], 'public') }}:
matrix:
release:
_BuildConfig: Release
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
/p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Upload TestResults
condition: always()
continueOnError: true
inputs:
pathtoPublish: artifacts/TestResults/$(_BuildConfig)/
artifactName: $(Agent.Os)_$(Agent.JobName) TestResults
artifactType: Container
parallel: true
- job: Linux
container:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7
options: --init # This ensures all the stray defunct processes are reaped.
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
vmImage: ubuntu-latest
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
variables:
- LC_ALL: 'en_US.UTF-8'
- LANG: 'en_US.UTF-8'
- LANGUAGE: 'en_US.UTF-8'
strategy:
${{ if eq(variables['System.TeamProject'], 'public') }}:
matrix:
debug:
_BuildConfig: Debug
release:
_BuildConfig: Release
${{ if ne(variables['System.TeamProject'], 'public') }}:
matrix:
release:
_BuildConfig: Release
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
/p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- task: PublishBuildArtifacts@1
displayName: Upload Test Results
condition: always()
continueOnError: true
inputs:
pathtoPublish: artifacts/TestResults/$(_BuildConfig)/
artifactName: $(Agent.Os)_$(Agent.JobName) TestResults
artifactType: Container
parallel: true
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
parameters:
publishingInfraVersion: 3
enableSigningValidation: false
enableNugetValidation: false
SDLValidationParameters:
enable: true
params: >-
-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
-TsaProjectName $(_TsaProjectName)
-TsaNotificationEmail $(_TsaNotificationEmail)
-TsaCodebaseAdmin $(_TsaCodebaseAdmin)
-TsaBugAreaPath $(_TsaBugAreaPath)
-TsaIterationPath $(_TsaIterationPath)
-TsaRepositoryName "Razor-Tooling"
-TsaCodebaseName "Razor-Tooling"
-TsaPublish $True
- stage: insert
dependsOn: publish_using_darc
displayName: Insert to VS
jobs:
- job: insert
displayName: Insert to VS
pool:
name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2022.amd64
steps:
- download: current
artifact: VSSetup
- powershell: |
$branchName = "$(Build.SourceBranch)".Substring("refs/heads/".Length)
Write-Host "##vso[task.setvariable variable=ComponentBranchName]$branchName"
displayName: Get Branch Name
- template: eng/pipelines/insert.yml
parameters:
buildUserName: "dn-bot@microsoft.com"
buildPassword: $(dn-bot-devdiv-build-e-code-full-release-e-packaging-r)
componentUserName: "dn-bot@microsoft.com"
componentPassword: $(dn-bot-dnceng-build-e-code-full-release-e-packaging-r)
componentBuildProjectName: internal
sourceBranch: "$(ComponentBranchName)"
publishDataURI: "https://dev.azure.com/dnceng/internal/_apis/git/repositories/dotnet-razor/items?path=/eng/config/PublishData.json&api-version=6.0"
publishDataAccessToken: "$(System.AccessToken)"
dropPath: '$(Pipeline.Workspace)\VSSetup'