From 559732708e9e1b84166dc4e75d1f828898ec276f Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:34:57 +0100 Subject: [PATCH 1/6] feat: add Dev Drive setup for Windows in CI workflow --- .github/workflows/dotnet.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 6f148680f3..6b07e4c9bb 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -40,6 +40,45 @@ jobs: docker-images: false swap-storage: false + - name: Create Dev Drive (Windows) + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $vhdPath = 'C:\dev_drive.vhdx' + + # Create and mount VHDX via Hyper-V PowerShell cmdlets (available on GH runners) + New-VHD -Path $vhdPath -SizeBytes 10GB -Dynamic | Out-Null + $disk = Mount-VHD -Path $vhdPath -PassThru | Get-Disk + $disk | Initialize-Disk -PassThru | Out-Null + $part = $disk | New-Partition -AssignDriveLetter -UseMaximumSize + $driveLetter = $part.DriveLetter + + # Try native Dev Drive first (Windows Server 2025+ / 24H2+) + # Gives Defender performance mode, filter optimizations, and CoW block cloning + try { + $part | Format-Volume -DevDrive -Confirm:$false -Force | Out-Null + fsutil devdrv trust "${driveLetter}:" + Write-Host "Formatted ${driveLetter}: as Dev Drive (native)" + } catch { + # Fall back to plain ReFS on older Windows (e.g. Server 2022) + $part | Format-Volume -FileSystem ReFS -NewFileSystemLabel 'Build' -Confirm:$false -Force | Out-Null + Write-Host "Formatted ${driveLetter}: as ReFS (fallback)" + } + + $refsBuildDir = "${driveLetter}:\workspace" + New-Item -Path $refsBuildDir -ItemType Directory -Force | Out-Null + + # Junction the workspace so all subsequent steps transparently use the Dev Drive + Remove-Item -Path $env:GITHUB_WORKSPACE -Force -Recurse + cmd /c "mklink /J `"$env:GITHUB_WORKSPACE`" `"$refsBuildDir`"" + Write-Host "Redirected $env:GITHUB_WORKSPACE -> $refsBuildDir" + + # Redirect NuGet package cache to Dev Drive for faster restore/build + $nugetDir = "${driveLetter}:\.nuget\packages" + New-Item -Path $nugetDir -ItemType Directory -Force | Out-Null + "NUGET_PACKAGES=$nugetDir" >> $env:GITHUB_ENV + - uses: actions/checkout@v6 with: fetch-depth: 0 From f9924cf226ccdf33fb6bf732d83f84d3b63e2548 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:36:03 +0100 Subject: [PATCH 2/6] feat: streamline Dev Drive setup for Windows in CI workflow --- .github/workflows/dotnet.yml | 44 +++++++++++------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 6b07e4c9bb..be28ff5eda 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -40,45 +40,27 @@ jobs: docker-images: false swap-storage: false - - name: Create Dev Drive (Windows) + - name: Setup Dev Drive (Windows) + if: matrix.os == 'windows-latest' + uses: samypr100/setup-dev-drive@v4 + with: + drive-size: 10GB + drive-type: Dynamic + trusted-dev-drive: true + env-mapping: | + NUGET_PACKAGES,{{ DEV_DRIVE }}/.nuget/packages + + - name: Redirect workspace to Dev Drive (Windows) if: matrix.os == 'windows-latest' shell: pwsh run: | - $ErrorActionPreference = 'Stop' - $vhdPath = 'C:\dev_drive.vhdx' - - # Create and mount VHDX via Hyper-V PowerShell cmdlets (available on GH runners) - New-VHD -Path $vhdPath -SizeBytes 10GB -Dynamic | Out-Null - $disk = Mount-VHD -Path $vhdPath -PassThru | Get-Disk - $disk | Initialize-Disk -PassThru | Out-Null - $part = $disk | New-Partition -AssignDriveLetter -UseMaximumSize - $driveLetter = $part.DriveLetter - - # Try native Dev Drive first (Windows Server 2025+ / 24H2+) - # Gives Defender performance mode, filter optimizations, and CoW block cloning - try { - $part | Format-Volume -DevDrive -Confirm:$false -Force | Out-Null - fsutil devdrv trust "${driveLetter}:" - Write-Host "Formatted ${driveLetter}: as Dev Drive (native)" - } catch { - # Fall back to plain ReFS on older Windows (e.g. Server 2022) - $part | Format-Volume -FileSystem ReFS -NewFileSystemLabel 'Build' -Confirm:$false -Force | Out-Null - Write-Host "Formatted ${driveLetter}: as ReFS (fallback)" - } - - $refsBuildDir = "${driveLetter}:\workspace" + $devDrive = $env:DEV_DRIVE + $refsBuildDir = "$devDrive\workspace" New-Item -Path $refsBuildDir -ItemType Directory -Force | Out-Null - - # Junction the workspace so all subsequent steps transparently use the Dev Drive Remove-Item -Path $env:GITHUB_WORKSPACE -Force -Recurse cmd /c "mklink /J `"$env:GITHUB_WORKSPACE`" `"$refsBuildDir`"" Write-Host "Redirected $env:GITHUB_WORKSPACE -> $refsBuildDir" - # Redirect NuGet package cache to Dev Drive for faster restore/build - $nugetDir = "${driveLetter}:\.nuget\packages" - New-Item -Path $nugetDir -ItemType Directory -Force | Out-Null - "NUGET_PACKAGES=$nugetDir" >> $env:GITHUB_ENV - - uses: actions/checkout@v6 with: fetch-depth: 0 From b27fcc2cc0cd026ce38066e9ab5e6f268ebd9606 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:40:08 +0100 Subject: [PATCH 3/6] feat: enhance workspace redirection for Dev Drive setup on Windows --- .github/workflows/dotnet.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index be28ff5eda..ebf9ea14e7 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -57,6 +57,8 @@ jobs: $devDrive = $env:DEV_DRIVE $refsBuildDir = "$devDrive\workspace" New-Item -Path $refsBuildDir -ItemType Directory -Force | Out-Null + # Move CWD away from workspace so the directory handle is released + Set-Location $devDrive Remove-Item -Path $env:GITHUB_WORKSPACE -Force -Recurse cmd /c "mklink /J `"$env:GITHUB_WORKSPACE`" `"$refsBuildDir`"" Write-Host "Redirected $env:GITHUB_WORKSPACE -> $refsBuildDir" From 1cbf98e03df9e9c413c4946c64333a2f387a772d Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:48:29 +0100 Subject: [PATCH 4/6] feat: update Dev Drive setup for Windows by removing workspace redirection and adjusting cache paths --- .github/workflows/dotnet.yml | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index ebf9ea14e7..2da24a30e7 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -40,33 +40,19 @@ jobs: docker-images: false swap-storage: false + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Setup Dev Drive (Windows) if: matrix.os == 'windows-latest' uses: samypr100/setup-dev-drive@v4 with: drive-size: 10GB - drive-type: Dynamic trusted-dev-drive: true env-mapping: | NUGET_PACKAGES,{{ DEV_DRIVE }}/.nuget/packages - - name: Redirect workspace to Dev Drive (Windows) - if: matrix.os == 'windows-latest' - shell: pwsh - run: | - $devDrive = $env:DEV_DRIVE - $refsBuildDir = "$devDrive\workspace" - New-Item -Path $refsBuildDir -ItemType Directory -Force | Out-Null - # Move CWD away from workspace so the directory handle is released - Set-Location $devDrive - Remove-Item -Path $env:GITHUB_WORKSPACE -Force -Recurse - cmd /c "mklink /J `"$env:GITHUB_WORKSPACE`" `"$refsBuildDir`"" - Write-Host "Redirected $env:GITHUB_WORKSPACE -> $refsBuildDir" - - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Check for .received.txt files shell: bash run: | @@ -100,10 +86,7 @@ jobs: uses: actions/cache@v5 continue-on-error: true with: - path: | - ~/.nuget/packages - ~/.local/share/NuGet - %LocalAppData%\NuGet\v3-cache + path: ${{ env.NUGET_PACKAGES || '~/.nuget/packages' }} key: nuget-${{ runner.os }}-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj') }} restore-keys: | nuget-${{ runner.os }}- From 6cc81740a747a1a489bb7ab374892fd830cbc3f3 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:58:56 +0100 Subject: [PATCH 5/6] feat: enhance Dev Drive setup for Windows by adding environment variables for NuGet packages and temporary files --- .github/workflows/dotnet.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2da24a30e7..88b1158ea1 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,6 +21,8 @@ concurrency: jobs: modularpipeline: environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }} + env: + NUGET_PACKAGES: ~/.nuget/packages strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -52,6 +54,8 @@ jobs: trusted-dev-drive: true env-mapping: | NUGET_PACKAGES,{{ DEV_DRIVE }}/.nuget/packages + TEMP,{{ DEV_DRIVE }}/tmp + TMP,{{ DEV_DRIVE }}/tmp - name: Check for .received.txt files shell: bash @@ -86,7 +90,10 @@ jobs: uses: actions/cache@v5 continue-on-error: true with: - path: ${{ env.NUGET_PACKAGES || '~/.nuget/packages' }} + path: | + ${{ env.NUGET_PACKAGES }} + ~/.local/share/NuGet + %LocalAppData%\NuGet\v3-cache key: nuget-${{ runner.os }}-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj') }} restore-keys: | nuget-${{ runner.os }}- From a9ddf4c0d1155e811469406ac720a8b4a383c1b0 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Tue, 14 Apr 2026 19:09:04 +0100 Subject: [PATCH 6/6] feat: update Dev Drive setup for Windows by adjusting NuGet packages path handling --- .github/workflows/dotnet.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 88b1158ea1..2f2abca08b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,8 +21,6 @@ concurrency: jobs: modularpipeline: environment: ${{ github.ref == 'refs/heads/main' && 'Production' || 'Pull Requests' }} - env: - NUGET_PACKAGES: ~/.nuget/packages strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -91,7 +89,7 @@ jobs: continue-on-error: true with: path: | - ${{ env.NUGET_PACKAGES }} + ${{ env.NUGET_PACKAGES || '~/.nuget/packages' }} ~/.local/share/NuGet %LocalAppData%\NuGet\v3-cache key: nuget-${{ runner.os }}-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj') }}