aspnetcore/.azure/pipelines/ci-public.yml

688 строки
23 KiB
YAML

#
# See https://learn.microsoft.com/azure/devops/pipelines/yaml-schema for details on this file.
#
# Configure which branches trigger builds
trigger:
batch: true
branches:
include:
- main
- release/*
# Run PR validation on all branches
# This doesn't have any path exclusions, even for things like docs, because
# we have it configured in GitHub as a required check, and for it to pass
# it must actually run, even if it's not relevant to a particular change.
pr:
autoCancel: true
branches:
include:
- '*'
parameters:
# Choose whether to skip tests when running pipeline manually.
- name: skipTests
default: false
displayName: Skip tests?
type: boolean
# Parameters below are ignored in public builds.
#
# Choose whether to enable binlogs when running pipeline manually.
# Binary logs are enabled by default in public builds and aren't designed to be disabled there.
- name: produceBinlogs
default: false
displayName: Produce binlogs?
type: boolean
variables:
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: _TeamName
value: AspNetCore
- name: _PublishUsingPipelines
value: true
- ${{ if or(startswith(variables['Build.SourceBranch'], 'refs/heads/release/'), startswith(variables['Build.SourceBranch'], 'refs/heads/internal/release/'), eq(variables['Build.Reason'], 'Manual')) }}:
- name: PostBuildSign
value: false
- ${{ else }}:
- name: PostBuildSign
value: true
- name: _UseHelixOpenQueues
value: ${{ ne(variables['System.TeamProject'], 'internal') }}
- name: _BuildArgs
value: '/p:SkipTestBuild=true /p:PostBuildSign=$(PostBuildSign)'
- name: _PublishArgs
value: ''
# Write binary logs for all main Windows build steps except the x86 one in public and PR builds.
- name: WindowsArm64LogArgs
value: /bl:artifacts/log/Release/Build.arm64.binlog
- name: Windows64LogArgs
value: /bl:artifacts/log/Release/Build.x64.binlog
- name: Windows86LogArgs
value: -ExcludeCIBinaryLog
- name: WindowsSignLogArgs
value: /bl:artifacts/log/Release/Build.CodeSign.binlog
- name: WindowsInstallersLogArgs
value: /bl:artifacts/log/Release/Build.Installers.binlog
- name: WindowsArm64InstallersLogArgs
value: /bl:artifacts/log/Release/Build.Installers.Arm64.binlog
- name: _SignType
value: ''
- name: _InternalRuntimeDownloadArgs
value: ''
- name: _InternalRuntimeDownloadCodeSignArgs
value: ''
- name: Codeql.Enabled
value: false
- name: Codeql.SkipTaskAutoInjection
value: true
- template: /eng/common/templates/variables/pool-providers.yml
resources:
containers:
- container: debpkg
image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-22.04-debpkg
- container: rpmpkg
image: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-fpm
stages:
- stage: build
displayName: Build
jobs:
# Code check
- template: jobs/default-build.yml
parameters:
jobName: Code_check
jobDisplayName: Code check
agentOs: Windows
steps:
- powershell: ./eng/scripts/CodeCheck.ps1 -ci $(_InternalRuntimeDownloadArgs)
displayName: Run eng/scripts/CodeCheck.ps1
artifacts:
- name: Code_Check_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
# Build Windows (x64/x86/arm64)
- template: jobs/default-build.yml
parameters:
codeSign: true
jobName: Windows_build
jobDisplayName: "Build: Windows x64/x86/arm64"
agentOs: Windows
steps:
- ${{ if notIn(variables['Build.Reason'], 'PullRequest') }}:
- script: "echo ##vso[build.addbuildtag]daily-build"
displayName: 'Set CI daily-build tag'
# !!! NOTE !!! Some of these steps have disabled code signing.
# This is intentional to workaround https://github.com/dotnet/arcade/issues/1957 which always re-submits for code-signing, even
# if they have already been signed. This results in slower builds due to re-submitting the same .nupkg many times for signing.
# The sign settings have been configured to
- script: ./eng/build.cmd
-ci
-prepareMachine
-nativeToolsOnMachine
-arch x64
-pack
-all
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
$(Windows64LogArgs)
displayName: Build x64
# Build the x86 shared framework
# This is going to actually build x86 native assets.
- script: ./eng/build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-arch x86
-pack
-all
-noBuildJava
-noBuildNative
/p:OnlyPackPlatformSpecificPackages=true
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
$(Windows86LogArgs)
displayName: Build x86
# Build the arm64 shared framework
- script: ./eng/build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-arch arm64
-sign
-pack
-noBuildJava
-noBuildNative
/p:DotNetSignType=$(_SignType)
/p:OnlyPackPlatformSpecificPackages=true
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
$(WindowsArm64LogArgs)
displayName: Build ARM64
- script: .\src\SiteExtensions\build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-pack
-noBuildDeps
-noBuildNative
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Build SiteExtension
# This runs code-signing on all packages, zips, and jar files as defined in build/CodeSign.targets. If
# https://github.com/dotnet/arcade/issues/1957 is resolved, consider running code-signing inline with the other
# previous steps. Sign check is disabled because it is run in a separate step below, after installers are built.
- script: ./eng/build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-noBuildNative
-noBuild
-sign
/p:DotNetSignType=$(_SignType)
$(_BuildArgs)
$(WindowsSignLogArgs)
displayName: Code sign packages
# Windows installers bundle x86/x64/arm64 assets
- script: ./eng/build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-sign
-buildInstallers
-noBuildNative
/p:DotNetSignType=$(_SignType)
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
$(WindowsInstallersLogArgs)
displayName: Build Installers
# Windows installers bundle and sharedfx msi for arm64
- script: ./eng/build.cmd
-ci
-prepareMachine
-noBuildRepoTasks
-arch arm64
-sign
-buildInstallers
-noBuildNative
-publish
/p:DotNetSignType=$(_SignType)
/p:AssetManifestFileName=aspnetcore-win.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
$(WindowsArm64InstallersLogArgs)
displayName: Build ARM64 Installers
artifacts:
- name: Windows_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Windows_Packages
path: artifacts/packages/
- name: Windows_HostingBundle
path: artifacts/bin/WindowsHostingBundle
- name: Windows_ANCM_Msi
path: artifacts/bin/ANCMv2
- name: Windows_ANCMIISExpress_Msi
path: artifacts/bin/AncmIISExpressV2
# Build MacOS arm64
- template: jobs/default-build.yml
parameters:
jobName: MacOs_arm64_build
jobDisplayName: "Build: macOS arm64"
agentOs: macOs
timeoutInMinutes: 90
buildArgs:
--arch arm64
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-MacOS_arm64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
artifacts:
- name: MacOS_arm64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: MacOS_arm64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: MacOS_arm64
# Build MacOS x64
- template: jobs/default-build.yml
parameters:
jobName: MacOs_x64_build
jobDisplayName: "Build: macOS x64"
agentOs: macOs
timeoutInMinutes: 90
buildArgs:
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-MacOS_x64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
artifacts:
- name: MacOS_x64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: MacOS_x64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: MacOS_x64
# Build Linux x64
- template: jobs/default-build.yml
parameters:
jobName: Linux_x64_build
jobDisplayName: "Build: Linux x64"
agentOs: Linux
useHostedUbuntu: false
steps:
- script: ./eng/build.sh
--ci
--arch x64
--pack
--all
--no-build-java
-p:OnlyPackPlatformSpecificPackages=true
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Run build.sh
- script: ./eng/build.sh
--ci
--nobl
--arch x64
--build-installers
--no-build-deps
--no-build-nodejs
-p:OnlyPackPlatformSpecificPackages=true
-p:BuildRuntimeArchive=false
-p:LinuxInstallerType=deb
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Build Debian installers
target: debpkg
- script: ./eng/build.sh
--ci
--nobl
--arch x64
--build-installers
--no-build-deps
--no-build-nodejs
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:BuildRuntimeArchive=false
-p:LinuxInstallerType=rpm
-p:AssetManifestFileName=aspnetcore-Linux_x64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Build RPM installers
target: rpmpkg
artifacts:
- name: Linux_x64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_x64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_x64
# Build Linux ARM
- template: jobs/default-build.yml
parameters:
jobName: Linux_arm_build
jobDisplayName: "Build: Linux ARM"
agentOs: Linux
buildArgs:
--arch arm
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-Linux_arm.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
artifacts:
- name: Linux_arm_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_arm_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_arm
# Build Linux ARM64
- template: jobs/default-build.yml
parameters:
jobName: Linux_arm64_build
jobDisplayName: "Build: Linux ARM64"
agentOs: Linux
steps:
- script: ./eng/build.sh
--ci
--arch arm64
--pack
--all
--no-build-java
-p:OnlyPackPlatformSpecificPackages=true
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Run build.sh
- script: ./eng/build.sh
--ci
--nobl
--arch arm64
--build-installers
--no-build-deps
--no-build-nodejs
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:BuildRuntimeArchive=false
-p:LinuxInstallerType=rpm
-p:AssetManifestFileName=aspnetcore-Linux_arm64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
displayName: Build RPM installers
target: rpmpkg
artifacts:
- name: Linux_arm64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_arm64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_arm64
# Build Linux Musl x64
- template: jobs/default-build.yml
parameters:
jobName: Linux_musl_x64_build
jobDisplayName: "Build: Linux Musl x64"
agentOs: Linux
container: mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.19-WithNode
buildArgs:
--arch x64
--os-name linux-musl
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-Linux_musl_x64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
disableComponentGovernance: true
artifacts:
- name: Linux_musl_x64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_musl_x64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_musl_x64
# Build Linux Musl ARM
- template: jobs/default-build.yml
parameters:
jobName: Linux_musl_arm_build
jobDisplayName: "Build: Linux Musl ARM"
agentOs: Linux
useHostedUbuntu: false
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm-alpine
buildArgs:
--arch arm
--os-name linux-musl
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-Linux_musl_arm.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
artifacts:
- name: Linux_musl_arm_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_musl_arm_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_musl_arm
# Build Linux Musl ARM64
- template: jobs/default-build.yml
parameters:
jobName: Linux_musl_arm64_build
jobDisplayName: "Build: Linux Musl ARM64"
agentOs: Linux
useHostedUbuntu: false
container: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-cross-arm64-alpine
buildArgs:
--arch arm64
--os-name linux-musl
--pack
--all
--no-build-java
--publish
-p:OnlyPackPlatformSpecificPackages=true
-p:AssetManifestFileName=aspnetcore-Linux_musl_arm64.xml
$(_BuildArgs)
$(_PublishArgs)
$(_InternalRuntimeDownloadArgs)
artifacts:
- name: Linux_musl_arm64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_musl_arm64_Packages
path: artifacts/packages/
- ${{ if ne(variables.PostBuildSign, 'true') }}:
- template: jobs/codesign-xplat.yml
parameters:
inputName: Linux_musl_arm64
- ${{ if ne(parameters.skipTests, 'true') }}:
# Test jobs
- template: jobs/default-build.yml
parameters:
jobName: Windows_Test
jobDisplayName: "Test: Windows Server x64"
agentOs: Windows
isAzDOTestingJob: true
# Just uploading artifacts/logs/ files can take 15 minutes. Doubling the cancel timeout for this job.
cancelTimeoutInMinutes: 30
buildArgs: -all -pack -test -binaryLog /p:SkipHelixReadyTests=true /p:SkipIISNewHandlerTests=true /p:SkipIISTests=true
/p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false /p:RunBlazorPlaywrightTemplateTests=true
$(_InternalRuntimeDownloadArgs)
beforeBuild:
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1"
displayName: Setup IISExpress test certificates and schema
artifacts:
- name: Windows_Test_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Windows_Test_Results_Attempt_$(System.JobAttempt)
path: artifacts/TestResults/
publishOnError: true
includeForks: true
- name: Minified_JS_Files
path: src/Components/Web.JS/dist/Release/
publishOnError: true
includeForks: true
- template: jobs/default-build.yml
parameters:
jobName: MacOS_Test
jobDisplayName: "Test: macOS"
agentOs: macOS
timeoutInMinutes: 90
isAzDOTestingJob: true
buildArgs: --all --test --binaryLog /p:RunTemplateTests=false /p:SkipHelixReadyTests=true $(_InternalRuntimeDownloadArgs)
beforeBuild:
- bash: "./eng/scripts/install-nginx-mac.sh"
displayName: Installing Nginx
artifacts:
- name: MacOS_Test_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: MacOS_Test_Results_Attempt_$(System.JobAttempt)
path: artifacts/TestResults/
publishOnError: true
includeForks: true
- template: jobs/default-build.yml
parameters:
jobName: Linux_Test
jobDisplayName: "Test: Ubuntu x64"
agentOs: Linux
isAzDOTestingJob: true
useHostedUbuntu: false
buildArgs: --all --test --binaryLog /p:RunTemplateTests=false /p:SkipHelixReadyTests=true $(_InternalRuntimeDownloadArgs)
beforeBuild:
- bash: "./eng/scripts/install-nginx-linux.sh"
displayName: Installing Nginx
- bash: "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
displayName: Increase inotify limit
artifacts:
- name: Linux_Test_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
- name: Linux_Test_Results_Attempt_$(System.JobAttempt)
path: artifacts/TestResults/
publishOnError: true
includeForks: true
# Helix x64
- template: jobs/default-build.yml
parameters:
jobName: Helix_x64
jobDisplayName: 'Tests: Helix x64'
agentOs: Windows
timeoutInMinutes: 240
steps:
# Build the shared framework
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -pack -arch x64
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
displayName: Build shared fx
# -noBuildRepoTasks -noBuildNative -noBuild to avoid repeating work done in the previous step.
- script: ./eng/build.cmd -ci -prepareMachine -nativeToolsOnMachine -nobl -all -noBuildRepoTasks -noBuildNative -noBuild -test
-projects eng\helix\helix.proj /p:IsHelixPRCheck=true /p:IsHelixJob=true
/p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log $(_InternalRuntimeDownloadArgs)
displayName: Run build.cmd helix target
env:
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
artifacts:
- name: Helix_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
# Local development validation
- template: jobs/default-build.yml
parameters:
jobName: Local_Windows
jobDisplayName: 'Test: Windows local development validation'
agentOs: Windows
timeoutInMinutes: 240
steps:
- script: git submodule update --init
displayName: Update submodules
- script: ./restore.cmd
displayName: Run restore.cmd
- script: npm run build
displayName: Build JS
- script: ./eng/build.cmd -all -noBuildJava -pack -c Debug
displayName: Build (Debug)
- script: ./eng/build.cmd -all -noBuildJava -pack -c Release
displayName: Build (Release)
- script: ./src/ProjectTemplates/build.cmd
-test
-NoRestore
-NoBuild
-NoBuildDeps
-configuration Release
displayName: Run project template tests
artifacts:
- name: Local_Windows_x64_Logs_Attempt_$(System.JobAttempt)
path: artifacts/log/
publishOnError: true
includeForks: true
# Source build
- template: /eng/common/templates/job/source-build.yml
parameters:
platform:
name: 'Managed'
container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8'
buildScript: './eng/build.sh --publish --no-build-repo-tasks $(_PublishArgs) $(_InternalRuntimeDownloadArgs)'
skipPublishValidation: true
jobProperties:
timeoutInMinutes: 120
variables:
# Log environment variables in binary logs to ease debugging
MSBUILDLOGALLENVIRONMENTVARIABLES: true