forked from ge9/IddSampleDriver
-
-
Notifications
You must be signed in to change notification settings - Fork 366
204 lines (169 loc) · 8.19 KB
/
ci-validation.yml
File metadata and controls
204 lines (169 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: Build Virtual Display Driver
on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]
paths-ignore:
- '**.md'
- 'docs/**'
- 'LICENSE*'
workflow_dispatch:
env:
BUILD_CONFIGURATION: Release
VDD_SOLUTION: Virtual Display Driver (HDR)/MttVDD.sln
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform: [x64, ARM64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Install Windows Driver Kit (IddCx headers)
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
choco install windowsdriverkit11 -y --no-progress
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Detect Windows SDK (windows.h)
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"
}
$best =
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
Where-Object { Test-Path (Join-Path $_.FullName "um\Windows.h") } |
Sort-Object -Property Name -Descending |
Select-Object -First 1
if (-not $best) {
throw "Could not find an SDK version directory containing um\\Windows.h under: $includeRoot"
}
$sdkVersion = $best.Name
Write-Output "Using WindowsSdkDir: $kitsRoot"
Write-Output "Using WindowsTargetPlatformVersion: $sdkVersion"
"WINDOWS_SDK_DIR=$kitsRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"WINDOWS_TARGET_PLATFORM_VERSION=$sdkVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build VDD (${{ matrix.platform }})
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$sln = "${{ env.VDD_SOLUTION }}"
if (-not (Test-Path $sln)) { throw "VDD solution file not found at: $sln" }
# Pick an available UMDF WDF header version on the runner.
# Kits can be laid out either versioned:
# Include\<sdk>\wdf\umdf\2.xx
# or unversioned:
# Include\wdf\umdf\2.xx
$umdfRoots = @(
(Join-Path $env:WINDOWS_SDK_DIR ("Include\" + $env:WINDOWS_TARGET_PLATFORM_VERSION + "\wdf\umdf")),
(Join-Path $env:WINDOWS_SDK_DIR "Include\wdf\umdf")
) | Where-Object { Test-Path $_ }
if (-not $umdfRoots -or $umdfRoots.Count -eq 0) {
throw "UMDF WDF include root not found under $env:WINDOWS_SDK_DIR (tried versioned + unversioned layouts)"
}
$umdfBest =
$umdfRoots |
ForEach-Object { Get-ChildItem -Path $_ -Directory -ErrorAction SilentlyContinue } |
Where-Object { $_.Name -match '^\d+\.\d+$' } |
Sort-Object -Property Name -Descending |
Select-Object -First 1
if (-not $umdfBest) { throw "No UMDF version directories found under: $($umdfRoots -join ', ')" }
$umdfMinor = ($umdfBest.Name -split '\.')[1]
Write-Output "Using UMDF version: $($umdfBest.Name) (minor=$umdfMinor) from $($umdfBest.FullName)"
function Get-VersionOrZero([string]$value) {
try {
return [version]$value
} catch {
return [version]"0.0"
}
}
$platformLibSegment = switch ("${{ matrix.platform }}") {
"x64" { "x64" }
"ARM64" { "arm64" }
"ARM" { "arm" }
default { "${{ matrix.platform }}".ToLowerInvariant() }
}
$iddcxInclude =
Get-ChildItem -Path (Join-Path $env:WINDOWS_SDK_DIR "Include") -Recurse -Filter "IddCx.h" -ErrorAction SilentlyContinue |
Where-Object { $_.DirectoryName -match '\\iddcx\\\d+\.\d+$' } |
Sort-Object -Property `
@{ Expression = { Get-VersionOrZero ([regex]::Match($_.FullName, '\\(\d+\.\d+\.\d+\.\d+)\\').Groups[1].Value) }; Descending = $true }, `
@{ Expression = { Get-VersionOrZero $_.Directory.Name }; Descending = $true } |
Select-Object -First 1
if (-not $iddcxInclude) {
throw "IddCx include directory not found anywhere under $env:WINDOWS_SDK_DIR\Include"
}
$iddcxLibPattern = "\\um\\" + [regex]::Escape($platformLibSegment) + "\\iddcx\\\d+\.\d+$"
$iddcxLib =
Get-ChildItem -Path (Join-Path $env:WINDOWS_SDK_DIR "Lib") -Recurse -Filter "IddCxStub.lib" -ErrorAction SilentlyContinue |
Where-Object { $_.DirectoryName -match $iddcxLibPattern } |
Sort-Object -Property `
@{ Expression = { Get-VersionOrZero ([regex]::Match($_.FullName, '\\(\d+\.\d+\.\d+\.\d+)\\').Groups[1].Value) }; Descending = $true }, `
@{ Expression = { Get-VersionOrZero $_.Directory.Name }; Descending = $true } |
Select-Object -First 1
if (-not $iddcxLib) {
throw "IddCxStub.lib not found for platform $platformLibSegment anywhere under $env:WINDOWS_SDK_DIR\Lib"
}
$baseUmLibPattern = "\\um\\" + [regex]::Escape($platformLibSegment) + "$"
$baseUmLib =
Get-ChildItem -Path (Join-Path $env:WINDOWS_SDK_DIR "Lib") -Recurse -Filter "wpprecorderum.lib" -ErrorAction SilentlyContinue |
Where-Object { $_.DirectoryName -match $baseUmLibPattern } |
Sort-Object -Property `
@{ Expression = { Get-VersionOrZero ([regex]::Match($_.FullName, '\\(\d+\.\d+\.\d+\.\d+)\\').Groups[1].Value) }; Descending = $true } |
Select-Object -First 1
if (-not $baseUmLib) {
throw "Base UM library directory not found for platform $platformLibSegment under $env:WINDOWS_SDK_DIR\Lib"
}
Write-Output "Using IddCx include: $($iddcxInclude.Directory.FullName)"
Write-Output "Using IddCx lib: $($iddcxLib.Directory.FullName)"
Write-Output "Using base UM lib dir: $($baseUmLib.Directory.FullName)"
msbuild $sln `
/m `
/t:Build `
/p:Configuration="${{ env.BUILD_CONFIGURATION }}" `
/p:Platform="${{ matrix.platform }}" `
/p:WindowsSdkDir="$env:WINDOWS_SDK_DIR" `
/p:WindowsTargetPlatformVersion="$env:WINDOWS_TARGET_PLATFORM_VERSION" `
/p:TargetPlatformVersion="$env:WINDOWS_TARGET_PLATFORM_VERSION" `
/p:UMDF_VERSION_MINOR="$umdfMinor" `
/p:VddIddCxIncludeDir="$($iddcxInclude.Directory.FullName)" `
/p:VddIddCxLibDir="$($iddcxLib.Directory.FullName)" `
/p:VddBaseUmLibDir="$($baseUmLib.Directory.FullName)" `
/p:EnableInfVerif=false `
/p:RunApiValidator=false `
/verbosity:minimal
- name: Collect outputs
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$outDir = "Virtual Display Driver (HDR)\${{ matrix.platform }}\${{ env.BUILD_CONFIGURATION }}\MttVDD"
if (-not (Test-Path $outDir)) { throw "Build output directory not found: $outDir" }
$dest = "artifacts\VDD\${{ matrix.platform }}"
New-Item -ItemType Directory -Path $dest -Force | Out-Null
Copy-Item "$outDir\*" -Destination $dest -Recurse -Force
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: VDD-${{ matrix.platform }}-${{ env.BUILD_CONFIGURATION }}
path: artifacts/VDD/${{ matrix.platform }}/
if-no-files-found: error