| 1 |
name: Configure Windows Builders |
| 2 |
description: | |
| 3 |
This action configures the Windows builders to run tests. |
| 4 |
runs: |
| 5 |
using: "composite" |
| 6 |
steps: |
| 7 |
# The GitHub Actions hosted Windows runners have a slow persistent |
| 8 |
# `C:` drive and a temporary `D:` drive with better throughput. The |
| 9 |
# repository checkout is placed on `D:` by default, but the user |
| 10 |
# profile is on `C:`, slowing down access to temporary directories |
| 11 |
# and the Rust toolchain we install. Since our build environment is |
| 12 |
# ephemeral anyway, we can save a couple minutes of CI time by |
| 13 |
# placing everything on `D:`. |
| 14 |
# |
| 15 |
# Some projects have reported even bigger wins by mounting a VHDX |
| 16 |
# virtual drive with a ReFS file system on it, with or without the |
| 17 |
# native Dev Drive feature available in Windows 2025, but it seems |
| 18 |
# to make things slightly slower for us overall compared to `D:`. |
| 19 |
# Further investigation and experimentation would be welcome! |
| 20 |
# |
| 21 |
# See: <https://chadgolden.com/blog/github-actions-hosted-windows-runners-slower-than-expected-ci-and-you> |
| 22 |
- name: 'Set up D: drive' |
| 23 |
shell: pwsh |
| 24 |
run: | # zizmor: ignore[github-env] all values are hardcoded literals, not attacker-controlled |
| 25 |
# Set up D: drive |
| 26 |
|
| 27 |
# Short file names are disabled by default on the `D:` drive, |
| 28 |
# which breaks some of our tests. Enable them. |
| 29 |
# |
| 30 |
# This has a slight performance penalty, and won’t be possible |
| 31 |
# if we switch to ReFS/Dev Drives. The alternatives are to |
| 32 |
# reduce CI coverage for the security mitigation the tests are |
| 33 |
# checking, or arrange for those tests to take a separate path |
| 34 |
# to a drive that supports short file names to use instead of |
| 35 |
# the primary temporary directory. |
| 36 |
fsutil 8dot3name set D: 0 |
| 37 |
|
| 38 |
# Move the temporary directory to `D:\Temp`. |
| 39 |
New-Item -Path D:\ -Name Temp -ItemType directory |
| 40 |
# Copy the effective permissions without inheritance. |
| 41 |
$Acl = Get-Acl -Path $env:TMP |
| 42 |
$Acl.SetAccessRuleProtection($true, $true) |
| 43 |
Set-Acl -Path D:\Temp -AclObject $Acl |
| 44 |
|
| 45 |
Add-Content -Path $env:GITHUB_ENV @" |
| 46 |
TMP=D:\Temp |
| 47 |
TEMP=D:\Temp |
| 48 |
RUSTUP_HOME=D:\.rustup |
| 49 |
CARGO_HOME=D:\.cargo |
| 50 |
"@ |