AspLabs/azure-pipelines.yml

216 строки
7.9 KiB
YAML

variables:
- name: Build.Repository.Clean
value: true
- name: _TeamName
value: AspNetCore
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: _HelixType
value: build/product
- name: _DotNetArtifactsCategory
value: .NETCore
# Variables for internal Official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- name: _HelixSource
value: official/aspnet/AspLabs/$(Build.SourceBranch)
trigger:
- main
pr:
- "*"
resources:
repositories:
# Repo: 1ESPipelineTemplates/1ESPipelineTemplates
- repository: 1esPipelines
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
parameters:
sdl:
sourceAnalysisPool:
name: NetCore1ESPool-Svc-Internal
image: 1es-windows-2022
os: windows
policheck:
enabled: true
tsa:
enabled: true
stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates-official/jobs/jobs.yml@self
parameters:
enablePublishBuildArtifacts: true
enablePublishTestResults: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
helixRepo: aspnet/AspLabs
# Align w/ Maestro++ default channel when generating software bills of materials (SBOMs).
PackageVersion: 6.0.0
# 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
jobs:
- job: Windows
pool:
name: NetCore1ESPool-Svc-Internal
image: 1es-windows-2019
os: windows
variables:
- name: _HelixBuildConfig
value: $(_BuildConfig)
strategy:
matrix:
${{ if in(variables['Build.Reason'], 'PullRequest') }}:
Debug:
_BuildConfig: Debug
_SignType: test
_BuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
Release:
_BuildConfig: Release
${{ 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:DotNetPublishUsingPipelines=true
/p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
/p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
/p:DotNetPublishToBlobFeed=true
steps:
- checkout: self
clean: true
- task: NodeTool@0
inputs:
versionSpec: '16.x'
- task: NuGetCommand@2
displayName: 'Clear NuGet caches'
condition: succeeded()
inputs:
command: custom
arguments: 'locals all -clear'
- script: eng\common\cibuild.cmd
-configuration $(_BuildConfig)
-prepareMachine
$(_BuildArgs)
name: Build
displayName: Build
condition: succeeded()
- task: PublishTestResults@2
displayName: Publish xUnit Test Results
condition: always()
continueOnError: true
inputs:
testRunner: xunit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish Packages
condition: and(eq(variables['system.pullrequest.isfork'], false), eq(variables['_BuildConfig'], 'Release'))
continueOnError: true
inputs:
artifactName: Packages_$(Agent.Os)_$(Agent.JobName)
path: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)'
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish Logs
condition: always()
continueOnError: true
inputs:
artifactName: Logs_$(Agent.Os)_$(Agent.JobName)
path: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
- job: macOS
pool:
name: Azure Pipelines
image: macOS-12
os: macOS
strategy:
matrix:
debug:
_BuildConfig: Debug
release:
_BuildConfig: Release
variables:
- name: _HelixBuildConfig
value: $(_BuildConfig)
steps:
- checkout: self
clean: true
- task: NodeTool@0
inputs:
versionSpec: '16.x'
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
name: Build
displayName: Build
condition: succeeded()
- task: PublishTestResults@2
displayName: Publish xUnit Test Results
condition: always()
continueOnError: true
inputs:
testRunner: xunit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish Logs
condition: always()
continueOnError: true
inputs:
artifactName: Logs_$(Agent.Os)_$(Agent.JobName)
path: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
- job: Linux
pool:
name: NetCore1ESPool-Svc-Internal
image: 1es-ubuntu-2004
container: LinuxContainer
os: linux
strategy:
matrix:
debug:
_BuildConfig: Debug
release:
_BuildConfig: Release
variables:
- name: _HelixBuildConfig
value: $(_BuildConfig)
steps:
- checkout: self
clean: true
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
name: Build
displayName: Build
condition: succeeded()
- task: PublishTestResults@2
displayName: Publish xUnit Test Results
condition: always()
continueOnError: true
inputs:
testRunner: xunit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish Logs
condition: always()
continueOnError: true
inputs:
artifactName: Logs_$(Agent.Os)_$(Agent.JobName)
path: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates-official\post-build\post-build.yml@self
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
# This is to enable SDL runs part of Post-Build Validation Stage
SDLValidationParameters:
enable: false