Skip to content

Commit

Permalink
build and test infra cleanup (#4069)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
CaseyCarter and StephanTLavavej authored Oct 6, 2023
1 parent d61f7e0 commit b448869
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 76 deletions.
34 changes: 22 additions & 12 deletions azure-devops/asan-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,46 @@
# Build STL targeting x86 and x64, and run extra ASan testing

variables:
tmpDir: 'D:\Temp'
buildOutputLocation: 'D:\build'
# Restrict to "stlasan" test
testSelection: '-R stlasan'

pool:
name: 'StlBuild-2023-09-14T1251-Pool'
demands: EnableSpotVM -equals true
- template: config.yml
- name: testSelection
value: '-R stlasan' # Restrict to "stlasan" test

pr: none
trigger: none

schedules:
- cron: '0 2 * * *'
displayName: ASan-Daily-CI
branches:
include:
- main

stages:
- stage: Build_And_Test_x64
displayName: 'Build and Test'
displayName: 'Build and Test x64'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: native-build-test.yml
parameters:
targetPlatform: x64
vsDevCmdArch: amd64
benchmarkBuildOutputLocationVar: ''
buildBenchmarks: false
testSelection: ${{ variables.testSelection }}

- stage: Build_And_Test_x86
displayName: 'Build and Test'
displayName: 'Build and Test x86'
dependsOn: []
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: native-build-test.yml
parameters:
targetPlatform: x86
vsDevCmdArch: x86
benchmarkBuildOutputLocationVar: ''
buildBenchmarks: false
testSelection: ${{ variables.testSelection }}

# no coverage for ARM and ARM64
46 changes: 26 additions & 20 deletions azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@ parameters:
type: string
- name: targetPlatform
type: string
- name: buildOutputLocationVar
type: string
default: buildOutputLocation
- name: benchmarkBuildOutputLocationVar
type: string
default: benchmarkBuildOutputLocation
- name: buildBenchmarks
type: boolean
- name: cmakeAdditionalFlags
type: string
default: ''
- name: litFlags
type: object
default:
- '--timeout=240'
- '-j$(testParallelism)'
- '--xunit-xml-output=$(buildOutputLocation)/test-results.xml'
- '--order=lexical'
- '--num-shards=$(System.TotalJobsInPhase)'
- '--run-shard=$(System.JobPositionInPhase)'

steps:
- task: PowerShell@2
displayName: 'Get Test Parallelism'
Expand All @@ -27,47 +33,47 @@ steps:
$testParallelism = $env:NUMBER_OF_PROCESSORS
Write-Host "##vso[task.setvariable variable=testParallelism;]$testParallelism"
- script: |
if exist "$(${{ parameters.buildOutputLocationVar }})" (
rmdir /S /Q "$(${{ parameters.buildOutputLocationVar }})"
if exist "$(buildOutputLocation)" (
rmdir /S /Q "$(buildOutputLocation)"
)
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake ${{ parameters.cmakeAdditionalFlags}} -G Ninja ^
cmake ${{ parameters.cmakeAdditionalFlags }} -G Ninja ^
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DLIT_FLAGS=$(litFlags) ^
-DLIT_FLAGS=${{ join(';', parameters.litFlags) }} ^
-DSTL_USE_ANALYZE=ON ^
-S $(Build.SourcesDirectory) -B $(${{ parameters.buildOutputLocationVar }})
-S $(Build.SourcesDirectory) -B "$(buildOutputLocation)"
displayName: 'Configure the STL'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake --build $(${{ parameters.buildOutputLocationVar }})
cmake --build "$(buildOutputLocation)"
displayName: 'Build the STL'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
if exist "$(${{ parameters.benchmarkBuildOutputLocationVar }})" (
rmdir /S /Q "$(${{ parameters.benchmarkBuildOutputLocationVar }})"
if exist "$(benchmarkBuildOutputLocation)" (
rmdir /S /Q "$(benchmarkBuildOutputLocation)"
)
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake ${{ parameters.cmakeAdditionalFlags}} -G Ninja ^
cmake ${{ parameters.cmakeAdditionalFlags }} -G Ninja ^
-DCMAKE_CXX_COMPILER=cl ^
-DCMAKE_BUILD_TYPE=Release ^
-DSTL_BINARY_DIR=$(${{ parameters.buildOutputLocationVar }}) ^
-S $(Build.SourcesDirectory)/benchmarks -B $(${{ parameters.benchmarkBuildOutputLocationVar }})
-DSTL_BINARY_DIR="$(buildOutputLocation)" ^
-S $(Build.SourcesDirectory)/benchmarks -B "$(benchmarkBuildOutputLocation)"
displayName: 'Configure the benchmarks'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
condition: ne('${{ parameters.benchmarkBuildOutputLocationVar }}', '')
condition: and(succeeded(), ${{ parameters.buildBenchmarks }})
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
cmake --build $(${{ parameters.benchmarkBuildOutputLocationVar }})
cmake --build "$(benchmarkBuildOutputLocation)"
displayName: 'Build the benchmarks'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
condition: ne('${{ parameters.benchmarkBuildOutputLocationVar }}', '')
condition: and(succeeded(), ${{ parameters.buildBenchmarks }})
21 changes: 21 additions & 0 deletions azure-devops/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Common configuration used by both pipelines

variables:
- name: poolName
value: 'StlBuild-2023-09-14T1251-Pool'
readonly: true
- name: poolDemands
value: 'EnableSpotVM -equals true'
readonly: true
- name: tmpDir
value: 'D:\Temp'
readonly: true
- name: buildOutputLocation
value: 'D:\build'
readonly: true
- name: benchmarkBuildOutputLocation
value: 'D:\benchmark'
readonly: true
17 changes: 4 additions & 13 deletions azure-devops/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,14 @@ parameters:
type: string
- name: vsDevCmdArch
type: string
- name: buildOutputLocationVar
type: string
default: buildOutputLocation
- name: benchmarkBuildOutputLocationVar
type: string
default: benchmarkBuildOutputLocation
- name: buildBenchmarks
type: boolean
default: true
- name: numShards
type: number
default: 8
jobs:
- job: '${{ parameters.targetPlatform }}'
variables:
fixedFlags: '--timeout=240;--shuffle'
parallelismFlag: '-j$(testParallelism)'
xmlOutputFlag: '--xunit-xml-output=$(${{ parameters.buildOutputLocationVar }})/test-results.xml'
shardFlags: '--order=lexical;--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
litFlags: '$(fixedFlags);$(parallelismFlag);$(xmlOutputFlag);$(shardFlags)'
strategy:
parallel: ${{ parameters.numShards }}
timeoutInMinutes: 25
Expand All @@ -42,7 +33,7 @@ jobs:
hostArch: ${{ parameters.hostArch }}
targetArch: ${{ parameters.vsDevCmdArch }}
cmakeAdditionalFlags: '-DTESTS_BUILD_ONLY=ON'
benchmarkBuildOutputLocationVar: ${{ parameters.benchmarkBuildOutputLocationVar }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
- template: run-tests.yml
parameters:
hostArch: ${{ parameters.hostArch }}
Expand Down
17 changes: 4 additions & 13 deletions azure-devops/native-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ parameters:
type: string
- name: vsDevCmdArch
type: string
- name: buildOutputLocationVar
type: string
default: buildOutputLocation
- name: benchmarkBuildOutputLocationVar
type: string
default: benchmarkBuildOutputLocation
- name: buildBenchmarks
type: boolean
default: true
- name: numShards
type: number
default: 8
Expand All @@ -22,12 +19,6 @@ parameters:
default: '-E stlasan'
jobs:
- job: '${{ parameters.targetPlatform }}'
variables:
fixedFlags: '--timeout=240;--shuffle'
parallelismFlag: '-j$(testParallelism)'
xmlOutputFlag: '--xunit-xml-output=$(${{ parameters.buildOutputLocationVar }})/test-results.xml'
shardFlags: '--order=lexical;--num-shards=$(System.TotalJobsInPhase);--run-shard=$(System.JobPositionInPhase)'
litFlags: '$(fixedFlags);$(parallelismFlag);$(xmlOutputFlag);$(shardFlags)'
strategy:
parallel: ${{ parameters.numShards }}
timeoutInMinutes: 25
Expand All @@ -43,7 +34,7 @@ jobs:
targetPlatform: ${{ parameters.targetPlatform }}
targetArch: ${{ parameters.vsDevCmdArch }}
hostArch: ${{ parameters.vsDevCmdArch }}
benchmarkBuildOutputLocationVar: ${{ parameters.benchmarkBuildOutputLocationVar }}
buildBenchmarks: ${{ parameters.buildBenchmarks }}
- template: run-tests.yml
parameters:
hostArch: ${{ parameters.vsDevCmdArch }}
Expand Down
9 changes: 3 additions & 6 deletions azure-devops/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

parameters:
- name: buildOutputLocationVar
type: string
default: buildOutputLocation
- name: targetPlatform
type: string
- name: hostArch
Expand All @@ -23,7 +20,7 @@ steps:
timeoutInMinutes: 20
condition: succeeded()
inputs:
workingDirectory: $(${{ parameters.buildOutputLocationVar }})
workingDirectory: $(buildOutputLocation)
script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo
Expand All @@ -34,11 +31,11 @@ steps:
timeoutInMinutes: 5
condition: succeededOrFailed()
inputs:
searchFolder: $(${{ parameters.buildOutputLocationVar }})
searchFolder: $(buildOutputLocation)
testResultsFormat: JUnit
testResultsFiles: '**/test-results.xml'
testRunTitle: 'test-${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)'
- publish: $(${{ parameters.buildOutputLocationVar }})/test-results.xml
- publish: $(buildOutputLocation)/test-results.xml
artifact: '${{ parameters.targetPlatform }}-$(System.JobPositionInPhase)-xml-$(System.JobId)'
condition: failed()
displayName: 'Publish XML Artifact'
33 changes: 21 additions & 12 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
# Build STL targeting x86, x64, arm, arm64

variables:
tmpDir: 'D:\Temp'
buildOutputLocation: 'D:\build'
benchmarkBuildOutputLocation: 'D:\benchmark'

pool:
name: 'StlBuild-2023-09-14T1251-Pool'
demands: EnableSpotVM -equals true
- template: azure-devops/config.yml

pr:
drafts: false

stages:
- stage: Code_Format
displayName: 'Code Format'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/format-validation.yml

- stage: Build_And_Test_x64
dependsOn: Code_Format
displayName: 'Build and Test'
displayName: 'Build and Test x64'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/native-build-test.yml
parameters:
Expand All @@ -32,7 +32,10 @@ stages:

- stage: Build_And_Test_x86
dependsOn: Build_And_Test_x64
displayName: 'Build and Test'
displayName: 'Build and Test x86'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/native-build-test.yml
parameters:
Expand All @@ -41,17 +44,23 @@ stages:

- stage: Build_ARM
dependsOn: Build_And_Test_x64
displayName: 'Build'
displayName: 'Build ARM'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/cross-build.yml
parameters:
targetPlatform: arm
vsDevCmdArch: arm
benchmarkBuildOutputLocationVar: ''
buildBenchmarks: false

- stage: Build_ARM64
dependsOn: Build_And_Test_x64
displayName: 'Build'
displayName: 'Build ARM64'
pool:
name: ${{ variables.poolName }}
demands: ${{ variables.poolDemands }}
jobs:
- template: azure-devops/cross-build.yml
parameters:
Expand Down

0 comments on commit b448869

Please sign in to comment.