Skip to content

Commit 254ac63

Browse files
committed
Toggle based on the presence of a D: drive
1 parent 05bd52e commit 254ac63

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

.github/workflows/setup-dev-drive.ps1

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
# This uses `D:` as the workspace instead of `C:`, as the performance is much
2-
# better. Previously, we created a ReFS Dev Drive, but this is actually faster.
1+
# Configures a drive for testing in CI.
2+
3+
# When not using a GitHub Actions "larger runner", the `D:` drive is present and
4+
# has similar or better performance characteristics than a ReFS dev drive.
5+
# Sometimes using a larger runner is still more performant (e.g., when running
6+
# the test suite) and we need to create a dev drive. This script automatically
7+
# configures the appropriate drive.
8+
9+
# Note we use `Get-PSDrive` is not sufficient because the drive letter is assigned.
10+
if (Test-Path "D:\") {
11+
Write-Output "Using `D:` drive"
12+
$Drive = "D:"
13+
} else {
14+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 20GB |
15+
Mount-VHD -Passthru |
16+
Initialize-Disk -Passthru |
17+
New-Partition -AssignDriveLetter -UseMaximumSize |
18+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
19+
20+
Write-Output "Using ReFS drive at $Volume"
21+
$Drive = "$($Volume.DriveLetter):"
22+
}
323

4-
$Drive = "D:"
524
$Tmp = "$($Drive)\uv-tmp"
625

726
# Create the directory ahead of time in an attempt to avoid race-conditions

0 commit comments

Comments
 (0)