diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml index 957a860aa..341ca669c 100644 --- a/.github/actions/setup-windows/action.yml +++ b/.github/actions/setup-windows/action.yml @@ -3,4 +3,48 @@ description: | This action configures the Windows builders to run tests. runs: using: "composite" - steps: [] + steps: + # The GitHub Actions hosted Windows runners have a slow persistent + # `C:` drive and a temporary `D:` drive with better throughput. The + # repository checkout is placed on `D:` by default, but the user + # profile is on `C:`, slowing down access to temporary directories + # and the Rust toolchain we install. Since our build environment is + # ephemeral anyway, we can save a couple minutes of CI time by + # placing everything on `D:`. + # + # Some projects have reported even bigger wins by mounting a VHDX + # virtual drive with a ReFS file system on it, with or without the + # native Dev Drive feature available in Windows 2025, but it seems + # to make things slightly slower for us overall compared to `D:`. + # Further investigation and experimentation would be welcome! + # + # See: + - name: 'Set up D: drive' + shell: pwsh + run: | + # Set up D: drive + + # Short file names are disabled by default on the `D:` drive, + # which breaks some of our tests. Enable them. + # + # This has a slight performance penalty, and won’t be possible + # if we switch to ReFS/Dev Drives. The alternatives are to + # reduce CI coverage for the security mitigation the tests are + # checking, or arrange for those tests to take a separate path + # to a drive that supports short file names to use instead of + # the primary temporary directory. + fsutil 8dot3name set D: 0 + + # Move the temporary directory to `D:\Temp`. + New-Item -Path D:\ -Name Temp -ItemType directory + # Copy the effective permissions without inheritance. + $Acl = Get-Acl -Path $env:TMP + $Acl.SetAccessRuleProtection($true, $true) + Set-Acl -Path D:\Temp -AclObject $Acl + + Add-Content -Path $env:GITHUB_ENV @" + TMP=D:\Temp + TEMP=D:\Temp + RUSTUP_HOME=D:\.rustup + CARGO_HOME=D:\.cargo + "@ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd49d96b4..bef6b56c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,6 +69,7 @@ jobs: with: persist-credentials: false - name: Set up Windows Builders + if: startswith(matrix.os, 'windows') uses: ./.github/actions/setup-windows - name: Install Rust uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0