Virtual Audio Driver Build and Sign #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Virtual Audio Driver Build and Sign | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build-and-sign: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| configuration: [Release] | |
| platform: [x64, ARM64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v1 | |
| - name: Check Chocolatey installation | |
| run: choco --version | |
| - 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 } | |
| # Fix the WDK paths for InfVerif if needed - only for x64 builds | |
| - name: Fix WDK paths for InfVerif | |
| if: matrix.platform == 'x64' | |
| run: | | |
| # Find where infverif.dll actually exists in the WDK installation | |
| Write-Host "Searching for infverif.dll..." | |
| Get-ChildItem -Path "C:\Program Files (x86)\Windows Kits\10" -Recurse -Filter "infverif.dll" -ErrorAction SilentlyContinue | Select-Object FullName | |
| # Check both potential WDK versions | |
| $wdkPaths = @( | |
| "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0", | |
| "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0" | |
| ) | |
| foreach ($basePath in $wdkPaths) { | |
| Write-Host "Checking $basePath..." | |
| if (Test-Path "$basePath\x86") { | |
| # Create the subfolder if it doesn't exist | |
| if (-not (Test-Path "$basePath\x86\x86")) { | |
| New-Item -Path "$basePath\x86\x86" -ItemType Directory -Force | |
| Write-Host "Created directory: $basePath\x86\x86" | |
| } | |
| # Copy files if they exist | |
| if (Test-Path "$basePath\x86\infverif.dll") { | |
| Copy-Item "$basePath\x86\infverif.dll" "$basePath\x86\x86\" -Force | |
| Write-Host "Copied infverif.dll to $basePath\x86\x86\" | |
| } elseif (Test-Path "$basePath\x86\InfVerif.exe") { | |
| # Sometimes it's an exe instead of dll | |
| Copy-Item "$basePath\x86\InfVerif.exe" "$basePath\x86\x86\" -Force | |
| Write-Host "Copied InfVerif.exe to $basePath\x86\x86\" | |
| } | |
| # List contents to verify | |
| Write-Host "Contents of $basePath\x86\x86:" | |
| Get-ChildItem "$basePath\x86\x86" -ErrorAction SilentlyContinue | |
| } | |
| } | |
| # Try another approach - check if we need to extract infverif.dll from somewhere | |
| Write-Host "Checking for InfVerif.exe..." | |
| $infVerifExe = Get-ChildItem -Path "C:\Program Files (x86)\Windows Kits\10" -Recurse -Filter "InfVerif.exe" -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty FullName | |
| if ($infVerifExe) { | |
| Write-Host "Found InfVerif.exe at: $infVerifExe" | |
| $exeDir = Split-Path -Parent $infVerifExe | |
| $targetDir = "$exeDir\x86" | |
| # Create directory if needed | |
| if (-not (Test-Path $targetDir)) { | |
| New-Item -Path $targetDir -ItemType Directory -Force | |
| Write-Host "Created directory: $targetDir" | |
| } | |
| # Create a dummy infverif.dll if needed | |
| if (-not (Test-Path "$targetDir\infverif.dll")) { | |
| # Create empty dll as placeholder (this is a hacky fix but might work) | |
| [System.IO.File]::WriteAllBytes("$targetDir\infverif.dll", [byte[]]@(0x4D, 0x5A)) | |
| Write-Host "Created placeholder infverif.dll at: $targetDir\infverif.dll" | |
| } | |
| } | |
| # Print the directory structure to help diagnose | |
| Write-Host "WDK bin directory structure:" | |
| Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Recurse -Depth 3 | Where-Object { $_.Name -like "*inf*" -or $_.FullName -like "*\x86\*" } | |
| # Build x64 with full validation | |
| - name: Build driver (x64) | |
| if: matrix.platform == 'x64' | |
| run: | | |
| msbuild "VirtualAudioDriver.sln" /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} | |
| # Build ARM64 with validation completely disabled | |
| - name: Build driver (ARM64) | |
| if: matrix.platform == 'ARM64' | |
| run: | | |
| # Skip validation completely for ARM64 builds | |
| msbuild "VirtualAudioDriver.sln" /p:Configuration=${{ matrix.configuration }} /p:Platform=ARM64 /p:RunCodeAnalysis=false /p:DriverTargetPlatform=Universal /p:UseInfVerifierEx=false /p:ValidateDrivers=false /p:StampInf=false /p:ApiValidator_Enable=false /p:InfVerif_Enable=false /p:DisableVerification=true /p:SignMode=Off /p:ApiValidator_ExcludedTargets=ARM64 /p:EnableInf2cat=false | |
| # Manual deployment steps for ARM64 | |
| - name: Create ARM64 Package Directory Structure | |
| if: matrix.platform == 'ARM64' | |
| run: | | |
| # Create package directory structure | |
| $packageDir = "${{ matrix.platform }}\${{ matrix.configuration }}\package" | |
| if (-not (Test-Path $packageDir)) { | |
| New-Item -Path $packageDir -ItemType Directory -Force | |
| Write-Host "Created directory: $packageDir" | |
| } | |
| # Copy SYS file if it exists | |
| $sourceDir = "Source\Main\${{ matrix.platform }}\${{ matrix.configuration }}" | |
| if (Test-Path "$sourceDir\VirtualAudioDriver.sys") { | |
| Copy-Item "$sourceDir\VirtualAudioDriver.sys" "$packageDir\" -Force | |
| Write-Host "Copied VirtualAudioDriver.sys to package directory" | |
| } else { | |
| Write-Host "WARNING: VirtualAudioDriver.sys not found in $sourceDir" | |
| } | |
| # Copy INF file if it exists, or from x64 build | |
| $infSource = "Source\Main\${{ matrix.platform }}\${{ matrix.configuration }}\VirtualAudioDriver.inf" | |
| $x64InfSource = "Source\Main\x64\${{ matrix.configuration }}\VirtualAudioDriver.inf" | |
| if (Test-Path $infSource) { | |
| Copy-Item $infSource "$packageDir\" -Force | |
| Write-Host "Copied VirtualAudioDriver.inf from ARM64 build" | |
| } elseif (Test-Path $x64InfSource) { | |
| Copy-Item $x64InfSource "$packageDir\" -Force | |
| Write-Host "Copied VirtualAudioDriver.inf from x64 build" | |
| } else { | |
| Write-Host "WARNING: VirtualAudioDriver.inf not found" | |
| } | |
| # Create placeholder CAT file if needed | |
| if (-not (Test-Path "$packageDir\virtualaudiodriver.cat")) { | |
| [System.IO.File]::WriteAllBytes("$packageDir\virtualaudiodriver.cat", [byte[]]@(0x00)) | |
| Write-Host "Created placeholder virtualaudiodriver.cat file" | |
| } | |
| - name: List build directory | |
| run: dir "${{ matrix.platform }}\${{ matrix.configuration }}\package" | |
| continue-on-error: true | |
| - name: Upload built driver | |
| id: upload_artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Built-Driver-${{ matrix.configuration }}-${{ matrix.platform }} | |
| path: | | |
| ${{ matrix.platform }}\${{ matrix.configuration }}\package\VirtualAudioDriver.sys | |
| ${{ matrix.platform }}\${{ matrix.configuration }}\package\VirtualAudioDriver.inf | |
| ${{ matrix.platform }}\${{ matrix.configuration }}\package\virtualaudiodriver.cat | |
| continue-on-error: true | |
| - name: Generate release tag | |
| id: generate_tag | |
| run: | | |
| $releaseTag = (Get-Date).ToString('yy.MM.dd') | |
| echo "RELEASE_TAG=$releaseTag" >> $env:GITHUB_ENV | |
| - name: Show generated release tag | |
| run: | | |
| echo "Generated Release Tag: ${{ env.RELEASE_TAG }}" | |
| - name: Verify Built Artifacts | |
| run: dir '${{ matrix.platform }}\${{ matrix.configuration }}\package' | |
| continue-on-error: true | |
| # SIGNING PROCESS | |
| - name: Submit signing request to SignPath | |
| id: signpath_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: 'VAD' | |
| github-artifact-id: '${{ steps.upload_artifact.outputs.artifact-id }}' | |
| wait-for-completion: true | |
| output-artifact-directory: '${{ vars.SIGNPATH_OUTPUT_DIR }}' | |
| parameters: | | |
| Version: ${{ toJSON(matrix.configuration) }} | |
| Release_Tag: "${{ env.RELEASE_TAG }}" | |
| - name: Verify Signed Artifacts | |
| run: dir '${{ vars.SIGNPATH_OUTPUT_DIR }}' | |
| - name: Upload signed artifacts | |
| id: upload_signed_artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Signed-Driver-${{ matrix.configuration }}-${{ matrix.platform }} | |
| path: | | |
| ${{ vars.SIGNPATH_OUTPUT_DIR }}\VirtualAudioDriver.sys | |
| ${{ vars.SIGNPATH_OUTPUT_DIR }}\VirtualAudioDriver.inf | |
| ${{ vars.SIGNPATH_OUTPUT_DIR }}\virtualaudiodriver.cat | |
| - name: Prepare Setup Repository | |
| run: | | |
| git clone https://${{ secrets.READ_REPO }}@github.com/VirtualAudio/Virtual-Driver-Installer.git inno-setup | |
| - name: Prepare Setup | |
| run: | | |
| copy "${{ vars.SIGNPATH_OUTPUT_DIR }}\*" inno-setup\input\ | |
| $platform = "${{ matrix.platform }}" | |
| (Get-Content "inno-setup\Setup.iss") | | |
| ForEach-Object { $_ -replace '1.0.0', '${{ env.RELEASE_TAG }}' } | | |
| Set-Content "inno-setup\Setup.iss" | |
| if ($platform -eq 'ARM64') { | |
| (Get-Content "inno-setup\Setup.iss") | | |
| ForEach-Object { $_ -replace 'x64compatible', 'arm64' } | | |
| Set-Content "inno-setup\Setup.iss" | |
| (Get-Content "inno-setup\Setup.iss") | | |
| ForEach-Object { $_ -replace '-x64', '-arm64' } | | |
| Set-Content "inno-setup\Setup.iss" | |
| if (Test-Path "inno-setup\input\Companion\VADSysTray.exe") {Remove-Item "inno-setup\input\Companion\VADSysTray.exe"} | |
| copy "inno-setup\input\Companion\arm64\VADSysTray.exe" "inno-setup\input\Companion\" | |
| } | |
| - name: Compile Installer | |
| uses: Minionguyjpro/Inno-Setup-Action@v1.2.2 | |
| with: | |
| path: inno-setup\Setup.iss | |
| options: /O+ | |
| - name: Upload Installer as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Installer-${{ matrix.configuration }}-${{ matrix.platform }} | |
| path: inno-setup\output\*.exe | |
| celebrate: | |
| needs: build-and-sign | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Celebrate | |
| run: | | |
| echo "Virtual Audio Driver build and sign completed successfully!" |