# # See https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema for details on this file. # # Configure which branches trigger builds trigger: batch: true branches: include: - blazor-wasm - master - release/* # Run PR validation on all branches pr: autoCancel: true branches: include: - '*' variables: - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE value: true - name: _TeamName value: AspNetCore - name: _DotNetPublishToBlobFeed value: true - name: _PublishUsingPipelines value: true - name: _DotNetArtifactsCategory value: .NETCORE - name: _DotNetValidationArtifactsCategory value: .NETCORE - ${{ if ne(variables['System.TeamProject'], 'internal') }}: - name: _BuildArgs value: '' - name: _PublishArgs value: '' - name: _SignType value: '' - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - ${{ if notin(variables['Build.Reason'], 'PullRequest') }}: # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1 # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT - group: DotNet-Blob-Feed - group: Publish-Build-Assets - name: _BuildArgs value: /p:TeamName=$(_TeamName) /p:OfficialBuildId=$(Build.BuildNumber) - name: _SignType value: real # The following extra properties are not set when testing. Use with final build.[cmd,sh] of asset-producing jobs. - name: _PublishArgs value: /p:Publish=true /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed) /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines) /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) - ${{ if in(variables['Build.Reason'], 'PullRequest') }}: - name: _BuildArgs value: '' - name: _SignType valule: test - name: _PublishArgs value: '' # used for post-build phases, internal builds only - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - group: DotNet-AspNet-SDLValidation-Params stages: - stage: build displayName: Build jobs: # Build Windows (x64/x86) - template: jobs/default-build.yml parameters: codeSign: true jobName: Windows_build jobDisplayName: "Build: Windows x64/x86" agentOs: Windows steps: - script: "echo ##vso[build.addbuildtag]daily-build" condition: and(notin(variables['Build.Reason'], 'PullRequest'), notin(variables['DotNetFinalVersionKind'], 'release', 'prerelease')) displayName: 'Set CI tags' - script: "echo ##vso[build.addbuildtag]release-candidate" condition: and(notin(variables['Build.Reason'], 'PullRequest'), in(variables['DotNetFinalVersionKind'], 'release', 'prerelease')) displayName: 'Set CI tags' # !!! 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: ./build.cmd -ci -arch x64 -pack -all -NoBuildNative /bl:artifacts/log/build.x64.binlog $(_BuildArgs) displayName: Build x64 # 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: ./build.cmd -ci -noBuild -noRestore -sign /bl:artifacts/log/build.codesign.binlog /p:DotNetSignType=$(_SignType) $(_BuildArgs) displayName: Code sign packages # Windows installers bundle both x86 and x64 assets - script: ./build.cmd -ci -sign -buildInstallers /bl:artifacts/log/installers.msbuild.binlog /p:DotNetSignType=$(_SignType) /p:AssetManifestFileName=aspnetcore-win-x64-x86.xml $(_BuildArgs) $(_PublishArgs) /p:PublishInstallerBaseVersion=true displayName: Build Installers artifacts: - name: Windows_Logs path: artifacts/log/ publishOnError: true includeForks: true - name: Windows_Packages path: artifacts/packages/ # Test jobs - template: jobs/default-build.yml parameters: condition: ne(variables['SkipTests'], 'true') jobName: Windows_Test jobDisplayName: "Test: Windows Server 2016 x64" agentOs: Windows isTestingJob: true buildArgs: -all -pack -test -BuildNative "/p:SkipIISNewHandlerTests=true /p:SkipIISTests=true /p:SkipIISExpressTests=true /p:SkipIISNewShimTests=true /p:RunTemplateTests=false" beforeBuild: - powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1; & ./src/Servers/IIS/tools/update_schema.ps1" displayName: Setup IISExpress test certificates and schema afterBuild: - powershell: "& ./build.ps1 -CI -NoBuild -Test /p:RunFlakyTests=true" displayName: Run Flaky Tests continueOnError: true - task: PublishTestResults@2 displayName: Publish Flaky Test Results inputs: testResultsFormat: 'xUnit' testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/Flaky' artifacts: - name: Windows_Test_Dumps path: artifacts/dumps/ publishOnError: true includeForks: false - name: Windows_Test_Logs path: artifacts/log/ publishOnError: true includeForks: true - name: Windows_Test_Results path: artifacts/TestResults/ publishOnError: true includeForks: true - template: jobs/default-build.yml parameters: condition: ne(variables['SkipTests'], 'true') jobName: Windows_Templates_Test jobDisplayName: "Test: Templates - Windows Server 2016 x64" agentOs: Windows isTestingJob: true steps: - script: ./build.cmd -ci -all -pack displayName: Build Repo - script: ./src/ProjectTemplates/build.cmd -ci -pack -NoRestore -NoBuilddeps "/p:RunTemplateTests=true /bl:artifacts/log/template.pack.binlog" displayName: Pack Templates - script: ./src/ProjectTemplates/build.cmd -ci -test -NoRestore -NoBuild -NoBuilddeps "/p:RunTemplateTests=true /bl:artifacts/log/template.test.binlog" displayName: Test Templates artifacts: - name: Windows_Test_Templates_Dumps path: artifacts/dumps/ publishOnError: true includeForks: false - name: Windows_Test_Templates_Logs path: artifacts/log/ publishOnError: true includeForks: true - name: Windows_Test_Templates_Results path: artifacts/TestResults/ publishOnError: true includeForks: true - template: jobs/default-build.yml parameters: condition: ne(variables['SkipTests'], 'true') jobName: MacOS_Test jobDisplayName: "Test: macOS 10.13" agentOs: macOS isTestingJob: true buildArgs: --all --test "/p:RunTemplateTests=false" beforeBuild: - bash: "./eng/scripts/install-nginx-mac.sh" displayName: Installing Nginx afterBuild: - bash: ./build.sh --ci --pack --no-restore "/bl:artifacts/log/packages.pack.binlog" displayName: Pack Packages (for Template tests) - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore "/bl:artifacts/log/template.pack.binlog" displayName: Pack Templates (for Template tests) - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true displayName: Run Flaky Tests continueOnError: true - task: PublishTestResults@2 displayName: Publish Flaky Test Results inputs: testResultsFormat: 'xUnit' testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/Flaky' artifacts: - name: MacOS_Test_Logs path: artifacts/log/ publishOnError: true includeForks: true - name: MacOS_Test_Results path: artifacts/TestResults/ publishOnError: true includeForks: true - template: jobs/default-build.yml parameters: condition: ne(variables['SkipTests'], 'true') jobName: Linux_Test jobDisplayName: "Test: Ubuntu 16.04 x64" agentOs: Linux isTestingJob: true buildArgs: --all --test "/p:RunTemplateTests=false" 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 afterBuild: - bash: ./build.sh --ci --pack --no-restore "/bl:artifacts/log/packages.pack.binlog" displayName: Pack Packages (for Template tests) - bash: ./src/ProjectTemplates/build.sh --ci --pack --no-restore "/bl:artifacts/log/template.pack.binlog" displayName: Pack Templates (for Template tests) - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true displayName: Run Flaky Tests continueOnError: true - task: PublishTestResults@2 displayName: Publish Flaky Test Results inputs: testResultsFormat: 'xUnit' testResultsFiles: '*.xml' searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/Flaky' artifacts: - name: Linux_Test_Logs path: artifacts/log/ publishOnError: true includeForks: true - name: Linux_Test_Results path: artifacts/TestResults/ publishOnError: true includeForks: true # Publish to the BAR - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: /eng/common/templates/job/publish-build-assets.yml parameters: dependsOn: - Windows_build # In addition to the dependencies above, ensure the build was successful overall. - Linux_Test - MacOS_Test - Windows_Templates_Test - Windows_Test pool: vmImage: vs2017-win2016 publishUsingPipelines: ${{ variables._PublishUsingPipelines }} enablePublishBuildArtifacts: true # publish artifacts/log files - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - template: /eng/common/templates/post-build/post-build.yml parameters: # See https://github.com/dotnet/arcade/issues/2871 enableSymbolValidation: false enableSigningValidation: false publishInstallersAndChecksums: true # This is to enable SDL runs part of Post-Build Validation Stage SDLValidationParameters: enable: true continueOnError: false params: ' -SourceToolsList @("policheck","credscan") -TsaInstanceURL $(_TsaInstanceURL) -TsaProjectName $(_TsaProjectName) -TsaNotificationEmail $(_TsaNotificationEmail) -TsaCodebaseAdmin $(_TsaCodebaseAdmin) -TsaBugAreaPath $(_TsaBugAreaPath) -TsaIterationPath $(_TsaIterationPath) -TsaRepositoryName "AspNetCore" -TsaCodebaseName "AspNetCore" -TsaPublish $True -PoliCheckAdditionalRunConfigParams @("UserExclusionPath < $(Build.SourcesDirectory)/eng/PoliCheckExclusions.xml")'