Skip to content

Commit

Permalink
!fixup! Update pipeline configuration
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
dougbu committed Nov 22, 2022
1 parent 59baf24 commit 6b34233
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
parameters:
- name: BuildTarget
displayName: Build which target?
# Test only the Release build by default.
- name: ReleaseBuildTarget
displayName: 'Build which target for Release?'
type: string
values: [ Build, Integration, UnitTest ]
default: UnitTest
- name: OtherBuildTarget
displayName: 'Build which target for Debug/CodeAnalysis?'
type: string
values: [ Build, Integration, UnitTest ]
default: Build

variables:
# Build variables
- name: _BuildConfig
value: Release
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
# Run CodeQL3000 tasks in a separate internal pipeline; not needed here.
- name: Codeql.SkipTaskAutoInjection
value: true

trigger: [main]
pr: ['*']
Expand All @@ -20,7 +26,7 @@ jobs:
displayName: Build
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCore-Svc-Public
name: NetCore-Public
demands: ImageOverride -equals windows.vs2017.amd64.open
${{ else }}:
name: NetCore1ESPool-Internal
Expand All @@ -30,34 +36,58 @@ jobs:
strategy:
matrix:
Release:
_BuildTarget: ${{ parameters.ReleaseBuildTarget }}
_Configuration: Release
_StyleCopEnabled: true
# Do CG work only in internal pipelines.
skipComponentGovernanceDetection: ${{ eq(variables['System.TeamProject'], 'public') }}
Debug:
_BuildTarget: ${{ parameters.OtherBuildTarget }}
_Configuration: Debug
_StyleCopEnabled: false
# Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG.
skipComponentGovernanceDetection: true
CodeAnalysis:
_BuildTarget: ${{ parameters.OtherBuildTarget }}
_Configuration: CodeAnalysis
_StyleCopEnabled: false
# Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG.
skipComponentGovernanceDetection: true

steps:
- checkout: self
clean: true
displayName: Checkout
- task: UseDotNet@2
displayName: Get .NET SDK
inputs:
useGlobalJson: true

- script: .\build.cmd EnableSkipStrongNames
displayName: Windows Build - EnableSkipStrongNames

- script: .\build.cmd ${{ parameters.BuildTarget }} /p:Desktop=false /p:BuildPortable=true ^
- script: .\build.cmd $(_BuildTarget) /p:Desktop=false /p:BuildPortable=true ^
/binaryLogger:artifacts/msbuild.binlog /p:Configuration=$(_Configuration) /p:StyleCopEnabled=$(_StyleCopEnabled) ^
/flp:LogFile=artifacts/msbuild.log
displayName: Windows Build

- ${{ if ne(parameters.BuildTarget, 'Build') }}:
- ${{ if ne('$(_BuildTarget)', 'Build') }}:
- publish: ./bin/$(_Configuration)/Test/TestResults/
artifact: $(Agent.JobName) Test Results
artifact: $(_Configuration) Test Results
condition: always()
continueOnError: true
displayName: Upload test results
- task: PublishTestResults@2
condition: always()
continueOnError: true
displayName: Publish test results
inputs:
configuration: $(_Configuration)
mergeTestResults: true
searchFolder: ./bin/$(_Configuration)/Test/TestResults/
testResultsFiles: '*.xml'
testRunner: xUnit

- publish: ./artifacts/
artifact: $(Agent.JobName) Logs
artifact: $(_Configuration) Logs
condition: always()
displayName: Upload logs

0 comments on commit 6b34233

Please sign in to comment.