Skip to content

Commit 0a31eaa

Browse files
Refactor and add CI workflows for build and validation
Refactored the build-and-sign-sequential workflow to simplify Windows SDK/WDK installation, update MSBuild setup, and improve installer build steps. Added new workflows: build-installer.yml for building the installer independently, and ci-validation.yml for fast CI validation on PRs and pushes. These changes streamline CI processes and separate installer and validation logic for better maintainability.
1 parent 38b6e51 commit 0a31eaa

File tree

3 files changed

+256
-96
lines changed

3 files changed

+256
-96
lines changed

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

Lines changed: 22 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
env:
2424
BUILD_CONFIGURATION: Release
2525

26+
permissions:
27+
contents: read
28+
actions: write
29+
2630
jobs:
2731
# Single Sequential Job - Build everything in specified order
2832
build-sequential:
@@ -34,101 +38,15 @@ jobs:
3438

3539
# Setup build environment
3640
- name: Setup MSBuild
37-
uses: microsoft/setup-msbuild@v1
41+
uses: microsoft/setup-msbuild@v2
3842

39-
- name: Install Visual Studio 2022 dependencies
40-
run: |
41-
Write-Output "Installing Visual Studio 2022 dependencies..."
42-
choco install visualstudio2022-workload-manageddesktop -y
43-
if ($LASTEXITCODE -ne 0) { exit 1 }
44-
45-
choco install visualstudio2022-workload-nativedesktop -y
46-
if ($LASTEXITCODE -ne 0) { exit 1 }
47-
48-
choco install visualstudio2022-workload-vctools -y
49-
if ($LASTEXITCODE -ne 0) { exit 1 }
50-
51-
choco install innosetup -y
52-
if ($LASTEXITCODE -ne 0) { exit 1 }
53-
54-
- name: Install Windows SDK + WDK (required for WDF/UMDF headers)
43+
- name: Install Windows Driver Kit (WDK) for WDF/UMDF headers
5544
shell: pwsh
5645
run: |
5746
$ErrorActionPreference = "Stop"
58-
59-
function Ensure-WingetPackage([string]$Id) {
60-
Write-Output "Checking $Id..."
61-
$listed = (winget list --id $Id -e | Out-String)
62-
if ($listed -match [regex]::Escape($Id)) {
63-
Write-Output "✅ $Id already installed"
64-
return
65-
}
66-
67-
Write-Output "Installing $Id via winget..."
68-
winget install --source winget --exact --id $Id --accept-package-agreements --accept-source-agreements --silent
69-
if ($LASTEXITCODE -ne 0) {
70-
Write-Error "❌ winget install failed for $Id (exit code $LASTEXITCODE)"
71-
exit $LASTEXITCODE
72-
}
73-
Write-Output "✅ Installed $Id"
74-
}
75-
76-
winget --version
77-
78-
# Install matching SDK + WDK (per Microsoft guidance).
79-
# Update these IDs if you intentionally move to another kit version.
80-
Ensure-WingetPackage "Microsoft.WindowsSDK.10.0.26100"
81-
Ensure-WingetPackage "Microsoft.WindowsWDK.10.0.26100"
82-
83-
- name: Detect Windows Kits version (WDF/UMDF headers)
84-
shell: pwsh
85-
run: |
86-
$kitsRoot = $null
87-
try {
88-
$kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
89-
} catch {
90-
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
91-
}
92-
93-
if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
94-
Write-Error "Windows Kits root not found: $kitsRoot"
95-
exit 1
96-
}
97-
98-
$includeRoots =
99-
@((Join-Path $kitsRoot "Include")) | Where-Object { Test-Path $_ }
100-
101-
if (-not $includeRoots -or $includeRoots.Count -eq 0) {
102-
Write-Error "No Windows Kits Include directories found under: $kitsRoot"
103-
exit 1
104-
}
105-
106-
$candidates = foreach ($includeRoot in $includeRoots) {
107-
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
108-
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
109-
ForEach-Object {
110-
[PSCustomObject]@{
111-
Version = $_.Name
112-
IncludeRoot = $includeRoot
113-
}
114-
}
115-
}
116-
117-
$best = $candidates | Sort-Object -Property Version -Descending | Select-Object -First 1
118-
$kitVersion = $best.Version
119-
120-
if (-not $kitVersion) {
121-
Write-Error "Could not find any Windows Kits version containing wdf\umdf\wudfwdm.h under: $kitsRoot"
122-
Write-Output "Discovered Include roots:"
123-
$includeRoots | ForEach-Object { Write-Output ("- " + $_) }
124-
exit 1
125-
}
126-
127-
$windowsSdkDir = (Split-Path $best.IncludeRoot -Parent) + "\"
128-
Write-Output "Using WindowsTargetPlatformVersion: $kitVersion"
129-
Write-Output "Using WindowsSdkDir: $windowsSdkDir"
130-
"WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
131-
"WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
47+
Write-Output "Ensuring Windows Driver Kit is installed (Chocolatey: windowsdriverkit11)..."
48+
choco install windowsdriverkit11 -y --no-progress
49+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
13250
13351
- name: Setup .NET
13452
uses: actions/setup-dotnet@v4
@@ -147,7 +65,7 @@ jobs:
14765
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
14866
if (Test-Path $vddSln) {
14967
Write-Output "Found VDD solution: $vddSln"
150-
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
68+
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal
15169
if ($LASTEXITCODE -eq 0) {
15270
Write-Output "✅ ARM64 VDD build completed successfully"
15371
@@ -181,7 +99,7 @@ jobs:
18199
Write-Output "Building ARM64 VAD with validation disabled..."
182100
183101
# Build with validation disabled to avoid x86 tool conflicts with ARM64 outputs
184-
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
102+
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal
185103
186104
if ($LASTEXITCODE -eq 0) {
187105
Write-Output "✅ ARM64 VAD build completed successfully!"
@@ -209,7 +127,7 @@ jobs:
209127
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
210128
if (Test-Path $vddSln) {
211129
Write-Output "Found VDD solution: $vddSln"
212-
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
130+
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
213131
if ($LASTEXITCODE -eq 0) {
214132
Write-Output "✅ x64 VDD build completed successfully"
215133
@@ -238,7 +156,7 @@ jobs:
238156
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
239157
if (Test-Path $vadSln) {
240158
Write-Output "Found VAD solution: $vadSln"
241-
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
159+
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
242160
if ($LASTEXITCODE -eq 0) {
243161
Write-Output "✅ x64 VAD build completed successfully"
244162
@@ -266,6 +184,7 @@ jobs:
266184
New-Item -ItemType Directory -Path "final-build\ARM64" -Force
267185
New-Item -ItemType Directory -Path "final-build\x64" -Force
268186
New-Item -ItemType Directory -Path "final-build\ControlApp" -Force
187+
New-Item -ItemType Directory -Path "final-build\ControlApp-ARM64" -Force
269188
270189
# Checkout Virtual Driver Control Repository
271190
- name: Checkout Virtual Driver Control Repository
@@ -390,6 +309,13 @@ jobs:
390309
$installerPath = "installer-repo"
391310
if (Test-Path $installerPath) {
392311
Push-Location $installerPath
312+
313+
# Ensure Inno Setup is available for iscc
314+
if (-not (Get-Command iscc -ErrorAction SilentlyContinue)) {
315+
Write-Output "Installing Inno Setup..."
316+
choco install innosetup -y --no-progress
317+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
318+
}
393319
394320
# Generate release tag
395321
$releaseTag = (Get-Date).ToString('yy.MM.dd')
@@ -510,7 +436,7 @@ jobs:
510436

511437
# STEP 8: Submit to SignPath
512438
- name: "Step 8: Submit to SignPath"
513-
if: github.event.inputs.skip_signing != 'true' && steps.upload_for_signpath.outputs.artifact-id != ''
439+
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 != ''
514440
id: signpath_request
515441
uses: signpath/github-action-submit-signing-request@v1
516442
with:
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Build Installer Only
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
installer_variant:
7+
description: 'Installer variant to build'
8+
required: true
9+
default: 'mixed'
10+
type: choice
11+
options:
12+
- mixed
13+
- x64-only
14+
- arm64-only
15+
version_override:
16+
description: 'Override version (format: YY.MM.DD)'
17+
required: false
18+
type: string
19+
schedule:
20+
- cron: '0 6 * * 1' # Weekly on Monday morning
21+
22+
env:
23+
BUILD_CONFIGURATION: Release
24+
25+
permissions:
26+
contents: read
27+
actions: write
28+
29+
jobs:
30+
build-installer:
31+
runs-on: windows-latest
32+
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Version
38+
shell: pwsh
39+
run: |
40+
$version = "${{ github.event.inputs.version_override }}"
41+
if ([string]::IsNullOrEmpty($version)) {
42+
$version = (Get-Date).ToString('yy.MM.dd')
43+
}
44+
"INSTALLER_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
45+
Write-Output "Using version: $version"
46+
47+
$variant = "${{ github.event.inputs.installer_variant }}"
48+
if ([string]::IsNullOrEmpty($variant)) { $variant = "mixed" }
49+
"INSTALLER_VARIANT=$variant" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
50+
Write-Output "Building installer variant: $variant"
51+
52+
- name: Checkout Virtual Driver Installer Repository
53+
uses: actions/checkout@v4
54+
with:
55+
repository: 'VirtualDrivers/Virtual-Driver-Installer'
56+
path: 'installer-repo'
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
continue-on-error: true
59+
60+
- name: Build Installer
61+
shell: pwsh
62+
run: |
63+
$ErrorActionPreference = "Stop"
64+
Write-Output "=== Building Virtual Driver Installer ==="
65+
Write-Output "Variant: $env:INSTALLER_VARIANT"
66+
Write-Output "Version: $env:INSTALLER_VERSION"
67+
68+
if (-not (Test-Path "installer-repo")) {
69+
throw "Installer repository checkout not found (installer-repo)."
70+
}
71+
72+
Push-Location installer-repo
73+
74+
if (-not (Get-Command iscc -ErrorAction SilentlyContinue)) {
75+
Write-Output "Installing Inno Setup..."
76+
choco install innosetup -y --no-progress
77+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
78+
}
79+
80+
if (Test-Path "Setup.iss") {
81+
$setupContent = Get-Content "Setup.iss"
82+
$setupContent = $setupContent -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$env:INSTALLER_VERSION`""
83+
84+
switch ($env:INSTALLER_VARIANT) {
85+
"x64-only" {
86+
$setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-x64-only"
87+
}
88+
"arm64-only" {
89+
$setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-arm64-only"
90+
}
91+
default {
92+
$setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-mixed-platform"
93+
}
94+
}
95+
96+
$setupContent | Set-Content "Setup.iss"
97+
} else {
98+
throw "Setup.iss not found in installer repo."
99+
}
100+
101+
if (Test-Path "build-installer.ps1") {
102+
Write-Output "Running installer preparation script..."
103+
.\build-installer.ps1
104+
}
105+
106+
Write-Output "Compiling installer with Inno Setup..."
107+
iscc Setup.iss
108+
109+
if ($LASTEXITCODE -ne 0) { throw "Inno Setup compilation failed." }
110+
if (-not (Test-Path "output\\*.exe")) { throw "No installer EXE found under output\\." }
111+
112+
$installerFile = Get-ChildItem "output\\*.exe" | Select-Object -First 1
113+
Write-Output "✅ Installer built successfully: $($installerFile.Name)"
114+
"INSTALLER_NAME=$($installerFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
115+
116+
Pop-Location
117+
118+
- name: Upload Installer
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: Virtual-Driver-Installer-${{ env.INSTALLER_VERSION }}-${{ env.INSTALLER_VARIANT }}
122+
path: installer-repo/output/*.exe
123+
retention-days: 30
124+

0 commit comments

Comments
 (0)