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$Volume = New-VHD -Path C:/zed_dev_drive.vhdx -SizeBytes 30GB |
 7                    Mount-VHD -Passthru |
 8                    Initialize-Disk -Passthru |
 9                    New-Partition -AssignDriveLetter -UseMaximumSize |
10                    Format-Volume -FileSystem ReFS -Confirm:$false -Force
11
12$Drive = "$($Volume.DriveLetter):"
13
14# Show some debug information
15Write-Output $Volume
16Write-Output "Using Dev Drive at $Drive"
17    
18# Move Cargo to the dev drive
19New-Item -Path "$($Drive)/.cargo/bin" -ItemType Directory -Force
20Copy-Item -Path "C:/Users/runneradmin/.cargo/*" -Destination "$($Drive)/.cargo/" -Recurse -Force
21
22Write-Output `
23	"DEV_DRIVE=$($Drive)" `
24	"RUSTUP_HOME=$($Drive)/.rustup" `
25	"CARGO_HOME=$($Drive)/.cargo" `
26	"ZED_WORKSPACE=$($Drive)/zed" `
27	"PATH=$($Drive)/.cargo/bin;$env:PATH" `
28	>> $env:GITHUB_ENV