Skip to content

Commit 896435f

Browse files
authored
Use D: drive for Windows CI (#10180)
When using the standard Windows runners (as opposed to the _larger_ GitHub runners), an undocumented `D:` drive is available and performant. We can save some money on by using this on a standard runner instead of a larger runner with an ReFS drive. Switching to the `D:` drive was not acceptable for `cargo test` >25m runtime. Inspired by pypa/pip#13129 See actions/runner-images#8755 Timings (grain of salt — GitHub is super noisy): - clippy: 2m 18s -> 2m 11s - build binary: 2m 3s -> 2m 35s - trampoline check (x86-64): 2m 32s -> 1m 50s (other architectures similar) - trampoline test (x86-64): 4m 12s -> 6m 7s - trampoline test (i686): 6m 44s -> 5m 35s
1 parent a7f67e8 commit 896435f

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
timeout-minutes: 15
117117
needs: determine_changes
118118
if: ${{ github.repository == 'astral-sh/uv' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
119-
runs-on: github-windows-2025-x86_64-16
119+
runs-on: windows-latest
120120
name: "cargo clippy | windows"
121121
steps:
122122
- uses: actions/checkout@v4
@@ -324,7 +324,7 @@ jobs:
324324
timeout-minutes: 15
325325
needs: determine_changes
326326
if: ${{ github.repository == 'astral-sh/uv' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
327-
runs-on: github-windows-2025-x86_64-16
327+
runs-on: windows-latest
328328
name: "check windows trampoline | ${{ matrix.target-arch }}"
329329
strategy:
330330
fail-fast: false
@@ -517,7 +517,7 @@ jobs:
517517
needs: determine_changes
518518
timeout-minutes: 10
519519
if: ${{ github.repository == 'astral-sh/uv' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
520-
runs-on: github-windows-2025-x86_64-8
520+
runs-on: windows-latest
521521
name: "build binary | windows"
522522
steps:
523523
- uses: actions/checkout@v4

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

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,46 @@
1-
# This creates a 20GB dev drive, and exports all required environment
2-
# variables so that rustup, uv and others all use the dev drive as much
3-
# as possible.
4-
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 20GB |
5-
Mount-VHD -Passthru |
6-
Initialize-Disk -Passthru |
7-
New-Partition -AssignDriveLetter -UseMaximumSize |
8-
Format-Volume -DevDrive -Confirm:$false -Force
9-
10-
$Drive = "$($Volume.DriveLetter):"
11-
12-
# Set the drive as trusted
13-
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-designate-a-dev-drive-as-trusted
14-
fsutil devdrv trust $Drive
15-
16-
# Disable antivirus filtering on dev drives
17-
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-configure-additional-filters-on-dev-drive
18-
fsutil devdrv enable /disallowAv
19-
20-
# Remount so the changes take effect
21-
Dismount-VHD -Path C:/uv_dev_drive.vhdx
22-
Mount-VHD -Path C:/uv_dev_drive.vhdx
23-
24-
# Show some debug information
25-
Write-Output $Volume
26-
fsutil devdrv query $Drive
27-
28-
# Configure a temporary directory
29-
$Tmp = "$($Drive)/uv-tmp"
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 existing drive at D:"
12+
$Drive = "D:"
13+
} else {
14+
# The size (20 GB) is chosen empirically to be large enough for our
15+
# workflows; larger drives can take longer to set up.
16+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 20GB |
17+
Mount-VHD -Passthru |
18+
Initialize-Disk -Passthru |
19+
New-Partition -AssignDriveLetter -UseMaximumSize |
20+
Format-Volume -DevDrive -Confirm:$false -Force
21+
22+
$Drive = "$($Volume.DriveLetter):"
23+
24+
# Set the drive as trusted
25+
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-designate-a-dev-drive-as-trusted
26+
fsutil devdrv trust $Drive
27+
28+
# Disable antivirus filtering on dev drives
29+
# See https://learn.microsoft.com/en-us/windows/dev-drive/#how-do-i-configure-additional-filters-on-dev-drive
30+
fsutil devdrv enable /disallowAv
31+
32+
# Remount so the changes take effect
33+
Dismount-VHD -Path C:/uv_dev_drive.vhdx
34+
Mount-VHD -Path C:/uv_dev_drive.vhdx
35+
36+
# Show some debug information
37+
Write-Output $Volume
38+
fsutil devdrv query $Drive
39+
40+
Write-Output "Using Dev Drive at $Volume"
41+
}
42+
43+
$Tmp = "$($Drive)\uv-tmp"
3044

3145
# Create the directory ahead of time in an attempt to avoid race-conditions
3246
New-Item $Tmp -ItemType Directory

0 commit comments

Comments
 (0)