|
| 1 | +resources: |
| 2 | +- repo: self |
| 3 | + clean: true |
| 4 | + |
| 5 | +# Variables defined in yml cannot be overridden at queue time instead overrideable variables must be defined in the web gui. |
| 6 | +# Commenting out until AzDO supports something like the runtime parameters outlined here: https://github.com/Microsoft/azure-pipelines-yaml/pull/129 |
| 7 | +#variables: |
| 8 | +# SignType: test |
| 9 | +# SkipTests: true |
| 10 | +# SkipApplyOptimizationData: false |
| 11 | +# IbcDrop: 'default' |
| 12 | +# PRNumber: 'REQUIRED' |
| 13 | +# CommitSHA: 'REQUIRED' |
| 14 | + |
| 15 | +# The variables `_DotNetArtifactsCategory` and `_DotNetValidationArtifactsCategory` are required for proper publishing of build artifacts. See https://github.com/dotnet/roslyn/pull/38259 |
| 16 | +variables: |
| 17 | + - name: _DotNetArtifactsCategory |
| 18 | + value: .NETCore |
| 19 | + - name: _DotNetValidationArtifactsCategory |
| 20 | + value: .NETCoreValidation |
| 21 | + - group: DotNet-Roslyn-SDLValidation-Params |
| 22 | + |
| 23 | + # To retrieve OptProf data we need to authenticate to the VS drop storage. |
| 24 | + # If the pipeline is running in DevDiv, the account has access to the VS drop storage. |
| 25 | + # Get $AccessToken-dotnet-build-bot-public-repo from DotNet-GitHub-Versions-Repo-Write |
| 26 | + - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: |
| 27 | + - group: DotNet-GitHub-Versions-Repo-Write |
| 28 | + - name: _DevDivDropAccessToken |
| 29 | + value: $(System.AccessToken) |
| 30 | + |
| 31 | +stages: |
| 32 | +- stage: build |
| 33 | + displayName: Build and Test |
| 34 | + |
| 35 | + jobs: |
| 36 | + |
| 37 | + - job: OfficialTestBuild |
| 38 | + displayName: Official Test Build |
| 39 | + timeoutInMinutes: 360 |
| 40 | + # Conditionally set build pool so we can share this YAML when building with different pipeline |
| 41 | + pool: |
| 42 | + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: |
| 43 | + name: VSEngSS-MicroBuild2017 |
| 44 | + demands: |
| 45 | + - msbuild |
| 46 | + - visualstudio |
| 47 | + - DotNetFramework |
| 48 | + |
| 49 | + steps: |
| 50 | + - powershell: Write-Host "##vso[task.setvariable variable=SourceBranchName]$('$(Build.SourceBranch)'.Substring('refs/heads/'.Length))" |
| 51 | + displayName: Setting SourceBranchName variable |
| 52 | + condition: succeeded() |
| 53 | + |
| 54 | + - task: tagBuildOrRelease@0 |
| 55 | + displayName: Tag PR validation build |
| 56 | + inputs: |
| 57 | + type: 'Build' |
| 58 | + tags: | |
| 59 | + PRValidationBuild |
| 60 | + PRNumber:$(PRNumber) |
| 61 | + condition: succeeded() |
| 62 | + |
| 63 | + - task: PowerShell@2 |
| 64 | + displayName: Setup branch for insertion validation |
| 65 | + inputs: |
| 66 | + filePath: 'eng\setup-pr-validation.ps1' |
| 67 | + arguments: '-sourceBranchName $(SourceBranchName) -prNumber $(PRNumber) -commitSHA $(CommitSHA)' |
| 68 | + condition: succeeded() |
| 69 | + |
| 70 | + - powershell: Write-Host "##vso[task.setvariable variable=VisualStudio.DropName]Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranchName)/$(Build.BuildNumber)" |
| 71 | + displayName: Setting VisualStudio.DropName variable |
| 72 | + |
| 73 | + - task: NuGetToolInstaller@0 |
| 74 | + inputs: |
| 75 | + versionSpec: '4.9.2' |
| 76 | + |
| 77 | + # Authenticate with service connections to be able to publish packages to external nuget feeds. |
| 78 | + - task: NuGetAuthenticate@0 |
| 79 | + inputs: |
| 80 | + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: |
| 81 | + nuGetServiceConnections: azure-public/vs-impl, azure-public/vssdk |
| 82 | + |
| 83 | + # Needed to restore the Microsoft.DevDiv.Optimization.Data.PowerShell package |
| 84 | + - task: NuGetCommand@2 |
| 85 | + displayName: Restore internal tools |
| 86 | + inputs: |
| 87 | + command: restore |
| 88 | + feedsToUse: config |
| 89 | + restoreSolution: 'eng\common\internal\Tools.csproj' |
| 90 | + nugetConfigPath: 'NuGet.config' |
| 91 | + restoreDirectory: '$(Build.SourcesDirectory)\.packages' |
| 92 | + |
| 93 | + - task: MicroBuildSigningPlugin@2 |
| 94 | + inputs: |
| 95 | + signType: $(SignType) |
| 96 | + zipSources: false |
| 97 | + # If running in dnceng, we need to use a feed different from default |
| 98 | + ${{ if eq(variables['System.TeamProject'], 'internal') }}: |
| 99 | + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json |
| 100 | + condition: and(succeeded(), in(variables['SignType'], 'test', 'real')) |
| 101 | + |
| 102 | + - task: PowerShell@2 |
| 103 | + displayName: Build |
| 104 | + inputs: |
| 105 | + filePath: eng/build.ps1 |
| 106 | + arguments: -ci |
| 107 | + -restore |
| 108 | + -build |
| 109 | + -pack |
| 110 | + -sign |
| 111 | + -publish |
| 112 | + -binaryLog |
| 113 | + -configuration $(BuildConfiguration) |
| 114 | + -officialBuildId $(Build.BuildNumber) |
| 115 | + -officialSkipTests $(SkipTests) |
| 116 | + -officialSkipApplyOptimizationData $(SkipApplyOptimizationData) |
| 117 | + -officialSourceBranchName $(SourceBranchName) |
| 118 | + -officialIbcDrop $(IbcDrop) |
| 119 | + -officialVisualStudioDropAccessToken $(_DevDivDropAccessToken) |
| 120 | + /p:RepositoryName=$(Build.Repository.Name) |
| 121 | + /p:VisualStudioDropName=$(VisualStudio.DropName) |
| 122 | + /p:DotNetSignType=$(SignType) |
| 123 | + /p:DotNetPublishToBlobFeed=false |
| 124 | + /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) |
| 125 | + /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json |
| 126 | + /p:PublishToSymbolServer=false |
| 127 | + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) |
| 128 | + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) |
| 129 | + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) |
| 130 | + /p:DotnetPublishUsingPipelines=false |
| 131 | + condition: succeeded() |
| 132 | + |
| 133 | + # Publish OptProf generated JSON files as a build artifact. This allows for easy inspection from |
| 134 | + # a build execution. |
| 135 | + - task: PublishBuildArtifacts@1 |
| 136 | + displayName: Publish OptProf Data Files |
| 137 | + inputs: |
| 138 | + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\OptProf\$(BuildConfiguration)\Data' |
| 139 | + ArtifactName: 'OptProf Data Files' |
| 140 | + condition: succeeded() |
| 141 | + |
| 142 | + - task: PublishBuildArtifacts@1 |
| 143 | + displayName: Publish Logs |
| 144 | + inputs: |
| 145 | + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)' |
| 146 | + ArtifactName: 'Build Diagnostic Files' |
| 147 | + publishLocation: Container |
| 148 | + continueOnError: true |
| 149 | + condition: succeededOrFailed() |
| 150 | + |
| 151 | + - task: PublishBuildArtifacts@1 |
| 152 | + displayName: Publish Ngen Logs |
| 153 | + inputs: |
| 154 | + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(BuildConfiguration)\ngen' |
| 155 | + ArtifactName: 'NGen Logs' |
| 156 | + publishLocation: Container |
| 157 | + continueOnError: true |
| 158 | + condition: succeeded() |
| 159 | + |
| 160 | + - task: PublishTestResults@2 |
| 161 | + displayName: Publish xUnit Test Results |
| 162 | + inputs: |
| 163 | + testRunner: XUnit |
| 164 | + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(BuildConfiguration)\*.xml' |
| 165 | + mergeTestResults: true |
| 166 | + testRunTitle: 'Unit Tests' |
| 167 | + condition: and(succeededOrFailed(), ne(variables['SkipTests'], 'true')) |
| 168 | + |
| 169 | + # Publishes setup VSIXes to a drop. |
| 170 | + # Note: The insertion tool looks for the display name of this task in the logs. |
| 171 | + - task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1 |
| 172 | + displayName: Upload VSTS Drop |
| 173 | + inputs: |
| 174 | + DropName: $(VisualStudio.DropName) |
| 175 | + DropFolder: 'artifacts\VSSetup\$(BuildConfiguration)\Insertion' |
| 176 | + AccessToken: $(_DevDivDropAccessToken) |
| 177 | + condition: succeeded() |
| 178 | + |
| 179 | + # Publish insertion packages to CoreXT store. |
| 180 | + - task: NuGetCommand@2 |
| 181 | + displayName: Publish CoreXT Packages |
| 182 | + inputs: |
| 183 | + command: push |
| 184 | + packagesToPush: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\DevDivPackages\**\*.nupkg' |
| 185 | + allowPackageConflicts: true |
| 186 | + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: |
| 187 | + feedsToUse: config |
| 188 | + publishVstsFeed: '97a41293-2972-4f48-8c0e-05493ae82010' |
| 189 | + condition: succeeded() |
| 190 | + |
| 191 | + # Publish an artifact that the RoslynInsertionTool is able to find by its name. |
| 192 | + - task: PublishBuildArtifacts@1 |
| 193 | + displayName: Publish Artifact VSSetup |
| 194 | + inputs: |
| 195 | + PathtoPublish: 'artifacts\VSSetup\$(BuildConfiguration)' |
| 196 | + ArtifactName: 'VSSetup' |
| 197 | + condition: succeeded() |
| 198 | + |
| 199 | + # Publish Asset Manifests for Build Asset Registry job |
| 200 | + - task: PublishBuildArtifacts@1 |
| 201 | + displayName: Publish Asset Manifests |
| 202 | + inputs: |
| 203 | + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BuildConfiguration)/AssetManifest' |
| 204 | + ArtifactName: AssetManifests |
| 205 | + condition: succeeded() |
| 206 | + |
| 207 | + - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 |
| 208 | + displayName: Perform Cleanup Tasks |
| 209 | + condition: succeededOrFailed() |
0 commit comments