Skip to content

Commit 1982c79

Browse files
committed
Try resizing the partitions before the build
Thanks to @aktech for the suggestion. Signed-off-by: Michał Górny <[email protected]>
1 parent 319736b commit 1982c79

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/conda-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,31 @@ jobs:
133133
fi
134134
./.scripts/run_osx_build.sh
135135
136+
# https://github.com/aktech/cirun-azure-resize-disk
137+
- name: Resize all partitions to maximum
138+
if: matrix.os == 'windows'
139+
shell: pwsh
140+
run: |
141+
Write-Output "=== RESIZING PARTITIONS ==="
142+
$disks = Get-Disk | Where-Object PartitionStyle -ne 'RAW'
143+
144+
foreach ($disk in $disks) {
145+
$partitions = Get-Partition -DiskNumber $disk.Number
146+
foreach ($partition in $partitions) {
147+
try {
148+
$size = Get-PartitionSupportedSize -DiskNumber $disk.Number -PartitionNumber $partition.PartitionNumber
149+
if ($partition.Size -lt $size.SizeMax) {
150+
Write-Output "Resizing Disk $($disk.Number) Partition $($partition.PartitionNumber) from $($partition.Size) to $($size.SizeMax)"
151+
Resize-Partition -DiskNumber $disk.Number -PartitionNumber $partition.PartitionNumber -Size $size.SizeMax -Verbose
152+
} else {
153+
Write-Output "Disk $($disk.Number) Partition $($partition.PartitionNumber) already at max size ($($partition.Size))"
154+
}
155+
} catch {
156+
Write-Warning "Failed resizing Disk $($disk.Number) Partition $($partition.PartitionNumber): $_"
157+
}
158+
}
159+
}
160+
136161
- name: Build on windows
137162
id: build-windows
138163
if: matrix.os == 'windows'

0 commit comments

Comments
 (0)