From e3924aeb5edfd6cbc09d7bb5f99f6404a5e1ba37 Mon Sep 17 00:00:00 2001 From: Mike Rodriguez Date: Thu, 8 Jan 2026 16:09:11 -0800 Subject: [PATCH] Detect and use correct Windows SDK version in CI builds Added steps to both build-and-sign-sequential.yml and ci-validation.yml workflows to dynamically detect the installed Windows Kits version and set the appropriate MSBuild properties for WindowsSdkDir and WindowsTargetPlatformVersion. This ensures the correct SDK is used for driver builds, improving reliability across environments. Also simplified the SignPath submission step condition. --- .../workflows/build-and-sign-sequential.yml | 49 +++++++++++++++++-- .github/workflows/ci-validation.yml | 43 +++++++++++++++- 2 files changed, 85 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-sign-sequential.yml b/.github/workflows/build-and-sign-sequential.yml index 5a1ddf1..fb42f5b 100644 --- a/.github/workflows/build-and-sign-sequential.yml +++ b/.github/workflows/build-and-sign-sequential.yml @@ -47,6 +47,45 @@ jobs: Write-Output "Ensuring Windows Driver Kit is installed (Chocolatey: windowsdriverkit11)..." choco install windowsdriverkit11 -y --no-progress if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + - name: Detect Windows Kits version (UMDF headers) + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + + $kitsRoot = $null + try { + $kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10 + } catch { + $kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\" + } + + if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) { + throw "Windows Kits root not found: $kitsRoot" + } + + $includeRoot = Join-Path $kitsRoot "Include" + if (-not (Test-Path $includeRoot)) { + throw "Windows Kits Include directory not found: $includeRoot" + } + + $candidates = + Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue | + Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } | + Sort-Object -Property Name -Descending + + $best = $candidates | Select-Object -First 1 + if (-not $best) { + throw "Could not find wdf\\umdf\\wudfwdm.h under: $includeRoot" + } + + $kitVersion = $best.Name + $windowsSdkDir = $kitsRoot + + Write-Output "Using WindowsTargetPlatformVersion: $kitVersion" + Write-Output "Using WindowsSdkDir: $windowsSdkDir" + "WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -65,7 +104,7 @@ jobs: $vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln" if (Test-Path $vddSln) { Write-Output "Found VDD solution: $vddSln" - msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal + msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ ARM64 VDD build completed successfully" @@ -99,7 +138,7 @@ jobs: Write-Output "Building ARM64 VAD with validation disabled..." # Build with validation disabled to avoid x86 tool conflicts with ARM64 outputs - msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal + msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ ARM64 VAD build completed successfully!" @@ -127,7 +166,7 @@ jobs: $vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln" if (Test-Path $vddSln) { Write-Output "Found VDD solution: $vddSln" - msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal + msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ x64 VDD build completed successfully" @@ -156,7 +195,7 @@ jobs: $vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln" if (Test-Path $vadSln) { Write-Output "Found VAD solution: $vadSln" - msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal + msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ x64 VAD build completed successfully" @@ -436,7 +475,7 @@ jobs: # STEP 8: Submit to SignPath - name: "Step 8: Submit to SignPath" - if: github.event.inputs.skip_signing != 'true' && secrets.SIGNPATH_API_TOKEN != '' && vars.SIGNPATH_ORG_ID != '' && vars.SIGNPATH_PROJECT_SLUG != '' && vars.SIGNPATH_POLICY_SLUG != '' && steps.upload_for_signpath.outputs.artifact-id != '' + if: github.event.inputs.skip_signing != 'true' && steps.upload_for_signpath.outputs.artifact-id != '' id: signpath_request uses: signpath/github-action-submit-signing-request@v1 with: diff --git a/.github/workflows/ci-validation.yml b/.github/workflows/ci-validation.yml index 2d60ee5..92853ed 100644 --- a/.github/workflows/ci-validation.yml +++ b/.github/workflows/ci-validation.yml @@ -34,6 +34,45 @@ jobs: choco install windowsdriverkit11 -y --no-progress if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Detect Windows Kits version (UMDF headers) + shell: pwsh + run: | + $ErrorActionPreference = "Stop" + + $kitsRoot = $null + try { + $kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10 + } catch { + $kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\" + } + + if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) { + throw "Windows Kits root not found: $kitsRoot" + } + + $includeRoot = Join-Path $kitsRoot "Include" + if (-not (Test-Path $includeRoot)) { + throw "Windows Kits Include directory not found: $includeRoot" + } + + $candidates = + Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue | + Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } | + Sort-Object -Property Name -Descending + + $best = $candidates | Select-Object -First 1 + if (-not $best) { + throw "Could not find wdf\\umdf\\wudfwdm.h under: $includeRoot" + } + + $kitVersion = $best.Name + $windowsSdkDir = $kitsRoot + + Write-Output "Using WindowsTargetPlatformVersion: $kitVersion" + Write-Output "Using WindowsSdkDir: $windowsSdkDir" + "WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -51,7 +90,7 @@ jobs: Write-Output "Performing quick VDD compilation check..." $vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln" if (-not (Test-Path $vddSln)) { throw "VDD solution file not found at: $vddSln" } - msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build + msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal /target:Build - name: Quick VAD Compilation Check shell: pwsh @@ -60,7 +99,7 @@ jobs: Write-Output "Performing quick VAD compilation check..." $vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln" if (-not (Test-Path $vadSln)) { throw "VAD solution file not found at: $vadSln" } - msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build + msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal /target:Build - name: Checkout Virtual Driver Control Repository uses: actions/checkout@v4