Skip to content

Commit ea8c879

Browse files
Improve WDK header detection in CI workflows
Update PowerShell logic in build-and-sign-sequential.yml and ci-validation.yml to handle both flat and versioned WDK header layouts. This ensures compatibility with different runner environments by checking for headers in both possible locations.
1 parent fe157ea commit ea8c879

File tree

2 files changed

+48
-10
lines changed

2 files changed

+48
-10
lines changed

.github/workflows/build-and-sign-sequential.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,37 @@ jobs:
5757
$includeRoot = Join-Path $kitsRoot "Include"
5858
if (-not (Test-Path $includeRoot)) { return $null }
5959
60-
$best =
60+
# Some runners lay WDK headers out as:
61+
# Include\wdf\umdf\wudfwdm.h
62+
# Others as:
63+
# Include\<version>\wdf\umdf\wudfwdm.h
64+
$flatHeader = Join-Path $includeRoot "wdf\umdf\wudfwdm.h"
65+
66+
$versionDirs =
6167
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
68+
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
69+
Sort-Object -Property Name -Descending
70+
71+
$bestVersion = $versionDirs | Select-Object -First 1
72+
$bestWithHeader =
73+
$versionDirs |
6274
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
63-
Sort-Object -Property Name -Descending |
6475
Select-Object -First 1
6576
66-
if (-not $best) { return $null }
77+
if (Test-Path $flatHeader) {
78+
return [PSCustomObject]@{
79+
WindowsSdkDir = $kitsRoot
80+
WindowsTargetPlatformVersion = $bestVersion.Name
81+
HeaderPath = $flatHeader
82+
}
83+
}
84+
85+
if (-not $bestWithHeader) { return $null }
6786
6887
return [PSCustomObject]@{
6988
WindowsSdkDir = $kitsRoot
70-
WindowsTargetPlatformVersion = $best.Name
71-
HeaderPath = (Join-Path $best.FullName "wdf\umdf\wudfwdm.h")
89+
WindowsTargetPlatformVersion = $bestWithHeader.Name
90+
HeaderPath = (Join-Path $bestWithHeader.FullName "wdf\umdf\wudfwdm.h")
7291
}
7392
}
7493

.github/workflows/ci-validation.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,37 @@ jobs:
4444
$includeRoot = Join-Path $kitsRoot "Include"
4545
if (-not (Test-Path $includeRoot)) { return $null }
4646
47-
$best =
47+
# Some runners lay WDK headers out as:
48+
# Include\wdf\umdf\wudfwdm.h
49+
# Others as:
50+
# Include\<version>\wdf\umdf\wudfwdm.h
51+
$flatHeader = Join-Path $includeRoot "wdf\umdf\wudfwdm.h"
52+
53+
$versionDirs =
4854
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
55+
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
56+
Sort-Object -Property Name -Descending
57+
58+
$bestVersion = $versionDirs | Select-Object -First 1
59+
$bestWithHeader =
60+
$versionDirs |
4961
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
50-
Sort-Object -Property Name -Descending |
5162
Select-Object -First 1
5263
53-
if (-not $best) { return $null }
64+
if (Test-Path $flatHeader) {
65+
return [PSCustomObject]@{
66+
WindowsSdkDir = $kitsRoot
67+
WindowsTargetPlatformVersion = $bestVersion.Name
68+
HeaderPath = $flatHeader
69+
}
70+
}
71+
72+
if (-not $bestWithHeader) { return $null }
5473
5574
return [PSCustomObject]@{
5675
WindowsSdkDir = $kitsRoot
57-
WindowsTargetPlatformVersion = $best.Name
58-
HeaderPath = (Join-Path $best.FullName "wdf\umdf\wudfwdm.h")
76+
WindowsTargetPlatformVersion = $bestWithHeader.Name
77+
HeaderPath = (Join-Path $bestWithHeader.FullName "wdf\umdf\wudfwdm.h")
5978
}
6079
}
6180

0 commit comments

Comments
 (0)