try/azure-pipelines-CI.yml

185 строки
7.2 KiB
YAML

# azure-pipelines-CI.yml
parameters:
- name: SkipTests
displayName: Skip Tests
type: boolean
default: false
# CI and PR triggers
trigger:
- main
- feature/*
- release/*
pr:
- main
- feature/*
- release/*
resources:
repositories:
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
variables:
- template: /eng/common/templates/variables/pool-providers.yml@self
- template: /eng/templates/variables-template.yml@self
- name: additionalWindowsArgs
value: ''
- name: additionalLinuxArgs
value: ''
extends:
# The pipeline extends the 1ES PT which will inject different SDL and compliance tasks.
# For non-production pipelines, use "Unofficial" as defined below.
# For productions pipelines, use "Official".
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
# Update the pool with your team's 1ES hosted pool.
pool:
name: $(DncEngInternalBuildPool) # Name of your hosted pool
image: 1es-windows-2022 # Name of the image in your pool. If not specified, first image of the pool is used
os: windows # OS of the image. This value cannot be a variable. Allowed values: windows, linux, macOS
# Build Tags
customBuildTags:
- TryDotNet
- $(Build.BuildNumber)
sdl:
git:
longpaths: true
tsa:
enabled: true
config:
repositoryName: 'dotnet-try'
codebaseName: 'dotnet-try'
instanceUrl: 'https://devdiv.visualstudio.com/'
projectName: 'DEVDIV'
iterationPath: 'DevDiv\\Future Backlog'
areaPath: 'DevDiv\\NET Developer Experience\\VS Testing\\Interactive'
notificationAliases: ['dotnetInteractive@microsoft.com']
serviceTreeID: 'ab4d58de-beb3-4714-866c-1b46a48ea002'
allTools: true
policheck:
enabled: true
stages:
- stage: build
displayName: Build and Test
jobs:
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: $(_PublishUsingPipelines)
jobs:
- job: Windows_NT
pool:
# TODO: Can we use latest or equivalent?
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals 1es-windows-2022
os: windows
templateContext:
# This enables SDL scanning to be run once across all artifacts
outputParentDirectory: $(Build.SourcesDirectory)/artifacts
outputs:
- output: pipelineArtifact
targetPath: $(Build.SourcesDirectory)/artifacts
artifactName: Windows_artifacts
displayName: Publish Windows artifacts
condition: always()
variables:
- name: TRYDOTNET_PREBUILDS_PATH
value: $(Build.SourcesDirectory)\artifacts\trydotnet-prebuilds
- name: POCKETLOGGER_LOG_PATH
value: $(Build.SourcesDirectory)\artifacts\logs\pocketlogger.log
- name: RunIntegrationTests
value: true
# 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)
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: false
enablePublishUsingPipelines: false
jobs:
- job: Linux
pool:
name: $(DncEngInternalBuildPool)
os: linux
demands: ImageOverride -equals 1es-mariner-2
templateContext:
# This enables SDL scanning to be run once across all artifacts
outputParentDirectory: $(Build.SourcesDirectory)/artifacts
outputs:
- output: pipelineArtifact
targetPath: $(Build.SourcesDirectory)/artifacts
artifactName: Linux_artifacts
displayName: Publish Linux artifacts
condition: always()
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)