try/azure-pipelines.yml

153 строки
6.3 KiB
YAML

# azure-pipelines.yml
parameters:
- name: SkipTests
displayName: Skip Tests
type: boolean
default: false
# CI and PR triggers
trigger:
- main
- feature/*
- release/*
pr:
- main
- feature/*
- release/*
variables:
- template: /eng/templates/variables-template.yml@self
- name: system.debug
value: true
- name: additionalWindowsArgs
value: '--diag $(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/diag.txt -p:m=1'
- name: additionalLinuxArgs
value: '--diag $(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/diag.txt'
stages:
- stage: build
displayName: Build and Test
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
jobs:
- job: Windows_NT
pool:
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
name: NetCore-Public
demands: ImageOverride -equals windows.vs2022.amd64.open
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals windows.vs2022.amd64
variables:
- name: RunIntegrationTests
value: true
- name: TRYDOTNET_PREBUILDS_PATH
value: $(Build.SourcesDirectory)\artifacts\trydotnet-prebuilds
- name: POCKETLOGGER_LOG_PATH
value: $(Build.SourcesDirectory)\artifacts\logs\pocketlogger.log
# Enable signing for internal, non-PR builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: DotNet-Symbol-Server-Pats
- name: _SignType
value: Real
- name: _DotNetPublishToBlobFeed
value: false
- name: _BuildArgs
value: /p:SignType=$(_SignType)
/p:DotNetSignType=$(_SignType)
/p:MicroBuild_SigningEnabled=true
/p:OverridePackageSource=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:TeamName=$(_TeamName)
/p:DotNetPublishToBlobFeed=false
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# else
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _SignType
value: Test
- name: _BuildArgs
value: /p:SignType=$(_SignType)
steps:
- template: /eng/templates/build-and-test-job-windows-templates.yml@self
parameters:
buildConfig: $(_BuildConfig)
skipTests: $(SkipTests)
buildArgs: $(_BuildArgs)
additionalArgs: $(additionalWindowsArgs)
- task: PublishBuildArtifacts@1
displayName: Publish Windows artifacts
inputs:
pathToPublish: $(Build.SourcesDirectory)/artifacts/
artifactName: Windows_artifacts
artifactType: container
condition: always()
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: false
enablePublishUsingPipelines: false
jobs:
- job: Linux
pool:
vmImage: ubuntu-20.04
variables:
- name: TRYDOTNET_PREBUILDS_PATH
value: $(Build.SourcesDirectory)/artifacts/trydotnet-prebuilds
- name: POCKETLOGGER_LOG_PATH
value: $(Build.SourcesDirectory)/artifacts/logs/pocketlogger.log
# Enable signing for internal, non-PR builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- name: _SignType
value: Test
- name: _BuildArgs
value: /p:SignType=$(_SignType)
/p:DotNetSignType=$(_SignType)
/p:OverridePackageSource=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:TeamName=$(_TeamName)
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
# else
- ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
- name: _SignType
value: Test
- name: _BuildArgs
value: /p:SignType=$(_SignType)
steps:
- template: /eng/templates/build-and-test-job-linux-templates.yml@self
parameters:
buildConfig: $(_BuildConfig)
skipTests: $(SkipTests)
additionalArgs: $(additionalLinuxArgs)
- task: PublishBuildArtifacts@1
displayName: Publish Linux artifacts
inputs:
pathToPublish: $(Build.SourcesDirectory)/artifacts/
artifactName: Linux_artifacts
artifactType: container
condition: always()
#---------------------------------------------------------------------------------------------------------------------#
# Post Build #
#---------------------------------------------------------------------------------------------------------------------#
- ${{ 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
# SourceLink improperly looks for generated files. See https://github.com/dotnet/arcade/issues/3069
enableSourceLinkValidation: false