-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a dev drive for testing on Windows #15664
base: main
Are you sure you want to change the base?
Changes from all commits
024758e
c811f5b
4a2ffa5
4977a38
03d63dc
2473404
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Configures a drive for testing in CI. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scary, but just copied over from uv. |
||
|
||
# When not using a GitHub Actions "larger runner", the `D:` drive is present and | ||
# has similar or better performance characteristics than a ReFS dev drive. | ||
# Sometimes using a larger runner is still more performant (e.g., when running | ||
# the test suite) and we need to create a dev drive. This script automatically | ||
# configures the appropriate drive. | ||
|
||
# Note we use `Get-PSDrive` is not sufficient because the drive letter is assigned. | ||
if (Test-Path "D:\") { | ||
Write-Output "Using existing drive at D:" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A beautiful mix of space and tab indentation. hehe |
||
$Drive = "D:" | ||
} else { | ||
# The size (20 GB) is chosen empirically to be large enough for our | ||
# workflows; larger drives can take longer to set up. | ||
$Volume = New-VHD -Path C:/ruff_dev_drive.vhdx -SizeBytes 20GB | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably get away with a smaller drive for Ruff. |
||
Mount-VHD -Passthru | | ||
Initialize-Disk -Passthru | | ||
New-Partition -AssignDriveLetter -UseMaximumSize | | ||
Format-Volume -DevDrive -Confirm:$false -Force | ||
|
||
$Drive = "$($Volume.DriveLetter):" | ||
|
||
# Set the drive as trusted | ||
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-designate-a-dev-drive-as-trusted | ||
fsutil devdrv trust $Drive | ||
|
||
# Disable antivirus filtering on dev drives | ||
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-configure-additional-filters-on-dev-drive | ||
fsutil devdrv enable /disallowAv | ||
|
||
# Remount so the changes take effect | ||
Dismount-VHD -Path C:/ruff_dev_drive.vhdx | ||
Mount-VHD -Path C:/ruff_dev_drive.vhdx | ||
|
||
# Show some debug information | ||
Write-Output $Volume | ||
fsutil devdrv query $Drive | ||
|
||
Write-Output "Using Dev Drive at $Volume" | ||
} | ||
|
||
$Tmp = "$($Drive)\ruff-tmp" | ||
|
||
# Create the directory ahead of time in an attempt to avoid race-conditions | ||
New-Item $Tmp -ItemType Directory | ||
|
||
# Move Cargo to the dev drive | ||
New-Item -Path "$($Drive)/.cargo/bin" -ItemType Directory -Force | ||
Copy-Item -Path "C:/Users/runneradmin/.cargo/*" -Destination "$($Drive)/.cargo/" -Recurse -Force | ||
|
||
Write-Output ` | ||
"DEV_DRIVE=$($Drive)" ` | ||
"TMP=$($Tmp)" ` | ||
"TEMP=$($Tmp)" ` | ||
"UV_INTERNAL__TEST_DIR=$($Tmp)" ` | ||
"RUSTUP_HOME=$($Drive)/.rustup" ` | ||
"CARGO_HOME=$($Drive)/.cargo" ` | ||
"RUFF_WORKSPACE=$($Drive)/ruff" ` | ||
"PATH=$($Drive)/.cargo/bin;$env:PATH" ` | ||
>> $env:GITHUB_ENV | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed when you use
testing::setup_tracing()
It always writes the logs and they should be visible if the test fails