Skip to content

Commit 0b0f6bf

Browse files
authored
Enable public Azure DevOps builds (#366)
- add azure-pipelines.yml - clean workspace when checking out the repo - build about the same matrix as we have on TeamCity in Main.Integration builds - run tests only in Release job by default - do component governance work only in Release job - do not inject CodeQL3000 tasks (when building main) - publish test results - jobs usually take less than 10 minutes - change build.cmd to enable overrides of its command line parameters nits: - touch up .codeql.yml to avoid test code and include portable projects
1 parent 587d433 commit 0b0f6bf

File tree

3 files changed

+94
-3
lines changed

3 files changed

+94
-3
lines changed

.codeql.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ parameters:
66
default: true
77

88
variables:
9-
- template: eng/common/templates/variables/pool-providers.yml
109
# CG is handled in the primary CI pipeline
1110
- name: skipComponentGovernanceDetection
1211
value: true
@@ -59,7 +58,7 @@ jobs:
5958
- script: .\build.cmd EnableSkipStrongNames
6059
displayName: Windows Build - EnableSkipStrongNames
6160

62-
- script: .\build.cmd
61+
- script: .\build.cmd Build /p:BuildPortable=true /p:Desktop=false
6362
displayName: Windows Build
6463

6564
- task: CodeQL3000Finalize@0

azure-pipelines.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
# Run CodeQL3000 tasks in a separate internal pipeline; not needed here.
18+
- name: Codeql.SkipTaskAutoInjection
19+
value: true
20+
21+
trigger: [main]
22+
pr: ['*']
23+
24+
jobs:
25+
- job: build
26+
displayName: Build
27+
pool:
28+
${{ if eq(variables['System.TeamProject'], 'public') }}:
29+
name: NetCore-Public
30+
demands: ImageOverride -equals windows.vs2017.amd64.open
31+
${{ else }}:
32+
name: NetCore1ESPool-Internal
33+
demands: ImageOverride -equals windows.vs2017.amd64
34+
timeoutInMinutes: 30
35+
36+
strategy:
37+
matrix:
38+
Release:
39+
_BuildTarget: ${{ parameters.ReleaseBuildTarget }}
40+
_Configuration: Release
41+
_StyleCopEnabled: true
42+
# Do CG work only in internal pipelines.
43+
skipComponentGovernanceDetection: ${{ eq(variables['System.TeamProject'], 'public') }}
44+
Debug:
45+
_BuildTarget: ${{ parameters.OtherBuildTarget }}
46+
_Configuration: Debug
47+
_StyleCopEnabled: false
48+
# Do not redo CG work. Configuration changes in this part of the matrix are not relevant to CG.
49+
skipComponentGovernanceDetection: true
50+
CodeAnalysis:
51+
_BuildTarget: ${{ parameters.OtherBuildTarget }}
52+
_Configuration: CodeAnalysis
53+
_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+
57+
steps:
58+
- checkout: self
59+
clean: true
60+
displayName: Checkout
61+
- task: UseDotNet@2
62+
displayName: Get .NET SDK
63+
inputs:
64+
useGlobalJson: true
65+
66+
- script: .\build.cmd EnableSkipStrongNames
67+
displayName: Enable SkipStrongNames
68+
- script: .\build.cmd $(_BuildTarget) /p:Desktop=false /p:BuildPortable=true ^
69+
/binaryLogger:artifacts/msbuild.binlog /p:Configuration=$(_Configuration) /p:StyleCopEnabled=$(_StyleCopEnabled) ^
70+
/fileLoggerParameters:LogFile=artifacts/msbuild.log;Summary;Verbosity=minimal
71+
displayName: Build
72+
73+
- publish: ./bin/$(_Configuration)/Test/TestResults/
74+
artifact: $(_Configuration) Test Results
75+
condition: and(always(), ne(variables._BuildTarget, 'Build'))
76+
continueOnError: true
77+
displayName: Upload test results
78+
- task: PublishTestResults@2
79+
condition: and(always(), ne(variables._BuildTarget, 'Build'))
80+
continueOnError: true
81+
displayName: Publish test results
82+
inputs:
83+
mergeTestResults: true
84+
searchFolder: ./bin/$(_Configuration)/Test/TestResults/
85+
testResultsFiles: '*.xml'
86+
testRunner: xUnit
87+
testRunTitle: $(_Configuration)
88+
89+
- publish: ./artifacts/
90+
artifact: $(_Configuration) Logs
91+
condition: always()
92+
displayName: Upload logs

build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
4040

4141
if "%1" == "" goto BuildDefaults
4242

43-
%MSBuild% Runtime.msbuild /m /nr:false /t:%* /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
43+
%MSBuild% Runtime.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal /t:%*
4444
if %ERRORLEVEL% neq 0 goto BuildFail
4545
goto BuildSuccess
4646

0 commit comments

Comments
 (0)