Skip to content

Commit 6b34233

Browse files
committed
!fixup! Update pipeline configuration
- run tests only in Release job by default - do component governance work only in Release job - do not inject CodeQL3000 tasks (when building main) - shorten artifact names (remove 'Build ') - publish test results - clean workspace when checking out the repo
1 parent 59baf24 commit 6b34233

File tree

1 file changed

+41
-11
lines changed

1 file changed

+41
-11
lines changed

azure-pipelines.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
parameters:
2-
- name: BuildTarget
3-
displayName: Build which target?
2+
# Test only the Release build by default.
3+
- name: ReleaseBuildTarget
4+
displayName: 'Build which target for Release?'
45
type: string
56
values: [ Build, Integration, UnitTest ]
67
default: UnitTest
8+
- name: OtherBuildTarget
9+
displayName: 'Build which target for Debug/CodeAnalysis?'
10+
type: string
11+
values: [ Build, Integration, UnitTest ]
12+
default: Build
713

814
variables:
9-
# Build variables
10-
- name: _BuildConfig
11-
value: Release
1215
- name: DOTNET_CLI_TELEMETRY_OPTOUT
1316
value: 1
17+
# Run CodeQL3000 tasks in a separate internal pipeline; not needed here.
18+
- name: Codeql.SkipTaskAutoInjection
19+
value: true
1420

1521
trigger: [main]
1622
pr: ['*']
@@ -20,7 +26,7 @@ jobs:
2026
displayName: Build
2127
pool:
2228
${{ if eq(variables['System.TeamProject'], 'public') }}:
23-
name: NetCore-Svc-Public
29+
name: NetCore-Public
2430
demands: ImageOverride -equals windows.vs2017.amd64.open
2531
${{ else }}:
2632
name: NetCore1ESPool-Internal
@@ -30,34 +36,58 @@ jobs:
3036
strategy:
3137
matrix:
3238
Release:
39+
_BuildTarget: ${{ parameters.ReleaseBuildTarget }}
3340
_Configuration: Release
3441
_StyleCopEnabled: true
42+
# Do CG work only in internal pipelines.
43+
skipComponentGovernanceDetection: ${{ eq(variables['System.TeamProject'], 'public') }}
3544
Debug:
45+
_BuildTarget: ${{ parameters.OtherBuildTarget }}
3646
_Configuration: Debug
3747
_StyleCopEnabled: false
48+
# Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG.
49+
skipComponentGovernanceDetection: true
3850
CodeAnalysis:
51+
_BuildTarget: ${{ parameters.OtherBuildTarget }}
3952
_Configuration: CodeAnalysis
4053
_StyleCopEnabled: false
54+
# Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG.
55+
skipComponentGovernanceDetection: true
56+
4157
steps:
58+
- checkout: self
59+
clean: true
60+
displayName: Checkout
4261
- task: UseDotNet@2
62+
displayName: Get .NET SDK
4363
inputs:
4464
useGlobalJson: true
4565

4666
- script: .\build.cmd EnableSkipStrongNames
4767
displayName: Windows Build - EnableSkipStrongNames
48-
49-
- script: .\build.cmd ${{ parameters.BuildTarget }} /p:Desktop=false /p:BuildPortable=true ^
68+
- script: .\build.cmd $(_BuildTarget) /p:Desktop=false /p:BuildPortable=true ^
5069
/binaryLogger:artifacts/msbuild.binlog /p:Configuration=$(_Configuration) /p:StyleCopEnabled=$(_StyleCopEnabled) ^
5170
/flp:LogFile=artifacts/msbuild.log
5271
displayName: Windows Build
5372

54-
- ${{ if ne(parameters.BuildTarget, 'Build') }}:
73+
- ${{ if ne('$(_BuildTarget)', 'Build') }}:
5574
- publish: ./bin/$(_Configuration)/Test/TestResults/
56-
artifact: $(Agent.JobName) Test Results
75+
artifact: $(_Configuration) Test Results
5776
condition: always()
5877
continueOnError: true
5978
displayName: Upload test results
79+
- task: PublishTestResults@2
80+
condition: always()
81+
continueOnError: true
82+
displayName: Publish test results
83+
inputs:
84+
configuration: $(_Configuration)
85+
mergeTestResults: true
86+
searchFolder: ./bin/$(_Configuration)/Test/TestResults/
87+
testResultsFiles: '*.xml'
88+
testRunner: xUnit
89+
6090
- publish: ./artifacts/
61-
artifact: $(Agent.JobName) Logs
91+
artifact: $(_Configuration) Logs
6292
condition: always()
6393
displayName: Upload logs

0 commit comments

Comments
 (0)