mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[vcpkg] Add disk space report to Windows PR/CI (#12113)
* [vcpkg] Add disk space report to PR/CI Example output: ``` Disk Label Size Free Space ---- ----- ---- ---------- C: Sabrent 1907 GiB 1239 GiB D: Dev 447 GiB 383 GiB E: Samsung 960 Pro 1908 GiB 1084 GiB H: Rocket 3815 GiB 863 GiB R: 0 B 0 B S: 0 B 0 B ```
This commit is contained in:
parent
0d37525d75
commit
f10c49281a
@ -15,6 +15,11 @@ jobs:
|
||||
displayName: 'Initialize Environment'
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/windows/initialize-environment.ps1'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Report on Disk Space'
|
||||
condition: always()
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/windows/disk-space.ps1'
|
||||
# Note: D: is the Azure machines' temporary disk.
|
||||
- task: CmdLine@2
|
||||
displayName: 'Build vcpkg'
|
||||
@ -48,6 +53,11 @@ jobs:
|
||||
inputs:
|
||||
testResultsFiles: '$(System.ArtifactsDirectory)/xml-results/${{ parameters.triplet }}.xml'
|
||||
condition: always()
|
||||
- task: PowerShell@2
|
||||
displayName: 'Report on Disk Space After Build'
|
||||
condition: always()
|
||||
inputs:
|
||||
filePath: 'scripts/azure-pipelines/windows/disk-space.ps1'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: ${{ parameters.triplet }} port build failure logs'
|
||||
inputs:
|
||||
|
35
scripts/azure-pipelines/windows/disk-space.ps1
Normal file
35
scripts/azure-pipelines/windows/disk-space.ps1
Normal file
@ -0,0 +1,35 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Prints total and free disk space for each disk on the system
|
||||
#>
|
||||
|
||||
Function Format-Size {
|
||||
[CmdletBinding()]
|
||||
Param([long]$Size)
|
||||
|
||||
if ($Size -lt 1024) {
|
||||
$Size = [int]$Size
|
||||
return "$Size B"
|
||||
}
|
||||
|
||||
$Size = $Size / 1024
|
||||
if ($Size -lt 1024) {
|
||||
$Size = [int]$Size
|
||||
return "$Size KiB"
|
||||
}
|
||||
|
||||
$Size = $Size / 1024
|
||||
if ($Size -lt 1024) {
|
||||
$Size = [int]$Size
|
||||
return "$Size MiB"
|
||||
}
|
||||
|
||||
$Size = [int]($Size / 1024)
|
||||
return "$Size GiB"
|
||||
}
|
||||
|
||||
Get-CimInstance -ClassName Win32_LogicalDisk | Format-Table -Property @{Label="Disk"; Expression={ $_.DeviceID }},@{Label="Label"; Expression={ $_.VolumeName }},@{Label="Size"; Expression={ Format-Size($_.Size) }},@{Label="Free Space"; Expression={ Format-Size($_.FreeSpace) }}
|
Loading…
x
Reference in New Issue
Block a user