metadata-tools/azure-pipelines.yml

157 строки
6.0 KiB
YAML

# Branches that trigger builds on PR
pr:
branches:
include:
- main
- release/*
paths:
exclude:
- README.md
- docs/*
# Run official build every day at midnight, if code has changed since the last run.
schedules:
- cron: "0 0 * * *"
displayName: Daily Official Build
branches:
include:
- main
- cron: "0 8 22-28 * 0" # Fourth Sunday of each month at 8:00 UTC.
displayName: "Monthly build check"
branches:
include:
- main
always: true # Run even if there have been no source code changes since the last successful scheduled run
batch: false # Do not run the pipeline if the previously scheduled run is in-progress
variables:
- name: _TeamName
value: Roslyn
- name: _PublishUsingPipelines
value: true
- name: _DotNetArtifactsCategory
value: .NETCore
stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
enableTelemetry: true
helixRepo: dotnet/symreader
jobs:
- job: Windows
pool:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
vmImage: 'windows-latest'
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals 1es.windows-2022
variables:
# Only enable publishing in official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
# DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1
# Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- group: DotNet-Blob-Feed
- group: Publish-Build-Assets
- name: _OfficialBuildArgs
value: /p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# else
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _OfficialBuildArgs
value: ''
strategy:
matrix:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
Debug:
_BuildConfig: Debug
_SignType: test
_DotNetPublishToBlobFeed: false
_BuildArgs: ''
Release:
_BuildConfig: Release
# PRs or external builds are not signed.
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: test
_DotNetPublishToBlobFeed: false
_BuildArgs: ''
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
_SignType: real
_DotNetPublishToBlobFeed: true
_BuildArgs: $(_OfficialBuildArgs)
steps:
- checkout: self
clean: true
- script: eng\common\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
displayName: Build and Test
# Archive NuGet packages to DevOps (workaround for https://github.com/dotnet/arcade/issues/4444)
- task: PublishBuildArtifacts@1
displayName: Publish Artifact Packages
inputs:
PathtoPublish: 'artifacts\packages\$(_BuildConfig)'
ArtifactName: 'Packages'
condition: succeeded()
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- job: MacOS
displayName: 'MacOS'
pool:
vmImage: 'macOS-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
_DotNetPublishToBlobFeed : false
Release:
_BuildConfig: Release
_SignType: none
_DotNetPublishToBlobFeed : false
steps:
- checkout: self
clean: true
- script: eng/common/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test
- job: Linux
displayName: 'Linux'
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Debug:
_BuildConfig: Debug
_SignType: none
_DotNetPublishToBlobFeed : false
Release:
_BuildConfig: Release
_SignType: none
_DotNetPublishToBlobFeed : false
steps:
- checkout: self
clean: true
- script: eng/common/cibuild.sh --configuration $(_BuildConfig) --prepareMachine
displayName: Build and Test
- ${{ 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 isn't being very reliable lately. This should be enabled back
# once this issue is resolved: https://github.com/dotnet/arcade/issues/2871
enableSymbolValidation: false