|
| 1 | +parameters: |
| 2 | + # Test only the Release build by default. |
| 3 | +- name: ReleaseBuildTarget |
| 4 | + displayName: 'Build which target for Release?' |
| 5 | + type: string |
| 6 | + values: [ Build, Integration, UnitTest ] |
| 7 | + default: UnitTest |
| 8 | +- name: OtherBuildTarget |
| 9 | + displayName: 'Build which target for Debug/CodeAnalysis?' |
| 10 | + type: string |
| 11 | + values: [ Build, Integration, UnitTest ] |
| 12 | + default: Build |
| 13 | + |
| 14 | +variables: |
| 15 | +- name: DOTNET_CLI_TELEMETRY_OPTOUT |
| 16 | + value: 1 |
| 17 | +- name: DOTNET_NOLOGO |
| 18 | + value: 1 |
| 19 | + # Run CodeQL3000 tasks in a separate internal pipeline; not needed here. |
| 20 | +- name: Codeql.SkipTaskAutoInjection |
| 21 | + value: true |
| 22 | + |
| 23 | +trigger: [main] |
| 24 | +pr: ['*'] |
| 25 | + |
| 26 | +jobs: |
| 27 | +- job: build |
| 28 | + displayName: Build |
| 29 | + pool: |
| 30 | + ${{ if eq(variables['System.TeamProject'], 'public') }}: |
| 31 | + name: NetCore-Svc-Public |
| 32 | + demands: ImageOverride -equals windows.vs2019.amd64.open |
| 33 | + ${{ else }}: |
| 34 | + name: NetCore1ESPool-Svc-Internal |
| 35 | + demands: ImageOverride -equals windows.vs2019.amd64 |
| 36 | + timeoutInMinutes: 30 |
| 37 | + |
| 38 | + strategy: |
| 39 | + matrix: |
| 40 | + Release: |
| 41 | + _BuildTarget: ${{ parameters.ReleaseBuildTarget }} |
| 42 | + _Configuration: Release |
| 43 | + _StyleCopEnabled: true |
| 44 | + # Do CG work only in internal pipelines. |
| 45 | + skipComponentGovernanceDetection: ${{ eq(variables['System.TeamProject'], 'public') }} |
| 46 | + Debug: |
| 47 | + _BuildTarget: ${{ parameters.OtherBuildTarget }} |
| 48 | + _Configuration: Debug |
| 49 | + _StyleCopEnabled: false |
| 50 | + # Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG. |
| 51 | + skipComponentGovernanceDetection: true |
| 52 | + CodeAnalysis: |
| 53 | + _BuildTarget: ${{ parameters.OtherBuildTarget }} |
| 54 | + _Configuration: CodeAnalysis |
| 55 | + _StyleCopEnabled: false |
| 56 | + # Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG. |
| 57 | + skipComponentGovernanceDetection: true |
| 58 | + |
| 59 | + steps: |
| 60 | + - checkout: self |
| 61 | + clean: true |
| 62 | + displayName: Checkout |
| 63 | + |
| 64 | + - task: UseDotNet@2 |
| 65 | + displayName: Get .NET SDK |
| 66 | + inputs: |
| 67 | + useGlobalJson: true |
| 68 | + - task: UseDotNet@2 |
| 69 | + displayName: Get .NET 2.1 runtime |
| 70 | + inputs: |
| 71 | + packageType: runtime |
| 72 | + version: '2.1.x' |
| 73 | + |
| 74 | + - script: .\build.cmd EnableSkipStrongNames |
| 75 | + displayName: Enable SkipStrongNames |
| 76 | + - script: .\build.cmd $(_BuildTarget) ^ |
| 77 | + /binaryLogger:artifacts/msbuild.binlog /p:Configuration=$(_Configuration) /p:StyleCopEnabled=$(_StyleCopEnabled) ^ |
| 78 | + /fileLoggerParameters:LogFile=artifacts/msbuild.log;Summary;Verbosity=minimal |
| 79 | + displayName: Build |
| 80 | + |
| 81 | + - publish: ./bin/$(_Configuration)/Test/TestResults/ |
| 82 | + artifact: $(_Configuration) Test Results $(System.JobId) |
| 83 | + condition: and(always(), ne(variables._BuildTarget, 'Build')) |
| 84 | + continueOnError: true |
| 85 | + displayName: Upload test results |
| 86 | + - task: PublishTestResults@2 |
| 87 | + condition: and(always(), ne(variables._BuildTarget, 'Build')) |
| 88 | + continueOnError: true |
| 89 | + displayName: Publish test results |
| 90 | + inputs: |
| 91 | + mergeTestResults: true |
| 92 | + searchFolder: ./bin/$(_Configuration)/Test/TestResults/ |
| 93 | + testResultsFiles: '*.xml' |
| 94 | + testRunner: xUnit |
| 95 | + testRunTitle: $(_Configuration) |
| 96 | + |
| 97 | + - publish: ./artifacts/ |
| 98 | + artifact: $(_Configuration) Logs $(System.JobId) |
| 99 | + condition: always() |
| 100 | + displayName: Upload logs |
0 commit comments