setup-dev-driver.ps1

 1# Configures a drive for testing in CI.
 2# todo(windows)
 3# The current version of the Windows runner is 10.0.20348 which does not support DevDrive option.
 4# Ref: https://learn.microsoft.com/en-us/windows/dev-drive/
 5
 6# Currently, total CI requires almost 45GB of space, here we are creating a 100GB drive.
 7$Volume = New-VHD -Path C:/zed_dev_drive.vhdx -SizeBytes 100GB |
 8                    Mount-VHD -Passthru |
 9                    Initialize-Disk -Passthru |
10                    New-Partition -AssignDriveLetter -UseMaximumSize |
11                    Format-Volume -FileSystem ReFS -Confirm:$false -Force
12
13$Drive = "$($Volume.DriveLetter):"
14
15# Show some debug information
16Write-Output $Volume
17Write-Output "Using Dev Drive at $Drive"
18
19# Move Cargo to the dev drive
20New-Item -Path "$($Drive)/.cargo/bin" -ItemType Directory -Force
21Copy-Item -Path "C:/Users/runneradmin/.cargo/*" -Destination "$($Drive)/.cargo/" -Recurse -Force
22
23Write-Output `
24	"DEV_DRIVE=$($Drive)" `
25	"RUSTUP_HOME=$($Drive)/.rustup" `
26	"CARGO_HOME=$($Drive)/.cargo" `
27	"ZED_WORKSPACE=$($Drive)/zed" `
28	"PATH=$($Drive)/.cargo/bin;$env:PATH" `
29	>> $env:GITHUB_ENV