Skip to content

Commit 25be387

Browse files
committed
feat: speed up windows tests using ReFS
1 parent 1ba3414 commit 25be387

File tree

1 file changed

+142
-15
lines changed

1 file changed

+142
-15
lines changed

.github/workflows/ci.yml

Lines changed: 142 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,59 @@ jobs:
6060
run: pipx run ruff check .
6161

6262
cargo-clippy:
63-
strategy:
64-
matrix:
65-
include:
66-
- os: "ubuntu"
67-
runner: "ubuntu-latest"
68-
- os: "windows"
69-
runner: "windows-latest-large"
70-
fail-fast: false
71-
runs-on: ["${{ matrix.runner }}"]
72-
name: "cargo clippy | ${{ matrix.os }}"
63+
runs-on: ubuntu-latest
64+
name: "cargo clippy | ubuntu"
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: "Install Rust toolchain"
68+
run: rustup component add clippy
69+
- uses: Swatinem/rust-cache@v2
70+
with:
71+
save-if: ${{ github.ref == 'refs/heads/main' }}
72+
- name: "Clippy"
73+
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
74+
75+
cargo-clippy-windows:
76+
runs-on: windows-latest-large
77+
name: "cargo clippy | windows"
7378
steps:
79+
- name: Create Dev Drive using ReFS
80+
run: |
81+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
82+
Mount-VHD -Passthru |
83+
Initialize-Disk -Passthru |
84+
New-Partition -AssignDriveLetter -UseMaximumSize |
85+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
86+
Write-Output $Volume
87+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter)`:" >> $env:GITHUB_ENV
88+
7489
- uses: actions/checkout@v4
90+
91+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
92+
- name: Copy Git Repo to Dev Drive
93+
run: |
94+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
95+
7596
- name: "Install Rust toolchain"
97+
working-directory: ${{ env.DEV_DRIVE }}/uv
98+
env:
99+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
100+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
76101
run: rustup component add clippy
102+
77103
- uses: Swatinem/rust-cache@v2
78104
with:
105+
workspaces: ${{ env.DEV_DRIVE }}/uv
79106
save-if: ${{ github.ref == 'refs/heads/main' }}
107+
env:
108+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
109+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
110+
80111
- name: "Clippy"
112+
working-directory: ${{ env.DEV_DRIVE }}/uv
113+
env:
114+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
115+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
81116
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
82117

83118
cargo-test-unix:
@@ -136,8 +171,28 @@ jobs:
136171
labels: ${{ matrix.runner }}
137172
name: "cargo test | ${{ matrix.os }}"
138173
steps:
174+
- name: Create Dev Drive using ReFS
175+
run: |
176+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
177+
Mount-VHD -Passthru |
178+
Initialize-Disk -Passthru |
179+
New-Partition -AssignDriveLetter -UseMaximumSize |
180+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
181+
Write-Output $Volume
182+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter)`:" >> $env:GITHUB_ENV
183+
139184
- uses: actions/checkout@v4
185+
186+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
187+
- name: Copy Git Repo to Dev Drive
188+
run: |
189+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
190+
140191
- name: "Install Rust toolchain"
192+
working-directory: ${{ env.DEV_DRIVE }}/uv
193+
env:
194+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
195+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
141196
run: rustup show
142197

143198
# We do not test with Python patch versions on Windows
@@ -153,18 +208,33 @@ jobs:
153208
3.12
154209
155210
- uses: Swatinem/rust-cache@v2
211+
with:
212+
workspaces: ${{ env.DEV_DRIVE }}/uv
213+
env:
214+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
215+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
156216

157217
- name: "Install cargo nextest"
158218
uses: taiki-e/install-action@v2
159219
with:
160220
tool: cargo-nextest
221+
env:
222+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
223+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
161224

162225
- name: "Cargo test"
226+
working-directory: ${{ env.DEV_DRIVE }}/uv
227+
env:
228+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
229+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
163230
run: |
164231
cargo nextest run --no-default-features --features python,pypi,git --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12 --final-status-level slow
165232
166233
- name: "Smoke test"
234+
working-directory: ${{ env.DEV_DRIVE }}/uv
167235
env:
236+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
237+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
168238
# Avoid debug build stack overflows.
169239
UV_STACK_SIZE: 2000000 # 2 megabyte, double the default on windows
170240
run: |
@@ -177,21 +247,53 @@ jobs:
177247
runs-on: windows-latest
178248
name: "check windows trampoline"
179249
steps:
250+
- name: Create Dev Drive using ReFS
251+
run: |
252+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
253+
Mount-VHD -Passthru |
254+
Initialize-Disk -Passthru |
255+
New-Partition -AssignDriveLetter -UseMaximumSize |
256+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
257+
Write-Output $Volume
258+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter)`:" >> $env:GITHUB_ENV
259+
180260
- uses: actions/checkout@v4
261+
262+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
263+
- name: Copy Git Repo to Dev Drive
264+
run: |
265+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
266+
181267
- name: "Install Rust toolchain"
182-
working-directory: crates/uv-trampoline
268+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
269+
env:
270+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
271+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
183272
run: |
184273
rustup target add x86_64-pc-windows-msvc
185274
rustup component add clippy rust-src --toolchain nightly-2024-03-19-x86_64-pc-windows-msvc
275+
186276
- uses: rui314/setup-mold@v1
277+
187278
- uses: Swatinem/rust-cache@v2
188279
with:
189-
workspaces: "crates/uv-trampoline"
280+
workspaces: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
281+
env:
282+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
283+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
284+
190285
- name: "Clippy"
191-
working-directory: crates/uv-trampoline
286+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
287+
env:
288+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
289+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
192290
run: cargo clippy --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings
291+
193292
- name: "Build"
194-
working-directory: crates/uv-trampoline
293+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
294+
env:
295+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
296+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
195297
run: cargo build --release --target x86_64-pc-windows-msvc
196298

197299
build-binary-linux:
@@ -264,19 +366,44 @@ jobs:
264366
labels: windows-latest-large
265367
name: "build binary | windows"
266368
steps:
369+
- name: Create Dev Drive using ReFS
370+
run: |
371+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
372+
Mount-VHD -Passthru |
373+
Initialize-Disk -Passthru |
374+
New-Partition -AssignDriveLetter -UseMaximumSize |
375+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
376+
Write-Output $Volume
377+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter)`:" >> $env:GITHUB_ENV
378+
267379
- uses: actions/checkout@v4
268380

381+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
382+
- name: Copy Git Repo to Dev Drive
383+
run: |
384+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
385+
269386
- uses: rui314/setup-mold@v1
270387

271388
- uses: Swatinem/rust-cache@v2
389+
with:
390+
workspaces: ${{ env.DEV_DRIVE }}/uv
391+
env:
392+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
393+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
394+
272395
- name: "Build"
396+
working-directory: ${{ env.DEV_DRIVE }}/uv
397+
env:
398+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
399+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
273400
run: cargo build
274401

275402
- name: "Upload binary"
276403
uses: actions/upload-artifact@v4
277404
with:
278405
name: uv-windows-${{ github.sha }}
279-
path: ./target/debug/uv.exe
406+
path: ${{ env.DEV_DRIVE }}/uv/target/debug/uv.exe
280407
retention-days: 1
281408

282409
ecosystem-test:

0 commit comments

Comments
 (0)