From 0fca56fa3aab5bdca1e8f0d2f6b0d42c9ee699c7 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Wed, 21 Oct 2020 16:30:35 -0700 Subject: [PATCH] Add official build support to standalone templates --- eng/Publishing.props | 5 ++ eng/pipelines/runtimelab.yml | 47 ++++++++---- eng/pipelines/templates/build-job.yml | 102 ++++++++++++++++---------- 3 files changed, 102 insertions(+), 52 deletions(-) create mode 100644 eng/Publishing.props diff --git a/eng/Publishing.props b/eng/Publishing.props new file mode 100644 index 000000000000..18483e92a088 --- /dev/null +++ b/eng/Publishing.props @@ -0,0 +1,5 @@ + + + 3 + + diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml index 1ae15aecdc1c..44dc45e842cd 100644 --- a/eng/pipelines/runtimelab.yml +++ b/eng/pipelines/runtimelab.yml @@ -41,6 +41,10 @@ pr: - SECURITY.md - THIRD-PARTY-NOTICES.TXT +variables: + - name: _TeamName + value: dotnet-core + stages: - stage: build displayName: Build @@ -49,19 +53,36 @@ stages: parameters: osGroup: Windows_NT archType: x64 - pool: - vmImage: 'windows-latest' + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + isOfficialBuild: true + runTests: false + pool: + name: NetCoreInternal-Pool + queue: BuildPool.Windows.10.Amd64.VS2019 + ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + pool: + vmImage: 'windows-latest' - - template: /eng/pipelines/templates/build-job.yml - parameters: - osGroup: OSX - archType: x64 - pool: - vmImage: 'macOS-latest' + - ${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + - template: /eng/pipelines/templates/build-job.yml + parameters: + osGroup: OSX + archType: x64 + pool: + vmImage: 'macOS-latest' - - template: /eng/pipelines/templates/build-job.yml + - template: /eng/pipelines/templates/build-job.yml + parameters: + osGroup: Linux + archType: x64 + pool: + vmImage: 'ubuntu-latest' + +# Publish and validation steps. Only run in official builds +- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: \eng\common\templates\post-build\post-build.yml parameters: - osGroup: Linux - archType: x64 - pool: - vmImage: 'ubuntu-latest' + publishingInfraVersion: 3 + validateDependsOn: + - build + enableSourceLinkValidation: true diff --git a/eng/pipelines/templates/build-job.yml b/eng/pipelines/templates/build-job.yml index 4d067d7d250a..a2c86756f01d 100644 --- a/eng/pipelines/templates/build-job.yml +++ b/eng/pipelines/templates/build-job.yml @@ -4,50 +4,74 @@ parameters: archType: '' container: '' pool: {} - isOfficialBuild: '' + isOfficialBuild: false runTests: true jobs: -- template: /eng/common/templates/job/job.yml +- template: /eng/common/templates/jobs/jobs.yml parameters: - displayName: ${{ format('{0} {1}', parameters.osGroup, parameters.archType) }} - name: ${{ format('{0}_{1}', parameters.osGroup, parameters.archType) }} - enableTelemetry: ${{ parameters.isOfficialBuild }} + enableTelemetry: true helixRepo: dotnet/runtimelab pool: ${{ parameters.pool }} enablePublishBuildArtifacts: true - strategy: - matrix: - Release: - _BuildConfig: Release - Debug: - _BuildConfig: Debug - - ${{ if eq(parameters.runTests, true) }}: - testResultsFormat: vstest - testRunTitle: ${{ parameters.osGroup }}_${{ parameters.archType }}_$(_BuildConfig) - - ${{ if ne(parameters.container, '') }}: - ${{ if eq(parameters.container.registry, 'mcr') }}: - container: ${{ format('{0}:{1}', 'mcr.microsoft.com/dotnet-buildtools/prereqs', parameters.container.image) }} - ${{ if ne(parameters.container.registry, 'mcr') }}: - container: ${{ format('{0}:{1}', parameters.container.registry, parameters.container.image) }} - - variables: - - _buildScript: build.cmd - - - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - - _buildScript: ./build.sh - - - _testBuildArg: '' - - ${{ if eq(parameters.runTests, true) }}: - - _testBuildArg: -test - - steps: - - script: $(_buildScript) - -ci - $(_testBuildArg) - -c $(_BuildConfig) - /p:TargetPlatform=${{ parameters.archType }} - displayName: Build and Test + enablePublishBuildAssets: true + enablePublishUsingPipelines: true + enableMicrobuild: true + graphFileGeneration: + enabled: false + includeToolset: false + + jobs: + - job: ${{ format('{0}_{1}', parameters.osGroup, parameters.archType) }} + displayName: ${{ format('{0} {1}', parameters.osGroup, parameters.archType) }} + strategy: + matrix: + Release: + _BuildConfig: Release + ${{ if eq(parameters.isOfficialBuild, false) }}: + Debug: + _BuildConfig: Debug + + ${{ if eq(parameters.runTests, true) }}: + testResultsFormat: vstest + testRunTitle: ${{ parameters.osGroup }}_${{ parameters.archType }}_$(_BuildConfig) + + ${{ if ne(parameters.container, '') }}: + ${{ if eq(parameters.container.registry, 'mcr') }}: + container: ${{ format('{0}:{1}', 'mcr.microsoft.com/dotnet-buildtools/prereqs', parameters.container.image) }} + ${{ if ne(parameters.container.registry, 'mcr') }}: + container: ${{ format('{0}:{1}', parameters.container.registry, parameters.container.image) }} + + variables: + - _buildScript: build.cmd + + - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: + - _buildScript: ./build.sh + + - _testBuildArg: '' + - ${{ if eq(parameters.runTests, true) }}: + - _testBuildArg: -test + + - _officialBuildArgs: '' + - ${{ if eq(parameters.isOfficialBuild, true) }}: + - group: DotNet-Symbol-Server-Pats + - _SignType: real + - _officialBuildArgs: -sign + -publish + /p:DotNetSignType=$(_SignType) + /p:TeamName=$(_TeamName) + /p:OfficialBuildId=$(Build.BuildNumber) + /p:DotNetPublishUsingPipelines=true + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + + steps: + - script: $(_buildScript) + -ci + -pack + -c $(_BuildConfig) + $(_testBuildArg) + $(_officialBuildArgs) + /p:TargetPlatform=${{ parameters.archType }} + displayName: Build and Test