-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: run the tests as a separate build stage (#12141)
This commit moves the unit and feature tests to a separate stage, which can be retried more easily. Closes #11858
- Loading branch information
Showing
4 changed files
with
111 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
parameters: | ||
configuration: 'Release' | ||
platform: '' | ||
additionalBuildArguments: '' | ||
minimumExpectedTestsExecutedCount: 10 # Sanity check for minimum expected tests to be reported | ||
rerunPassesRequiredToAvoidFailure: 5 | ||
artifactName: 'drop' | ||
testLogPath: '$(Build.BinariesDirectory)\$(BuildPlatform)\$(BuildConfiguration)\testsOnBuildMachine.wtl' | ||
|
||
jobs: | ||
- job: Test${{ parameters.platform }}${{ parameters.configuration }} | ||
displayName: Test ${{ parameters.platform }} ${{ parameters.configuration }} | ||
variables: | ||
BuildConfiguration: ${{ parameters.configuration }} | ||
BuildPlatform: ${{ parameters.platform }} | ||
pool: | ||
${{ if eq(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}: | ||
name: WinDevPoolOSS-L | ||
${{ if ne(variables['System.CollectionUri'], 'https://dev.azure.com/ms/') }}: | ||
name: WinDevPool-L | ||
demands: ImageOverride -equals WinDevVS16-latest | ||
|
||
steps: | ||
- checkout: self | ||
submodules: true | ||
clean: true | ||
fetchDepth: 1 | ||
|
||
- task: DownloadBuildArtifacts@0 | ||
inputs: | ||
artifactName: ${{ parameters.artifactName }} | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Rationalize build platform' | ||
inputs: | ||
targetType: inline | ||
script: | | ||
$Arch = "$(BuildPlatform)" | ||
If ($Arch -Eq "x86") { $Arch = "Win32" } | ||
Write-Host "##vso[task.setvariable variable=RationalizedBuildPlatform]${Arch}" | ||
- task: PowerShell@2 | ||
displayName: 'Run Unit Tests' | ||
inputs: | ||
targetType: filePath | ||
filePath: build\scripts\Run-Tests.ps1 | ||
arguments: -MatchPattern '*unit.test*.dll' -Platform '$(RationalizedBuildPlatform)' -Configuration '$(BuildConfiguration)' -LogPath '${{ parameters.testLogPath }}' -Root "$(System.ArtifactsDirectory)\\${{ parameters.artifactName }}\\$(BuildConfiguration)\\$(BuildPlatform)\\test" | ||
condition: and(and(succeeded(), ne(variables['PGOBuildMode'], 'Instrument')), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Run Feature Tests (x64 only)' | ||
inputs: | ||
targetType: filePath | ||
filePath: build\scripts\Run-Tests.ps1 | ||
arguments: -MatchPattern '*feature.test*.dll' -Platform '$(RationalizedBuildPlatform)' -Configuration '$(BuildConfiguration)' -LogPath '${{ parameters.testLogPath }}' -Root "$(System.ArtifactsDirectory)\\${{ parameters.artifactName }}\\$(BuildConfiguration)\\$(BuildPlatform)\\test" | ||
condition: and(and(succeeded(), ne(variables['PGOBuildMode'], 'Instrument')), eq(variables['BuildPlatform'], 'x64')) | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Convert Test Logs from WTL to xUnit format' | ||
inputs: | ||
targetType: filePath | ||
filePath: build\Helix\ConvertWttLogToXUnit.ps1 | ||
arguments: -WttInputPath '${{ parameters.testLogPath }}' -WttSingleRerunInputPath 'unused.wtl' -WttMultipleRerunInputPath 'unused2.wtl' -XUnitOutputPath 'onBuildMachineResults.xml' -TestNamePrefix '$(BuildConfiguration).$(BuildPlatform)' | ||
condition: and(ne(variables['PGOBuildMode'], 'Instrument'),or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) | ||
|
||
- task: PublishTestResults@2 | ||
displayName: 'Upload converted test logs' | ||
condition: ne(variables['PGOBuildMode'], 'Instrument') | ||
inputs: | ||
testResultsFormat: 'xUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest | ||
testResultsFiles: '**/onBuildMachineResults.xml' | ||
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional | ||
#mergeTestResults: false # Optional | ||
#failTaskOnFailedTests: false # Optional | ||
testRunTitle: 'On Build Machine Tests' # Optional | ||
buildPlatform: $(BuildPlatform) # Optional | ||
buildConfiguration: $(BuildConfiguration) # Optional | ||
#publishRunAttachments: true # Optional | ||
|
||
- task: CopyFiles@2 | ||
displayName: 'Copy result logs to Artifacts' | ||
inputs: | ||
Contents: | | ||
**/*.wtl | ||
**/*onBuildMachineResults.xml | ||
${{ parameters.testLogPath }} | ||
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(BuildConfiguration)/$(BuildPlatform)/test-logs' | ||
OverWrite: true | ||
flattenFolders: true | ||
|
||
- publish: '$(Build.ArtifactStagingDirectory)/$(BuildConfiguration)/$(BuildPlatform)/test-logs' | ||
artifact: TestLogs$(BuildPlatform)$(BuildConfiguration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters