Skip to content

Commit 6cbf357

Browse files
committed
feat: speed up windows tests using ReFS
1 parent 106c3b5 commit 6cbf357

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-shear:
@@ -145,8 +180,28 @@ jobs:
145180
labels: ${{ matrix.runner }}
146181
name: "cargo test | ${{ matrix.os }}"
147182
steps:
183+
- name: Create Dev Drive using ReFS
184+
run: |
185+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
186+
Mount-VHD -Passthru |
187+
Initialize-Disk -Passthru |
188+
New-Partition -AssignDriveLetter -UseMaximumSize |
189+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
190+
Write-Output $Volume
191+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter):" >> $env:GITHUB_ENV
192+
148193
- uses: actions/checkout@v4
194+
195+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
196+
- name: Copy Git Repo to Dev Drive
197+
run: |
198+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
199+
149200
- name: "Install Rust toolchain"
201+
working-directory: ${{ env.DEV_DRIVE }}/uv
202+
env:
203+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
204+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
150205
run: rustup show
151206

152207
# We do not test with Python patch versions on Windows
@@ -162,18 +217,33 @@ jobs:
162217
3.12
163218
164219
- uses: Swatinem/rust-cache@v2
220+
with:
221+
workspaces: ${{ env.DEV_DRIVE }}/uv
222+
env:
223+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
224+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
165225

166226
- name: "Install cargo nextest"
167227
uses: taiki-e/install-action@v2
168228
with:
169229
tool: cargo-nextest
230+
env:
231+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
232+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
170233

171234
- name: "Cargo test"
235+
working-directory: ${{ env.DEV_DRIVE }}/uv
236+
env:
237+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
238+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
172239
run: |
173240
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
174241
175242
- name: "Smoke test"
243+
working-directory: ${{ env.DEV_DRIVE }}/uv
176244
env:
245+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
246+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
177247
# Avoid debug build stack overflows.
178248
UV_STACK_SIZE: 2000000 # 2 megabyte, double the default on windows
179249
run: |
@@ -186,21 +256,53 @@ jobs:
186256
runs-on: windows-latest
187257
name: "check windows trampoline"
188258
steps:
259+
- name: Create Dev Drive using ReFS
260+
run: |
261+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
262+
Mount-VHD -Passthru |
263+
Initialize-Disk -Passthru |
264+
New-Partition -AssignDriveLetter -UseMaximumSize |
265+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
266+
Write-Output $Volume
267+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter):" >> $env:GITHUB_ENV
268+
189269
- uses: actions/checkout@v4
270+
271+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
272+
- name: Copy Git Repo to Dev Drive
273+
run: |
274+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
275+
190276
- name: "Install Rust toolchain"
191-
working-directory: crates/uv-trampoline
277+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
278+
env:
279+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
280+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
192281
run: |
193282
rustup target add x86_64-pc-windows-msvc
194283
rustup component add clippy rust-src --toolchain nightly-2024-03-19-x86_64-pc-windows-msvc
284+
195285
- uses: rui314/setup-mold@v1
286+
196287
- uses: Swatinem/rust-cache@v2
197288
with:
198-
workspaces: "crates/uv-trampoline"
289+
workspaces: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
290+
env:
291+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
292+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
293+
199294
- name: "Clippy"
200-
working-directory: crates/uv-trampoline
295+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
296+
env:
297+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
298+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
201299
run: cargo clippy --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings
300+
202301
- name: "Build"
203-
working-directory: crates/uv-trampoline
302+
working-directory: ${{ env.DEV_DRIVE }}/uv/crates/uv-trampoline
303+
env:
304+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
305+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
204306
run: cargo build --release --target x86_64-pc-windows-msvc
205307

206308
build-binary-linux:
@@ -273,19 +375,44 @@ jobs:
273375
labels: windows-latest-large
274376
name: "build binary | windows"
275377
steps:
378+
- name: Create Dev Drive using ReFS
379+
run: |
380+
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
381+
Mount-VHD -Passthru |
382+
Initialize-Disk -Passthru |
383+
New-Partition -AssignDriveLetter -UseMaximumSize |
384+
Format-Volume -FileSystem ReFS -Confirm:$false -Force
385+
Write-Output $Volume
386+
Write-Output "DEV_DRIVE=$($Volume.DriveLetter):" >> $env:GITHUB_ENV
387+
276388
- uses: actions/checkout@v4
277389

390+
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
391+
- name: Copy Git Repo to Dev Drive
392+
run: |
393+
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse
394+
278395
- uses: rui314/setup-mold@v1
279396

280397
- uses: Swatinem/rust-cache@v2
398+
with:
399+
workspaces: ${{ env.DEV_DRIVE }}/uv
400+
env:
401+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
402+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
403+
281404
- name: "Build"
405+
working-directory: ${{ env.DEV_DRIVE }}/uv
406+
env:
407+
CARGO_HOME: ${{ env.DEV_DRIVE }}/.cargo
408+
RUSTUP_HOME: ${{ env.DEV_DRIVE }}/.rustup
282409
run: cargo build
283410

284411
- name: "Upload binary"
285412
uses: actions/upload-artifact@v4
286413
with:
287414
name: uv-windows-${{ github.sha }}
288-
path: ./target/debug/uv.exe
415+
path: ${{ env.DEV_DRIVE }}/uv/target/debug/uv.exe
289416
retention-days: 1
290417

291418
ecosystem-test:

0 commit comments

Comments
 (0)