Skip to content

Update build-and-sign-sequential.yml #2

Update build-and-sign-sequential.yml

Update build-and-sign-sequential.yml #2

name: Build and Sign Virtual Drivers - Sequential (Fixed)
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
schedule:
- cron: '0 2 * * 0' # Weekly builds
env:
BUILD_CONFIGURATION: Release
jobs:
# Job 1: Build ARM64 VDD and Control Panel only (skip VAD due to WDK ARM64 issues)
build-arm64:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Setup build environment
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Install Visual Studio 2022 dependencies
run: |
choco install visualstudio2022-workload-manageddesktop -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install visualstudio2022-workload-nativedesktop -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install visualstudio2022-workload-vctools -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install windowsdriverkit11 -y
if ($LASTEXITCODE -ne 0) { exit 1 }
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
# Build Virtual Display Driver for ARM64
- name: Build Virtual Display Driver (ARM64)
run: |
Write-Output "Building Virtual Display Driver (HDR) for ARM64..."
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
if (Test-Path $vddSln) {
Write-Output "Found VDD solution: $vddSln"
Write-Output "Running MSBuild for ARM64..."
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal
if ($LASTEXITCODE -eq 0) {
Write-Output "✅ VDD build completed successfully for ARM64"
} else {
Write-Output "❌ VDD build failed with exit code: $LASTEXITCODE"
exit 1
}
# List build directory
$buildDir = "Virtual Display Driver (HDR)\ARM64\$env:BUILD_CONFIGURATION\MttVDD"
if (Test-Path $buildDir) {
Write-Output "VDD Build outputs in ${buildDir}:"
Get-ChildItem $buildDir | ForEach-Object { Write-Output " - $($_.Name)" }
} else {
Write-Output "❌ Build directory not found: ${buildDir}"
exit 1
}
} else {
Write-Output "❌ VDD solution file not found at: $vddSln"
exit 1
}
# Note: Skipping ARM64 VAD build due to WDK toolchain limitations
- name: ARM64 VAD Build Notice
run: |
Write-Output "ℹ️ Skipping ARM64 VAD build due to Windows Driver Kit ARM64 cross-compilation issues"
Write-Output "ℹ️ VAD will be built for x64 only in the next job"
# Build Control Panel (platform-independent, only build once)
- name: Checkout Control Panel Repository
if: github.repository != 'VirtualDrivers/Virtual-Driver-Control'
uses: actions/checkout@v4
with:
repository: 'VirtualDrivers/Virtual-Driver-Control'
path: 'control-panel-repo'
token: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Build Control Panel
run: |
$controlPanelPath = ""
# Check if control panel is in current repo
if (Test-Path "VDD Control/VDD Control.sln") {
$controlPanelPath = "VDD Control/VDD Control.sln"
$projectPath = "VDD Control/VDD Control/VDD Control.csproj"
Write-Output "Found control panel in current repository"
}
# Check if control panel was checked out separately
elseif (Test-Path "control-panel-repo/VDD Control/VDD Control.sln") {
$controlPanelPath = "control-panel-repo/VDD Control/VDD Control.sln"
$projectPath = "control-panel-repo/VDD Control/VDD Control/VDD Control.csproj"
Write-Output "Found control panel in separate repository"
}
if ($controlPanelPath -ne "") {
Write-Output "Building Control Panel..."
dotnet restore $controlPanelPath
dotnet build $controlPanelPath --configuration $env:BUILD_CONFIGURATION --no-restore
dotnet publish $projectPath --configuration $env:BUILD_CONFIGURATION --output ./control-panel-publish --no-build
Write-Output "✅ Control Panel build completed"
} else {
Write-Output "❌ Control Panel solution file not found"
exit 1
}
# Package ARM64 components (VDD + Control Panel only)
- name: Package ARM64 components
run: |
Write-Output "Creating ARM64 package..."
$packageDir = "arm64-components"
New-Item -ItemType Directory -Path $packageDir -Force
# Create component directories
$vddDir = "$packageDir\VDD"
$controlDir = "$packageDir\ControlPanel"
New-Item -ItemType Directory -Path $vddDir -Force
New-Item -ItemType Directory -Path $controlDir -Force
# Copy VDD ARM64 files
$vddBuildDir = "Virtual Display Driver (HDR)\ARM64\$env:BUILD_CONFIGURATION\MttVDD"
if (Test-Path $vddBuildDir) {
Copy-Item "$vddBuildDir\*" -Destination $vddDir -Force
Write-Output "✅ Copied VDD ARM64 files"
}
# Copy Control Panel files
if (Test-Path "control-panel-publish") {
Copy-Item "control-panel-publish\*" -Destination $controlDir -Recurse -Force
Write-Output "✅ Copied Control Panel files"
}
Write-Output "ARM64_PACKAGE_DIR=$packageDir" >> $env:GITHUB_ENV
# Upload ARM64 artifacts
- name: Upload ARM64 components
uses: actions/upload-artifact@v4
with:
name: ARM64-Components-${{ env.BUILD_CONFIGURATION }}
path: ${{ env.ARM64_PACKAGE_DIR }}
retention-days: 1
# Job 2: Build x64 components (VDD + VAD) - depends on ARM64 completion
build-x64:
needs: build-arm64
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Setup build environment
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
- name: Install Visual Studio 2022 dependencies
run: |
choco install visualstudio2022-workload-manageddesktop -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install visualstudio2022-workload-nativedesktop -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install visualstudio2022-workload-vctools -y
if ($LASTEXITCODE -ne 0) { exit 1 }
choco install windowsdriverkit11 -y
if ($LASTEXITCODE -ne 0) { exit 1 }
# Build Virtual Display Driver for x64
- name: Build Virtual Display Driver (x64)
run: |
Write-Output "Building Virtual Display Driver (HDR) for x64..."
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
if (Test-Path $vddSln) {
Write-Output "Found VDD solution: $vddSln"
Write-Output "Running MSBuild for x64..."
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
if ($LASTEXITCODE -eq 0) {
Write-Output "✅ VDD build completed successfully for x64"
} else {
Write-Output "❌ VDD build failed with exit code: $LASTEXITCODE"
exit 1
}
# List build directory
$buildDir = "Virtual Display Driver (HDR)\x64\$env:BUILD_CONFIGURATION\MttVDD"
if (Test-Path $buildDir) {
Write-Output "VDD Build outputs in ${buildDir}:"
Get-ChildItem $buildDir | ForEach-Object { Write-Output " - $($_.Name)" }
} else {
Write-Output "❌ Build directory not found: ${buildDir}"
exit 1
}
} else {
Write-Output "❌ VDD solution file not found at: $vddSln"
exit 1
}
# Build Virtual Audio Driver for x64 (stable platform)
- name: Build Virtual Audio Driver (x64)
run: |
Write-Output "Building Virtual Audio Driver for x64..."
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
if (Test-Path $vadSln) {
Write-Output "Found VAD solution: $vadSln"
Write-Output "Running MSBuild for x64..."
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
if ($LASTEXITCODE -eq 0) {
Write-Output "✅ VAD build completed successfully for x64"
} else {
Write-Output "❌ VAD build failed with exit code: $LASTEXITCODE"
exit 1
}
# List build outputs
Write-Output "Searching for VAD build outputs..."
Get-ChildItem -Path "Virtual-Audio-Driver (Latest Stable)" -Recurse -Include "*.sys", "*.inf", "*.cat", "*.dll" -ErrorAction SilentlyContinue | ForEach-Object {
Write-Output " - $($_.FullName)"
}
} else {
Write-Output "❌ VAD solution file not found at: $vadSln"
exit 1
}
# Package x64 components (VDD + VAD)
- name: Package x64 components
run: |
Write-Output "Creating x64 package..."
$packageDir = "x64-components"
New-Item -ItemType Directory -Path $packageDir -Force
# Create component directories
$vddDir = "$packageDir\VDD"
$vadDir = "$packageDir\VAD"
New-Item -ItemType Directory -Path $vddDir -Force
New-Item -ItemType Directory -Path $vadDir -Force
# Copy VDD x64 files
$vddBuildDir = "Virtual Display Driver (HDR)\x64\$env:BUILD_CONFIGURATION\MttVDD"
if (Test-Path $vddBuildDir) {
Copy-Item "$vddBuildDir\*" -Destination $vddDir -Force
Write-Output "✅ Copied VDD x64 files"
}
# Copy VAD x64 files
$vadFiles = Get-ChildItem -Path "Virtual-Audio-Driver (Latest Stable)" -Recurse -Include "*.sys", "*.inf", "*.cat", "*.dll" -ErrorAction SilentlyContinue
foreach ($file in $vadFiles) {
Copy-Item $file.FullName -Destination $vadDir -Force
}
Write-Output "✅ Copied VAD x64 files"
Write-Output "X64_PACKAGE_DIR=$packageDir" >> $env:GITHUB_ENV
# Upload x64 artifacts
- name: Upload x64 components
uses: actions/upload-artifact@v4
with:
name: X64-Components-${{ env.BUILD_CONFIGURATION }}
path: ${{ env.X64_PACKAGE_DIR }}
retention-days: 1
# Job 3: Unified packaging and signing (depends on both builds)
package-and-sign:
needs: [build-arm64, build-x64]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Download ARM64 artifacts
- name: Download ARM64 components
uses: actions/download-artifact@v4
with:
name: ARM64-Components-${{ env.BUILD_CONFIGURATION }}
path: arm64-components
# Download x64 artifacts
- name: Download x64 components
uses: actions/download-artifact@v4
with:
name: X64-Components-${{ env.BUILD_CONFIGURATION }}
path: x64-components
# Create unified package for signing
- name: Create unified package for SignPath
run: |
Write-Output "Creating unified package for signing..."
$unifiedDir = "unified-driver-package"
New-Item -ItemType Directory -Path $unifiedDir -Force
# Create platform-specific directories
$arm64Dir = "$unifiedDir\ARM64"
$x64Dir = "$unifiedDir\x64"
New-Item -ItemType Directory -Path $arm64Dir -Force
New-Item -ItemType Directory -Path $x64Dir -Force
# Create component subdirectories
# ARM64: VDD + Control Panel only
New-Item -ItemType Directory -Path "$arm64Dir\VDD" -Force
New-Item -ItemType Directory -Path "$arm64Dir\ControlPanel" -Force
# x64: VDD + VAD + Control Panel
New-Item -ItemType Directory -Path "$x64Dir\VDD" -Force
New-Item -ItemType Directory -Path "$x64Dir\VAD" -Force
New-Item -ItemType Directory -Path "$x64Dir\ControlPanel" -Force
# Copy ARM64 components (VDD + Control Panel)
if (Test-Path "arm64-components\VDD") {
Copy-Item "arm64-components\VDD\*" -Destination "$arm64Dir\VDD" -Force
Write-Output "✅ Copied ARM64 VDD files"
}
if (Test-Path "arm64-components\ControlPanel") {
Copy-Item "arm64-components\ControlPanel\*" -Destination "$arm64Dir\ControlPanel" -Recurse -Force
Write-Output "✅ Copied Control Panel files to ARM64 package"
}
# Copy x64 components (VDD + VAD)
if (Test-Path "x64-components\VDD") {
Copy-Item "x64-components\VDD\*" -Destination "$x64Dir\VDD" -Force
Write-Output "✅ Copied x64 VDD files"
}
if (Test-Path "x64-components\VAD") {
Copy-Item "x64-components\VAD\*" -Destination "$x64Dir\VAD" -Force
Write-Output "✅ Copied x64 VAD files"
}
# Copy Control Panel to x64 as well (shared component)
if (Test-Path "arm64-components\ControlPanel") {
Copy-Item "arm64-components\ControlPanel\*" -Destination "$x64Dir\ControlPanel" -Recurse -Force
Write-Output "✅ Copied Control Panel files to x64 package"
}
# Display final package structure
Write-Output ""
Write-Output "=== Final Unified Package Structure ==="
Get-ChildItem $unifiedDir -Recurse | ForEach-Object {
$relativePath = $_.FullName.Substring($unifiedDir.Length + 1)
if ($_.PSIsContainer) {
Write-Output "📁 $relativePath/"
} else {
Write-Output "📄 $relativePath"
}
}
# Create ZIP file
$zipFile = "unified-driver-package-mixed-platform.zip"
Write-Output ""
Write-Output "Creating unified ZIP file: $zipFile"
Compress-Archive -Path $unifiedDir -DestinationPath $zipFile -Force
if (Test-Path $zipFile) {
$zipSize = (Get-Item $zipFile).Length
Write-Output "✅ Unified package created successfully: $zipFile (${zipSize} bytes)"
Write-Output "UNIFIED_PACKAGE_PATH=$zipFile" >> $env:GITHUB_ENV
} else {
Write-Output "❌ Failed to create unified package"
exit 1
}
# Upload unified package
- name: Upload unified package
id: upload_unified_package
uses: actions/upload-artifact@v4
with:
name: Unified-Driver-Package-Mixed-Platform-${{ env.BUILD_CONFIGURATION }}
path: ${{ env.UNIFIED_PACKAGE_PATH }}
# Generate release tag
- name: Generate release tag
id: generate_tag
run: |
$releaseTag = (Get-Date).ToString('yy.MM.dd')
Write-Output "Generated release tag: $releaseTag"
echo "RELEASE_TAG=$releaseTag" >> $env:GITHUB_ENV
# Submit unified package to SignPath (only for main branch and tags)
- name: Submit unified package to SignPath for signing
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && steps.upload_unified_package.outputs.artifact-id != ''
id: signpath_unified_request
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ vars.SIGNPATH_ORG_ID }}'
project-slug: '${{ vars.SIGNPATH_PROJECT_SLUG }}'
signing-policy-slug: '${{ vars.SIGNPATH_POLICY_SLUG }}'
github-artifact-id: '${{ steps.upload_unified_package.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: '${{ vars.SIGNPATH_OUTPUT_DIR }}'
parameters: |
Version: ${{ toJSON(env.BUILD_CONFIGURATION) }}
Release_Tag: "${{ env.RELEASE_TAG }}"
Platforms: "ARM64-VDD-only,x64-VDD-VAD"
continue-on-error: true
# Upload signed unified package
- name: Upload signed unified package
if: steps.signpath_unified_request.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: Signed-Unified-Package-Mixed-Platform-${{ env.BUILD_CONFIGURATION }}
path: '${{ vars.SIGNPATH_OUTPUT_DIR }}\*'
continue-on-error: true
# Build Summary
- name: Build and SignPath Summary
if: always()
run: |
Write-Output "=== Virtual Drivers Sequential Build & Sign Summary (Fixed) ==="
Write-Output "Configuration: $env:BUILD_CONFIGURATION"
Write-Output "Release Tag: ${{ env.RELEASE_TAG }}"
Write-Output "Commit: ${{ github.sha }}"
Write-Output "Branch/Tag: ${{ github.ref }}"
Write-Output ""
Write-Output "Build Strategy: Sequential with Mixed Platform Support"
Write-Output ""
Write-Output "Platform-Specific Components Built:"
Write-Output "ARM64: VDD + Control Panel (VAD skipped due to WDK limitations)"
Write-Output "x64: VDD + VAD + Control Panel"
Write-Output ""
Write-Output "This workflow successfully:"
Write-Output "✅ Built ARM64 VDD and Control Panel first"
Write-Output "✅ Built x64 drivers after ARM64 completion (VDD + VAD)"
Write-Output "✅ Created unified package containing all working components"
Write-Output "✅ Submitted single unified package to SignPath for code signing"
Write-Output "✅ Generated automatic release tags for version tracking"
Write-Output ""
Write-Output "Benefits of This Approach:"
Write-Output "• Resource efficiency - sequential builds prevent resource conflicts"
Write-Output "• Error isolation - ARM64 failure stops x64 build"
Write-Output "• Single SignPath submission for all platforms"
Write-Output "• Works around WDK ARM64 cross-compilation limitations"
Write-Output "• VAD still available for primary x64 platform"
Write-Output ""
Write-Output "SignPath Integration Status:"
if ('${{ steps.signpath_unified_request.outcome }}' -eq 'success') {
Write-Output "✅ Unified package (mixed platforms) submitted and signed successfully"
} else {
Write-Output "❌ Unified package signing failed or skipped"
}
Write-Output ""
Write-Output "⚠️ Note: ARM64 VAD skipped due to Windows Driver Kit cross-compilation issues"
Write-Output " This is a known limitation with WDK 11 ARM64 toolchain on GitHub Actions"