From 47793bed280c05095ce7aa8247f571fa17a956ce Mon Sep 17 00:00:00 2001 From: Krishna Kumar Thokala Date: Wed, 9 Jul 2025 15:53:17 +0000 Subject: [PATCH 01/40] ci: add ARM64 Windows runner support to workflows - Add windows-latest-arm64 runners alongside windows-latest - Update build, test, lint, and local-development-makefile workflows - Simplify lint and local-development workflows by removing target_triple matrix - fix wdm-driver test for linker error on arm64 hosts - This fixes the following linker error on arm64 hosts `fatal error LNK1130: Linker miscalc (base relocations off by 0x20)` --- .github/actions/winget-install/action.yaml | 27 ++++++++++++++++--- .github/workflows/build.yaml | 23 +++++++++++----- .github/workflows/lint.yaml | 23 +++++++++++----- .../workflows/local-development-makefile.yaml | 23 +++++++++++----- .github/workflows/test.yaml | 23 +++++++++++----- crates/cargo-wdk/templates/wdm/lib.rs.tmp | 4 +++ crates/cargo-wdk/tests/wdm-driver/src/lib.rs | 4 +++ 7 files changed, 100 insertions(+), 27 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index a10a986e0..142f53c87 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -12,6 +12,10 @@ runs: run: | $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } + # Detect runner architecture + $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } + Write-Host "Detected architecture: $Architecture" + $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566' $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } @@ -23,20 +27,37 @@ runs: # Save output for next step Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV + Write-Output "Architecture=$Architecture" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies shell: pwsh run: | New-Item -Type Directory $env:RUNNER_TEMP/winget-install - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx - Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx # Needed per https://github.com/microsoft/winget-cli/blob/21de1607ed5c90174e6bb931406975c18681a5dd/README.md?plain=1#L35C19-L35C19 + + # Download architecture-specific dependencies + if ($env:Architecture -eq "arm64") { + Write-Host "Downloading ARM64 dependencies..." + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.arm64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.arm64.appx + Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.arm64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.arm64.14.00.Desktop.appx + } else { + Write-Host "Downloading x64 dependencies..." + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx + Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx + } + + # Download winget and license (architecture-agnostic) Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml - name: Start Winget Installation for all Users shell: pwsh run: | - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx + # Use architecture-specific dependency paths + if ($env:Architecture -eq "arm64") { + Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.arm64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.arm64.14.00.Desktop.appx + } else { + Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx + } - name: Install Winget for Current User (for better install diagnostics) shell: powershell diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d9c823056..f0ec18384 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,10 +19,13 @@ env: jobs: build: name: Build - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - windows-latest + - windows-11-arm + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -46,6 +49,8 @@ jobs: arch: amd64 - name: aarch64-pc-windows-msvc arch: arm64 + + runs-on: ${{ matrix.runner }} steps: - name: Checkout Repository @@ -58,12 +63,18 @@ jobs: - name: Install LLVM ${{ matrix.llvm }} run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 } + clang --version - name: Install WDK (${{ matrix.wdk.version }}) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3ce57ff6d..dba6e5ece 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,12 +18,15 @@ env: jobs: clippy: name: Clippy - runs-on: windows-latest permissions: checks: write strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - windows-latest + - windows-11-arm + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -47,6 +50,8 @@ jobs: arch: amd64 - name: aarch64-pc-windows-msvc arch: arm64 + + runs-on: ${{ matrix.runner }} steps: - name: Checkout Repository @@ -59,12 +64,18 @@ jobs: - name: Install LLVM ${{ matrix.llvm }} run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 } + clang --version - name: Install WDK (${{ matrix.wdk.version }}) diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index ae05ee366..37a41b843 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -17,10 +17,13 @@ env: jobs: build: name: Test WDR's local cargo-make Makefile - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - windows-latest + - windows-11-arm + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -36,6 +39,8 @@ jobs: # - name: aarch64-pc-windows-msvc FIXME: validate on aarch64 # arch: arm64 + + runs-on: ${{ matrix.runner }} steps: - name: Checkout Repository @@ -48,12 +53,18 @@ jobs: - name: Install LLVM ${{ matrix.llvm }} run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 } + clang --version - name: Install WDK (${{ matrix.wdk.version }}) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7638a3ba5..1ecf99685 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,10 +14,13 @@ concurrency: jobs: test: name: Test - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - windows-latest + - windows-11-arm + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -41,6 +44,8 @@ jobs: arch: amd64 # - aarch64-pc-windows-msvc FIXME: Add support for executing ARM64 tests. Maybe use target specific test runner in emulator: https://doc.rust-lang.org/cargo/reference/config.html#target + runs-on: ${{ matrix.runner }} + steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -52,12 +57,18 @@ jobs: - name: Install LLVM ${{ matrix.llvm }} run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 } + clang --version - name: Install WDK (${{ matrix.wdk.version }}) diff --git a/crates/cargo-wdk/templates/wdm/lib.rs.tmp b/crates/cargo-wdk/templates/wdm/lib.rs.tmp index 3c1699a7b..b3f5eb210 100644 --- a/crates/cargo-wdk/templates/wdm/lib.rs.tmp +++ b/crates/cargo-wdk/templates/wdm/lib.rs.tmp @@ -16,10 +16,14 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +extern crate alloc; +use alloc::ffi::CString; + #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { + let _string = CString::new("Hello World!\n").unwrap(); 0 } diff --git a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs index 3c1699a7b..b3f5eb210 100644 --- a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs @@ -16,10 +16,14 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; +extern crate alloc; +use alloc::ffi::CString; + #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { + let _string = CString::new("Hello World!\n").unwrap(); 0 } From d9f93241d604583dd572dd3af518a6996cef9d23 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 30 Jul 2025 18:52:18 +0530 Subject: [PATCH 02/40] ci: adapt for nuget wdk changes --- .github/actions/winget-install/action.yaml | 2 ++ .github/workflows/build.yaml | 22 ++++++++++++++----- .github/workflows/lint.yaml | 14 +++++++----- .../workflows/local-development-makefile.yaml | 17 +++++++------- .github/workflows/test.yaml | 13 ++++++----- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index 142f53c87..8c67bc9d4 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -54,8 +54,10 @@ runs: run: | # Use architecture-specific dependency paths if ($env:Architecture -eq "arm64") { + Write-Host "Starting ARM64 winget installation..." Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.arm64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.arm64.14.00.Desktop.appx } else { + Write-Host "Starting x64 winget installation..." Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx } diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f0ec18384..584b304dc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,8 +23,10 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - windows-latest - - windows-11-arm + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 wdk: - version: 10.0.22621 # NI WDK @@ -50,17 +52,27 @@ jobs: - name: aarch64-pc-windows-msvc arch: arm64 - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 + - uses: msys2/setup-msys2@v2 + id: setup-msys2 + - name: Install Winget uses: ./.github/actions/winget-install with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + - name: Install LLVM ${{ matrix.llvm }} run: | # Use native winget.exe instead of PowerShell module for ARM64 compatibility @@ -82,7 +94,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) @@ -109,7 +121,7 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - # Run cargo-wdk on examples + # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index dba6e5ece..0409cce41 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,8 +24,10 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - windows-latest - - windows-11-arm + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 wdk: - version: 10.0.22621 # NI WDK @@ -50,8 +52,8 @@ jobs: arch: amd64 - name: aarch64-pc-windows-msvc arch: arm64 - - runs-on: ${{ matrix.runner }} + + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository @@ -83,7 +85,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) @@ -94,7 +96,7 @@ jobs: targets: ${{ matrix.target_triple.name }} - name: Run Cargo Clippy - run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-targets --all-features + run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features unused_deps: name: Detect Unused Cargo Dependencies diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 37a41b843..2fdcd4418 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -21,8 +21,10 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - windows-latest - - windows-11-arm + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 wdk: - version: 10.0.22621 # NI WDK @@ -36,11 +38,10 @@ jobs: target_triple: - name: x86_64-pc-windows-msvc arch: amd64 - # - name: aarch64-pc-windows-msvc FIXME: validate on aarch64 - # arch: arm64 - - - runs-on: ${{ matrix.runner }} + - name: aarch64-pc-windows-msvc + arch: arm64 + + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository @@ -72,7 +73,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Nightly Rust Toolchain (${{ matrix.target_triple.name }}) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1ecf99685..b0c4c0cb7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,8 +18,10 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - windows-latest - - windows-11-arm + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 wdk: - version: 10.0.22621 # NI WDK @@ -42,9 +44,10 @@ jobs: target_triple: - name: x86_64-pc-windows-msvc arch: amd64 - # - aarch64-pc-windows-msvc FIXME: Add support for executing ARM64 tests. Maybe use target specific test runner in emulator: https://doc.rust-lang.org/cargo/reference/config.html#target + - name: aarch64-pc-windows-msvc + arch: arm64 - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository @@ -76,7 +79,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 86f6cb7d7f3cb6ab4e34c41b440bb64c0ef2104d Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 30 Jul 2025 22:50:35 +0530 Subject: [PATCH 03/40] ci: replace winget install with powershell script --- .github/workflows/build.yaml | 19 +++++++------------ .github/workflows/lint.yaml | 11 ++++++++--- .../workflows/local-development-makefile.yaml | 11 ++++++++--- .github/workflows/test.yaml | 11 ++++++++--- 4 files changed, 31 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 584b304dc..3322746db 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -58,20 +58,15 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - uses: msys2/setup-msys2@v2 - id: setup-msys2 + # - name: Install Winget + # uses: ./.github/actions/winget-install + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Winget - uses: ./.github/actions/winget-install - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + run: | + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0409cce41..31065df76 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -59,10 +59,15 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + # - name: Install Winget + # uses: ./.github/actions/winget-install + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Winget - uses: ./.github/actions/winget-install - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 2fdcd4418..02a038440 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -47,10 +47,15 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + # - name: Install Winget + # uses: ./.github/actions/winget-install + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Winget - uses: ./.github/actions/winget-install - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b0c4c0cb7..6de2d50a6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -53,10 +53,15 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + # - name: Install Winget + # uses: ./.github/actions/winget-install + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Winget - uses: ./.github/actions/winget-install - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | From a1113a73c157ea7f37d5a45385de22fdcc06c13a Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 30 Jul 2025 23:09:03 +0530 Subject: [PATCH 04/40] ci: remove unnecessary targets from certain workflows --- .github/actions/install-wdk/action.yml | 1 + .../workflows/local-development-makefile.yaml | 17 ++++------------- .github/workflows/test.yaml | 11 ++--------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 3493eb388..42821a429 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -26,6 +26,7 @@ runs: $targetArch = '${{ inputs.target }}' switch ($targetArch) { 'amd64' { $targetArch = 'x64' } + 'x64' { $targetArch = 'x64' } 'arm64' { $targetArch = 'ARM64' } default { Write-Error "Invalid target architecture: $targetArch. Supported architectures are 'x64' and 'arm64'." diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 02a038440..28cde25af 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,12 +35,6 @@ jobs: llvm: - 17.0.6 - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - - name: aarch64-pc-windows-msvc - arch: arm64 - runs-on: ${{ matrix.runner.name }} steps: @@ -79,25 +73,22 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.target_triple.arch }} + target: ${{ matrix.runner.arch }} - - name: Install Nightly Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Nightly Rust Toolchain uses: dtolnay/rust-toolchain@nightly with: components: clippy, rustfmt - targets: ${{ matrix.target_triple.name }} - - name: Install Beta Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Beta Rust Toolchain uses: dtolnay/rust-toolchain@beta with: components: clippy - targets: ${{ matrix.target_triple.name }} - - name: Install Stable Rust Toolchain (${{ matrix.target_triple.name }}) + - name: Install Stable Rust Toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy - targets: ${{ matrix.target_triple.name }} - name: Install Cargo Make uses: taiki-e/install-action@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6de2d50a6..6f1cc6277 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,12 +41,6 @@ jobs: - dev - release - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - - name: aarch64-pc-windows-msvc - arch: arm64 - runs-on: ${{ matrix.runner.name }} steps: @@ -85,13 +79,12 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.target_triple.arch }} + target: ${{ matrix.runner.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} - targets: ${{ matrix.target_triple.name }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -99,4 +92,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features From 4922ef932e8074b6b4e8bf00dc999ddd780c88fa Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 31 Jul 2025 08:27:09 +0530 Subject: [PATCH 05/40] debug: add PATH env variable printing and include tmate --- .github/workflows/build.yaml | 10 ++++++++++ crates/wdk-build/rust-driver-makefile.toml | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3322746db..36b3dd92b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,6 +63,9 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: msys2/setup-msys2@v2 + id: setup-msys2 + - name: Install Winget run: | Install-Script winget-install -Force @@ -116,6 +119,13 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/crates/wdk-build/rust-driver-makefile.toml b/crates/wdk-build/rust-driver-makefile.toml index a6e6fc0dc..c216e09fa 100644 --- a/crates/wdk-build/rust-driver-makefile.toml +++ b/crates/wdk-build/rust-driver-makefile.toml @@ -51,6 +51,11 @@ cli_args = array_join ${flow.cli.args} " " combined_args = concat ${cli_args} " " ${task_args} combined_args = trim ${combined_args} +# Debug: Print PATH before executing rust-script +echo "=== DEBUG: PATH Before rust-script execution ===" +echo "PATH: ${PATH}" +echo "==============================================" + # Execute rust-script out = exec --fail-on-error rust-script --base-path ${taskjson.env.CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY} ${CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY}/cargo-make-script/${task.name}/rust-env-update.rs %{combined_args} assert_eq ${out.code} 0 "[tasks.${task.name}]'s script failed with exit code: ${out.code}\nstdout:\n${out.stdout}\nstderr:\n${out.stderr}\nThe temporary rust-script file is located at ${CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY}/cargo-make-script/${task.name}/rust-env-update.rs" @@ -91,7 +96,13 @@ if not is_empty ${script_output} end end end + assert ${looking_for_start_delimiter} "A matching \"END OF FORWARDING ARGS TO CARGO-MAKE\" for a \"FORWARDING ARGS TO CARGO-MAKE:\" was not found in script output." + + # Debug: Print final PATH state after all env var updates + echo "=== DEBUG: Final PATH State ===" + echo "PATH: ${PATH}" + echo "==============================" end ''' From 631e3019c88cd0f37fa557d4dad587a5078d0a3e Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 31 Jul 2025 16:15:39 +0530 Subject: [PATCH 06/40] debug: install winget using recommended method --- .github/workflows/build.yaml | 40 ++++++++++++++----- .github/workflows/lint.yaml | 14 ++++++- .../workflows/local-development-makefile.yaml | 14 ++++++- .github/workflows/test.yaml | 14 ++++++- 4 files changed, 67 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 36b3dd92b..836a1011f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,10 +66,39 @@ jobs: - uses: msys2/setup-msys2@v2 id: setup-msys2 + # - name: Install Winget + # run: | + # Install-Script winget-install -Force + # winget-install -Force + - name: Install Winget + if: ${{ matrix.runner.arch == 'arm64' }} run: | - Install-Script winget-install -Force - winget-install -Force + $progressPreference = 'silentlyContinue' + Write-Host "Request WinGet registration..." + Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager -AllUsers + Write-Host "Done." + + - name: Install Winget + if: ${{ matrix.runner.arch == 'x64' }} + run: | + $progressPreference = 'silentlyContinue' + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager -AllUsers + Write-Host "Done." + + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} - name: Install LLVM ${{ matrix.llvm }} run: | @@ -119,13 +148,6 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} - # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 31065df76..0098eb307 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -64,10 +64,20 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Install Winget + # run: | + # Install-Script winget-install -Force + # winget-install -Force + - name: Install Winget run: | - Install-Script winget-install -Force - winget-install -Force + $progressPreference = 'silentlyContinue' + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-PackageProvider -Name NuGet -Force | Out-Null + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager -AllUsers + Write-Host "Done." - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 28cde25af..3e72ab226 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -46,10 +46,20 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Install Winget + # run: | + # Install-Script winget-install -Force + # winget-install -Force + - name: Install Winget run: | - Install-Script winget-install -Force - winget-install -Force + $progressPreference = 'silentlyContinue' + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-PackageProvider -Name NuGet -Force | Out-Null + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager -AllUsers + Write-Host "Done." - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6f1cc6277..bf53a2088 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,10 +52,20 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Install Winget + # run: | + # Install-Script winget-install -Force + # winget-install -Force + - name: Install Winget run: | - Install-Script winget-install -Force - winget-install -Force + $progressPreference = 'silentlyContinue' + Write-Host "Installing WinGet PowerShell module from PSGallery..." + Install-PackageProvider -Name NuGet -Force | Out-Null + Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null + Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." + Repair-WinGetPackageManager -AllUsers + Write-Host "Done." - name: Install LLVM ${{ matrix.llvm }} run: | From 165ce4706aa751c66f1b9d0b5514938f10683b3b Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 31 Jul 2025 18:45:18 +0530 Subject: [PATCH 07/40] Revert "debug: install winget using recommended method" This reverts commit ce29c77a999667185020f901921c5327d451c7ac. --- .github/workflows/build.yaml | 40 +++++-------------- .github/workflows/lint.yaml | 14 +------ .../workflows/local-development-makefile.yaml | 14 +------ .github/workflows/test.yaml | 14 +------ 4 files changed, 15 insertions(+), 67 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 836a1011f..36b3dd92b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -66,39 +66,10 @@ jobs: - uses: msys2/setup-msys2@v2 id: setup-msys2 - # - name: Install Winget - # run: | - # Install-Script winget-install -Force - # winget-install -Force - - name: Install Winget - if: ${{ matrix.runner.arch == 'arm64' }} run: | - $progressPreference = 'silentlyContinue' - Write-Host "Request WinGet registration..." - Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager -AllUsers - Write-Host "Done." - - - name: Install Winget - if: ${{ matrix.runner.arch == 'x64' }} - run: | - $progressPreference = 'silentlyContinue' - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager -AllUsers - Write-Host "Done." - - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | @@ -148,6 +119,13 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0098eb307..31065df76 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -64,20 +64,10 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Install Winget - # run: | - # Install-Script winget-install -Force - # winget-install -Force - - name: Install Winget run: | - $progressPreference = 'silentlyContinue' - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-PackageProvider -Name NuGet -Force | Out-Null - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager -AllUsers - Write-Host "Done." + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 3e72ab226..28cde25af 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -46,20 +46,10 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Install Winget - # run: | - # Install-Script winget-install -Force - # winget-install -Force - - name: Install Winget run: | - $progressPreference = 'silentlyContinue' - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-PackageProvider -Name NuGet -Force | Out-Null - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager -AllUsers - Write-Host "Done." + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf53a2088..6f1cc6277 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,20 +52,10 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: Install Winget - # run: | - # Install-Script winget-install -Force - # winget-install -Force - - name: Install Winget run: | - $progressPreference = 'silentlyContinue' - Write-Host "Installing WinGet PowerShell module from PSGallery..." - Install-PackageProvider -Name NuGet -Force | Out-Null - Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null - Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..." - Repair-WinGetPackageManager -AllUsers - Write-Host "Done." + Install-Script winget-install -Force + winget-install -Force - name: Install LLVM ${{ matrix.llvm }} run: | From 5436c8db287598ebeac4ca77cdbf2011ac9e276e Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 31 Jul 2025 18:45:28 +0530 Subject: [PATCH 08/40] Revert "debug: add PATH env variable printing and include tmate" This reverts commit b469a667887df06115bf8d6af3044739efc564eb. --- .github/workflows/build.yaml | 10 ---------- crates/wdk-build/rust-driver-makefile.toml | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 36b3dd92b..3322746db 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,9 +63,6 @@ jobs: # with: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: msys2/setup-msys2@v2 - id: setup-msys2 - - name: Install Winget run: | Install-Script winget-install -Force @@ -119,13 +116,6 @@ jobs: - name: Package Examples (via Cargo Make) run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} - # Run cargo-wdk on examples and tests - name: Install cargo-wdk run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force diff --git a/crates/wdk-build/rust-driver-makefile.toml b/crates/wdk-build/rust-driver-makefile.toml index c216e09fa..a6e6fc0dc 100644 --- a/crates/wdk-build/rust-driver-makefile.toml +++ b/crates/wdk-build/rust-driver-makefile.toml @@ -51,11 +51,6 @@ cli_args = array_join ${flow.cli.args} " " combined_args = concat ${cli_args} " " ${task_args} combined_args = trim ${combined_args} -# Debug: Print PATH before executing rust-script -echo "=== DEBUG: PATH Before rust-script execution ===" -echo "PATH: ${PATH}" -echo "==============================================" - # Execute rust-script out = exec --fail-on-error rust-script --base-path ${taskjson.env.CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY} ${CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY}/cargo-make-script/${task.name}/rust-env-update.rs %{combined_args} assert_eq ${out.code} 0 "[tasks.${task.name}]'s script failed with exit code: ${out.code}\nstdout:\n${out.stdout}\nstderr:\n${out.stderr}\nThe temporary rust-script file is located at ${CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY}/cargo-make-script/${task.name}/rust-env-update.rs" @@ -96,13 +91,7 @@ if not is_empty ${script_output} end end end - assert ${looking_for_start_delimiter} "A matching \"END OF FORWARDING ARGS TO CARGO-MAKE\" for a \"FORWARDING ARGS TO CARGO-MAKE:\" was not found in script output." - - # Debug: Print final PATH state after all env var updates - echo "=== DEBUG: Final PATH State ===" - echo "PATH: ${PATH}" - echo "==============================" end ''' From 8ead94fa51609cb743f193e4fb0a908287314434 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 31 Jul 2025 19:20:28 +0530 Subject: [PATCH 09/40] ci: skip certain jobs/steps when WDK is 10.0.22621 and runner is arm64 as certain binaries are missing --- .github/workflows/build.yaml | 11 ++++++----- .github/workflows/lint.yaml | 5 ----- .github/workflows/local-development-makefile.yaml | 14 +++++++++----- .github/workflows/test.yaml | 14 +++++++++----- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3322746db..af2bb1f5f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -58,11 +58,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - # - name: Install Winget - # uses: ./.github/actions/winget-install - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget run: | Install-Script winget-install -Force @@ -114,6 +109,8 @@ jobs: run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - name: Package Examples (via Cargo Make) + # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries + if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} # Run cargo-wdk on examples and tests @@ -121,9 +118,13 @@ jobs: run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force - name: Build & Package Examples (via cargo-wdk) + # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries + if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample working-directory: ./examples - name: Run build on tests folder (via cargo-wdk) + # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries + if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} working-directory: ./tests diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 31065df76..33787fc18 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -59,11 +59,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - # - name: Install Winget - # uses: ./.github/actions/winget-install - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget run: | Install-Script winget-install -Force diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 28cde25af..5941915f6 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,17 +35,21 @@ jobs: llvm: - 17.0.6 + # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + exclude: + - runner: + name: windows-11-arm + arch: arm64 + wdk: + version: 10.0.22621 + source: winget + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 - # - name: Install Winget - # uses: ./.github/actions/winget-install - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget run: | Install-Script winget-install -Force diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6f1cc6277..435b7ebca 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,17 +41,21 @@ jobs: - dev - release + # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + exclude: + - runner: + name: windows-11-arm + arch: arm64 + wdk: + version: 10.0.22621 + source: winget + runs-on: ${{ matrix.runner.name }} steps: - name: Checkout Repository uses: actions/checkout@v4 - # - name: Install Winget - # uses: ./.github/actions/winget-install - # with: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget run: | Install-Script winget-install -Force From 0c2f54433a3e316ecd5ec1d5d286a707926f302c Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Tue, 5 Aug 2025 16:28:17 +0530 Subject: [PATCH 10/40] ci: move to older way of installing winget --- .github/workflows/build.yaml | 6 ++--- .github/workflows/codeql.yaml | 24 ++++++++++++------- .github/workflows/docs.yaml | 16 +++++++++---- .github/workflows/lint.yaml | 10 ++++---- .../workflows/local-development-makefile.yaml | 10 ++++---- .github/workflows/test.yaml | 10 ++++---- 6 files changed, 44 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index af2bb1f5f..bd82a9fad 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -59,9 +59,9 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - run: | - Install-Script winget-install -Force - winget-install -Force + uses: ./.github/actions/winget-install + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} run: | diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 47ece59a9..7360e6c8e 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -59,15 +59,21 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install LLVM ${{ matrix.llvm }} - run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force - } - clang --version + - name: Install LLVM ${{ matrix.llvm }} + run: | + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 + } + + clang --version - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 91f019ab8..0242cd65b 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -56,12 +56,18 @@ jobs: - name: Install LLVM ${{ matrix.llvm }} run: | - if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ matrix.llvm }}') { - Write-Host "LLVM ${{ matrix.llvm }} is already installed." - } else { - Write-Host "Installing LLVM ${{ matrix.llvm }}..." - Install-WinGetPackage -Id LLVM.LLVM -Version ${{ matrix.llvm }} -Source winget -MatchOption Equals -Mode Silent -Force + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 } + clang --version - name: Install WDK (${{ matrix.wdk.version }}) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 33787fc18..e8819092b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -60,19 +60,19 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - run: | - Install-Script winget-install -Force - winget-install -Force + uses: ./.github/actions/winget-install + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} run: | # Use native winget.exe instead of PowerShell module for ARM64 compatibility Write-Host "Checking for existing LLVM installation..." winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - + if ($LASTEXITCODE -ne 0) { Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" exit 1 diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 5941915f6..daddd89b1 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -51,19 +51,19 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - run: | - Install-Script winget-install -Force - winget-install -Force + uses: ./.github/actions/winget-install + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} run: | # Use native winget.exe instead of PowerShell module for ARM64 compatibility Write-Host "Checking for existing LLVM installation..." winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - + if ($LASTEXITCODE -ne 0) { Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" exit 1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 435b7ebca..fe67bba3a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -57,19 +57,19 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - run: | - Install-Script winget-install -Force - winget-install -Force + uses: ./.github/actions/winget-install + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} run: | # Use native winget.exe instead of PowerShell module for ARM64 compatibility Write-Host "Checking for existing LLVM installation..." winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - + if ($LASTEXITCODE -ne 0) { Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" exit 1 From 9e99c458967b799dc5c2b649eeebd6d22be97dd2 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Tue, 5 Aug 2025 17:12:20 +0530 Subject: [PATCH 11/40] debug: modify winget-install to install latest winget using different approach --- .github/actions/winget-install/action.yaml | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index 8c67bc9d4..cb660f5c0 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -16,49 +16,52 @@ runs: $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } Write-Host "Detected architecture: $Architecture" - $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566' + # winget-cli release v1.8.1911 + # $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566' + + # winget-cli release v1.11.400 + $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/226250169' $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } + $WingetDependenciesZipUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('DesktopAppInstaller_Dependencies.zip') } # Print to logs Write-Host "WingetDownloadUri=$WingetDownloadUri" Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" + Write-Host "WingetDependenciesZipUri=$WingetDependenciesZipUri" # Save output for next step Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV Write-Output "Architecture=$Architecture" >> $env:GITHUB_ENV + Write-Output "WingetDependenciesZipUri=$WingetDependenciesZipUri" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies shell: pwsh run: | New-Item -Type Directory $env:RUNNER_TEMP/winget-install - # Download architecture-specific dependencies - if ($env:Architecture -eq "arm64") { - Write-Host "Downloading ARM64 dependencies..." - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.arm64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.arm64.appx - Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.arm64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.arm64.14.00.Desktop.appx - } else { - Write-Host "Downloading x64 dependencies..." - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx - Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx - } - # Download winget and license (architecture-agnostic) Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipUri -OutFile $env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip + + Expand-Archive -Path "$env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:RUNNER_TEMP/winget-install/ -Force - name: Start Winget Installation for all Users shell: pwsh run: | # Use architecture-specific dependency paths if ($env:Architecture -eq "arm64") { - Write-Host "Starting ARM64 winget installation..." - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.arm64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.arm64.14.00.Desktop.appx + [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/arm64" -Filter '*.appx' -File -Force).FullName + Write-Host "Found Dependency $($DependencyPaths[0])" + Write-Host "Found Dependency $($DependencyPaths[1])" + Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$($DependencyPaths[0])", "$($DependencyPaths[1])" } else { - Write-Host "Starting x64 winget installation..." - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath $env:RUNNER_TEMP/winget-install/Microsoft.UI.Xaml.2.8.x64.appx, $env:RUNNER_TEMP/winget-install/Microsoft.VCLibs.x64.14.00.Desktop.appx + [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/x64" -Filter '*.appx' -File -Force).FullName + Write-Host "Found Dependency $($DependencyPaths[0])" + Write-Host "Found Dependency $($DependencyPaths[1])" + Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$($DependencyPaths[0])", "$($DependencyPaths[1])" } - name: Install Winget for Current User (for better install diagnostics) From 9eff661f3d3f69676b6b85dd85786f8ec3666559 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Tue, 5 Aug 2025 22:30:17 +0530 Subject: [PATCH 12/40] ci: add arm64 support for codeql and doc workflows --- .github/workflows/codeql.yaml | 35 +++++++++++++++++++++-------------- .github/workflows/docs.yaml | 12 +++++++++--- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 7360e6c8e..6a3a7b481 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -14,12 +14,17 @@ concurrency: jobs: analyze: name: Analyze - runs-on: windows-latest permissions: security-events: write strategy: fail-fast: false matrix: + runner: + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -50,6 +55,8 @@ jobs: - language: rust build-mode: none + runs-on: ${{ matrix.runner.name }} + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -59,28 +66,28 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + - name: Install LLVM ${{ matrix.llvm }} + run: | + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Checking for existing LLVM installation..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." + winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" + exit 1 + } - clang --version + clang --version - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 0242cd65b..e2eb9e5c4 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -17,10 +17,15 @@ env: jobs: docs: name: Docs - runs-on: windows-latest strategy: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: + runner: + - name: windows-latest + arch: x64 + - name: windows-11-arm + arch: arm64 + wdk: - version: 10.0.22621 # NI WDK source: winget @@ -45,6 +50,8 @@ jobs: - name: aarch64-pc-windows-msvc arch: arm64 + runs-on: ${{ matrix.runner.name }} + steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -75,7 +82,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) @@ -89,6 +96,5 @@ jobs: run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --workspace --exclude wdk-macros --all-features - name: Run Cargo Doc w/ proc-macro crates - if: matrix.target_triple.name == 'x86_64-pc-windows-msvc' # cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677 run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --all-features From b827dc5fcf257511e06e326a1ae530fa7503e486 Mon Sep 17 00:00:00 2001 From: Krishna Kumar Thokala Date: Tue, 5 Aug 2025 23:55:16 +0530 Subject: [PATCH 13/40] Update crates/cargo-wdk/tests/wdm-driver/src/lib.rs Prevent linker optimisation on arm64. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Krishna Kumar Thokala --- crates/cargo-wdk/tests/wdm-driver/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs index b3f5eb210..bc69c2364 100644 --- a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs @@ -18,12 +18,14 @@ static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; extern crate alloc; use alloc::ffi::CString; +use core::hint::black_box; #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { - let _string = CString::new("Hello World!\n").unwrap(); + // Prevent optimization: ensure allocator is linked (workaround for ARM64 linker issues) + black_box(CString::new("Hello World!\n").unwrap()); 0 } From f2fe66dd38657305b765850e844d14ba8785a2a9 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 10:07:44 +0530 Subject: [PATCH 14/40] ci: add --all-targets back to cargo clippy and remove old comment --- .github/actions/winget-install/action.yaml | 3 --- .github/workflows/lint.yaml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index cb660f5c0..ec4e18f4c 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -16,9 +16,6 @@ runs: $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } Write-Host "Detected architecture: $Architecture" - # winget-cli release v1.8.1911 - # $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/164835566' - # winget-cli release v1.11.400 $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/226250169' $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e8819092b..e79b8d7da 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -96,7 +96,7 @@ jobs: targets: ${{ matrix.target_triple.name }} - name: Run Cargo Clippy - run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features + run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-targets --all-features unused_deps: name: Detect Unused Cargo Dependencies From 23b9b41e8d20407ff787a5bb1b78b0a1e6e0c018 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 12:27:19 +0530 Subject: [PATCH 15/40] debug: add target_triple back to test and local-development-makefile for understanding the error --- .github/workflows/local-development-makefile.yaml | 14 +++++++++++++- .github/workflows/test.yaml | 12 ++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index daddd89b1..b124ddc1a 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,6 +35,12 @@ jobs: llvm: - 17.0.6 + target_triple: + - name: x86_64-pc-windows-msvc + arch: amd64 + - name: aarch64-pc-windows-msvc + arch: arm64 + # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries exclude: - runner: @@ -77,22 +83,28 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.runner.arch }} + target: ${{ matrix.target_triple.arch }} - name: Install Nightly Rust Toolchain uses: dtolnay/rust-toolchain@nightly with: components: clippy, rustfmt + targets: | + ${{ matrix.target_triple.name }} - name: Install Beta Rust Toolchain uses: dtolnay/rust-toolchain@beta with: components: clippy + targets: | + ${{ matrix.target_triple.name }} - name: Install Stable Rust Toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy + targets: | + ${{ matrix.target_triple.name }} - name: Install Cargo Make uses: taiki-e/install-action@v2 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fe67bba3a..1e2b1dc17 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,6 +41,12 @@ jobs: - dev - release + target_triple: + - name: x86_64-pc-windows-msvc + arch: amd64 + - name: aarch64-pc-windows-msvc + arch: arm64 + # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries exclude: - runner: @@ -83,12 +89,14 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.runner.arch }} + target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} + targets: | + ${{ matrix.target_triple.name }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -96,4 +104,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features From 119f307d619fbc196db8da55df38d032aa493bc8 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 15:47:53 +0530 Subject: [PATCH 16/40] ci: revert arm64 support for codeql --- .github/workflows/codeql.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 6a3a7b481..ff89416fe 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -14,17 +14,12 @@ concurrency: jobs: analyze: name: Analyze + runs-on: windows-latest permissions: security-events: write strategy: fail-fast: false matrix: - runner: - - name: windows-latest - arch: x64 - - name: windows-11-arm - arch: arm64 - wdk: - version: 10.0.22621 # NI WDK source: winget @@ -55,8 +50,6 @@ jobs: - language: rust build-mode: none - runs-on: ${{ matrix.runner.name }} - steps: - name: Checkout repository uses: actions/checkout@v4 @@ -87,7 +80,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: ${{ matrix.runner.arch }} + host: 'x64' # windows-latest is x64-based target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 1ea966236a2107eb44c30af5bb0e34f71989dd2d Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 16:41:52 +0530 Subject: [PATCH 17/40] ci: revert target_triple from test workflow --- .github/workflows/test.yaml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1e2b1dc17..fe67bba3a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,12 +41,6 @@ jobs: - dev - release - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - - name: aarch64-pc-windows-msvc - arch: arm64 - # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries exclude: - runner: @@ -89,14 +83,12 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.target_triple.arch }} + target: ${{ matrix.runner.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} - targets: | - ${{ matrix.target_triple.name }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -104,4 +96,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features From 6df0f873f7cde4bafcd539e0b2ecf297875fcd54 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 17:41:57 +0530 Subject: [PATCH 18/40] ci: revert target_triple from wdk-pre-commit-hook workflow --- .github/workflows/local-development-makefile.yaml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index b124ddc1a..daddd89b1 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,12 +35,6 @@ jobs: llvm: - 17.0.6 - target_triple: - - name: x86_64-pc-windows-msvc - arch: amd64 - - name: aarch64-pc-windows-msvc - arch: arm64 - # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries exclude: - runner: @@ -83,28 +77,22 @@ jobs: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} host: ${{ matrix.runner.arch }} - target: ${{ matrix.target_triple.arch }} + target: ${{ matrix.runner.arch }} - name: Install Nightly Rust Toolchain uses: dtolnay/rust-toolchain@nightly with: components: clippy, rustfmt - targets: | - ${{ matrix.target_triple.name }} - name: Install Beta Rust Toolchain uses: dtolnay/rust-toolchain@beta with: components: clippy - targets: | - ${{ matrix.target_triple.name }} - name: Install Stable Rust Toolchain uses: dtolnay/rust-toolchain@stable with: components: clippy - targets: | - ${{ matrix.target_triple.name }} - name: Install Cargo Make uses: taiki-e/install-action@v2 From 5ae1a14d27b55fe936a50e382351c813be410492 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 18:24:34 +0530 Subject: [PATCH 19/40] ci: centralized cert tools present check to env var in build workflow --- .github/workflows/build.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bd82a9fad..b673b925e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,6 +54,10 @@ jobs: runs-on: ${{ matrix.runner.name }} + env: + # WDK 10.0.22621 installed via winget channel on ARM64 runner doesn't ship certmgr and makecert binaries + CERT_TOOLS_PRESENT: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} + steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -109,8 +113,7 @@ jobs: run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - name: Package Examples (via Cargo Make) - # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries - if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} + if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} # Run cargo-wdk on examples and tests @@ -118,13 +121,11 @@ jobs: run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force - name: Build & Package Examples (via cargo-wdk) - # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries - if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} + if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample working-directory: ./examples - name: Run build on tests folder (via cargo-wdk) - # Skip this step when WDK 10.0.22621 is used with ARM64 runner as it doesn't ship certmgr and makecert binaries - if: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} + if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} working-directory: ./tests From 55d5a5c7c32cc2a8db990065e5aa8cad69ee20d2 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 19:29:39 +0530 Subject: [PATCH 20/40] ci: make arch names consistent in workflows --- .github/actions/install-wdk/action.yml | 21 +++++++++++-------- .github/workflows/build.yaml | 2 +- .github/workflows/codeql.yaml | 2 +- .github/workflows/docs.yaml | 2 +- .github/workflows/lint.yaml | 2 +- .../workflows/local-development-makefile.yaml | 2 +- .github/workflows/test.yaml | 2 +- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 42821a429..3a5618d0e 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -22,17 +22,20 @@ runs: - name: Install WDK shell: pwsh run: | - $hostArch = '${{ inputs.host }}' - $targetArch = '${{ inputs.target }}' - switch ($targetArch) { - 'amd64' { $targetArch = 'x64' } - 'x64' { $targetArch = 'x64' } - 'arm64' { $targetArch = 'ARM64' } - default { - Write-Error "Invalid target architecture: $targetArch. Supported architectures are 'x64' and 'arm64'." - exit 1 + # Function to normalize architecture names + function Normalize-Architecture($arch) { + switch ($arch.ToLower()) { + 'amd64' { return 'x64' } + 'arm64' { return 'arm64' } + default { + Write-Error "Invalid architecture: $arch. Supported architectures are 'amd64' and 'arm64'." + exit 1 + } } } + + $hostArch = Normalize-Architecture '${{ inputs.host }}' + $targetArch = Normalize-Architecture '${{ inputs.target }}' $inputVersion = '${{ inputs.version }}' if ($inputVersion -notmatch '^10\.0\.\d{5}(\.\d{1,4})?$') { diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b673b925e..e8b605059 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,7 +24,7 @@ jobs: matrix: runner: - name: windows-latest - arch: x64 + arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index ff89416fe..7649dbea0 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -80,7 +80,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'x64' # windows-latest is x64-based + host: 'amd64' # windows-latest is x64-based target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index e2eb9e5c4..d61f6a960 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -22,7 +22,7 @@ jobs: matrix: runner: - name: windows-latest - arch: x64 + arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e79b8d7da..a7cf25636 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -25,7 +25,7 @@ jobs: matrix: runner: - name: windows-latest - arch: x64 + arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index daddd89b1..c4c50c897 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -22,7 +22,7 @@ jobs: matrix: runner: - name: windows-latest - arch: x64 + arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fe67bba3a..671e68f5d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: matrix: runner: - name: windows-latest - arch: x64 + arch: amd64 - name: windows-11-arm arch: arm64 From c7746335ca162545603349734eb3ca357d9f6735 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 21:42:38 +0530 Subject: [PATCH 21/40] ci: moved LLVM installation to an action --- .github/actions/install-llvm/action.yml | 27 +++++++++++++++++++ .github/workflows/build.yaml | 17 +++--------- .github/workflows/codeql.yaml | 17 +++--------- .github/workflows/docs.yaml | 17 +++--------- .github/workflows/lint.yaml | 17 +++--------- .../workflows/local-development-makefile.yaml | 17 +++--------- .github/workflows/test.yaml | 17 +++--------- 7 files changed, 45 insertions(+), 84 deletions(-) create mode 100644 .github/actions/install-llvm/action.yml diff --git a/.github/actions/install-llvm/action.yml b/.github/actions/install-llvm/action.yml new file mode 100644 index 000000000..8f342f4ed --- /dev/null +++ b/.github/actions/install-llvm/action.yml @@ -0,0 +1,27 @@ +name: Install LLVM + +inputs: + version: + description: "LLVM version to install" + required: true + +runs: + using: "composite" + steps: + - name: Install LLVM ${{ inputs.version }} + shell: pwsh + run: | + # Use native winget.exe instead of PowerShell module for ARM64 compatibility + Write-Host "Existing LLVM installation(s):..." + winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity + + Write-Host "Force Installing LLVM ${{ inputs.version }}..." + winget install --id LLVM.LLVM --version ${{ inputs.version }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity + + if ($LASTEXITCODE -ne 0) { + Write-Error "LLVM ${{ inputs.version }} force installation failed with exit code: $LASTEXITCODE" + exit 1 + } + + Write-Host "Verifying LLVM installation..." + clang --version diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e8b605059..f291361c7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,20 +68,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 7649dbea0..745a9fa6c 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -60,20 +60,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index d61f6a960..b0279dda7 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -62,20 +62,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a7cf25636..5f6ea9f14 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -65,20 +65,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index c4c50c897..7f38fa244 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -56,20 +56,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 671e68f5d..379f7d709 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -62,20 +62,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install LLVM ${{ matrix.llvm }} - run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Checking for existing LLVM installation..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ matrix.llvm }}..." - winget install --id LLVM.LLVM --version ${{ matrix.llvm }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ matrix.llvm }} force installation failed with exit code: $LASTEXITCODE" - exit 1 - } - - clang --version + uses: ./.github/actions/install-llvm + with: + version: ${{ matrix.llvm }} - name: Install WDK (${{ matrix.wdk.version }}) uses: ./.github/actions/install-wdk From 9f2480aecba92096c6e477343c477c758d4d02d3 Mon Sep 17 00:00:00 2001 From: Krishna Kumar Thokala Date: Wed, 6 Aug 2025 21:44:32 +0530 Subject: [PATCH 22/40] Apply suggestion from @gurry Co-authored-by: Gurinder Singh Signed-off-by: Krishna Kumar Thokala --- crates/cargo-wdk/templates/wdm/lib.rs.tmp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cargo-wdk/templates/wdm/lib.rs.tmp b/crates/cargo-wdk/templates/wdm/lib.rs.tmp index b3f5eb210..a8d3235bf 100644 --- a/crates/cargo-wdk/templates/wdm/lib.rs.tmp +++ b/crates/cargo-wdk/templates/wdm/lib.rs.tmp @@ -24,6 +24,6 @@ pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { - let _string = CString::new("Hello World!\n").unwrap(); + let _ = CString::new("Hello World!\n").unwrap(); 0 } From 3648b0a29e4dba6585828d7034099ac8326a28cb Mon Sep 17 00:00:00 2001 From: Krishna Kumar Thokala Date: Wed, 6 Aug 2025 21:46:23 +0530 Subject: [PATCH 23/40] Apply suggestion from @gurry Co-authored-by: Gurinder Singh Signed-off-by: Krishna Kumar Thokala --- .github/actions/winget-install/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index ec4e18f4c..5c8bb27da 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -14,7 +14,7 @@ runs: # Detect runner architecture $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } - Write-Host "Detected architecture: $Architecture" + Write-Host "Runner architecture: $Architecture" # winget-cli release v1.11.400 $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/226250169' From 84e0bfd3c228ff03a4b27b6fe1c9c82d9b56fc55 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 21:56:56 +0530 Subject: [PATCH 24/40] ci: refactor winget-install action --- .github/actions/winget-install/action.yaml | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index 5c8bb27da..74ab3517c 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -20,18 +20,18 @@ runs: $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/226250169' $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } - $WingetDependenciesZipUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('DesktopAppInstaller_Dependencies.zip') } + $WingetDependenciesZipDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('DesktopAppInstaller_Dependencies.zip') } # Print to logs Write-Host "WingetDownloadUri=$WingetDownloadUri" Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" - Write-Host "WingetDependenciesZipUri=$WingetDependenciesZipUri" + Write-Host "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" # Save output for next step Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV Write-Output "Architecture=$Architecture" >> $env:GITHUB_ENV - Write-Output "WingetDependenciesZipUri=$WingetDependenciesZipUri" >> $env:GITHUB_ENV + Write-Output "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies shell: pwsh @@ -41,7 +41,7 @@ runs: # Download winget and license (architecture-agnostic) Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipUri -OutFile $env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip Expand-Archive -Path "$env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:RUNNER_TEMP/winget-install/ -Force @@ -49,17 +49,15 @@ runs: shell: pwsh run: | # Use architecture-specific dependency paths - if ($env:Architecture -eq "arm64") { - [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/arm64" -Filter '*.appx' -File -Force).FullName - Write-Host "Found Dependency $($DependencyPaths[0])" - Write-Host "Found Dependency $($DependencyPaths[1])" - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$($DependencyPaths[0])", "$($DependencyPaths[1])" - } else { - [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/x64" -Filter '*.appx' -File -Force).FullName - Write-Host "Found Dependency $($DependencyPaths[0])" - Write-Host "Found Dependency $($DependencyPaths[1])" - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$($DependencyPaths[0])", "$($DependencyPaths[1])" - } + [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/$env:Architecture" -Filter '*.appx' -File -Force).FullName + + $MicrosoftUIXamlDep = $($DependencyPaths[0]) + $MicrosoftVCLibsDep = $($DependencyPaths[1]) + + Write-Host "Found Dependency $MicrosoftUIXamlDep" + Write-Host "Found Dependency $MicrosoftVCLibsDep" + + Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" - name: Install Winget for Current User (for better install diagnostics) shell: powershell From e43884dc01c0416f56e6ac92652994cf36efc829 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 6 Aug 2025 22:41:05 +0530 Subject: [PATCH 25/40] ci: move to windows-2025 for x64 as winget comes pre installed --- .github/actions/winget-install/action.yaml | 23 +++++++++++++++++++ .github/workflows/build.yaml | 2 +- .github/workflows/cargo-audit.yaml | 2 +- .github/workflows/code-formatting-check.yaml | 6 ++--- .github/workflows/codeql.yaml | 4 ++-- .github/workflows/docs.yaml | 2 +- .github/workflows/lint.yaml | 4 ++-- .../workflows/local-development-makefile.yaml | 2 +- .github/workflows/test.yaml | 2 +- 9 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index 74ab3517c..0ce503962 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -7,7 +7,26 @@ inputs: runs: using: "composite" steps: + - name: Check if Winget is already available + id: check-winget + shell: pwsh + run: | + try { + $wingetVersion = winget --version 2>$null + if ($LASTEXITCODE -eq 0) { + Write-Host "Winget is already available: $wingetVersion" + Write-Host "Skipping winget installation." + Write-Output "skip-install=true" >> $env:GITHUB_OUTPUT + return + } + } + catch { + Write-Host "Winget not found, proceeding with installation..." + } + Write-Output "skip-install=false" >> $env:GITHUB_OUTPUT + - name: Get URIs for Winget v1.8.1911 assets + if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } @@ -34,6 +53,7 @@ runs: Write-Output "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies + if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | New-Item -Type Directory $env:RUNNER_TEMP/winget-install @@ -46,6 +66,7 @@ runs: Expand-Archive -Path "$env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:RUNNER_TEMP/winget-install/ -Force - name: Start Winget Installation for all Users + if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | # Use architecture-specific dependency paths @@ -60,11 +81,13 @@ runs: Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" - name: Install Winget for Current User (for better install diagnostics) + if: steps.check-winget.outputs.skip-install == 'false' shell: powershell run: | Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle - name: Wait for Completion of Winget Installation + if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | while ((Get-Command * | Select-String winget)?.ToString() -ne "winget.exe") { diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f291361c7..5fc9a5850 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-latest + - name: windows-2025 arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/cargo-audit.yaml b/.github/workflows/cargo-audit.yaml index b697ee0b5..b1dd27f0b 100644 --- a/.github/workflows/cargo-audit.yaml +++ b/.github/workflows/cargo-audit.yaml @@ -17,7 +17,7 @@ concurrency: jobs: cargo_audit: name: Cargo Audit - runs-on: windows-latest + runs-on: windows-2025 permissions: issues: write checks: write diff --git a/.github/workflows/code-formatting-check.yaml b/.github/workflows/code-formatting-check.yaml index b1d73fde9..4ab5b9daf 100644 --- a/.github/workflows/code-formatting-check.yaml +++ b/.github/workflows/code-formatting-check.yaml @@ -14,7 +14,7 @@ concurrency: jobs: cargo-fmt: name: .rs Formatting Check - runs-on: windows-latest + runs-on: windows-2025 steps: - name: Checkout Repository @@ -30,7 +30,7 @@ jobs: taplo-fmt: name: .toml Formatting Check - runs-on: windows-latest + runs-on: windows-2025 steps: - name: Checkout Repository @@ -49,7 +49,7 @@ jobs: cargo-sort: name: Check Dependencies are sorted lexicographically - runs-on: windows-latest + runs-on: windows-2025 steps: - name: Checkout Repository diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 745a9fa6c..d8c981c2e 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -14,7 +14,7 @@ concurrency: jobs: analyze: name: Analyze - runs-on: windows-latest + runs-on: windows-2025 permissions: security-events: write strategy: @@ -69,7 +69,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'amd64' # windows-latest is x64-based + host: 'amd64' # windows-2025 is x64-based target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index b0279dda7..f2f1dba3f 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -21,7 +21,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-latest + - name: windows-2025 arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5f6ea9f14..da0006d03 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,7 +24,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-latest + - name: windows-2025 arch: amd64 - name: windows-11-arm arch: arm64 @@ -89,7 +89,7 @@ jobs: unused_deps: name: Detect Unused Cargo Dependencies - runs-on: windows-latest + runs-on: windows-2025 steps: - name: Checkout Repository diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 7f38fa244..6f4bd4b69 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -21,7 +21,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-latest + - name: windows-2025 arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 379f7d709..bf0519572 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-latest + - name: windows-2025 arch: amd64 - name: windows-11-arm arch: arm64 From e3b30f19190d0eb93b5b36d66ab1a053585f093f Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 07:21:06 +0530 Subject: [PATCH 26/40] debug: include tmate to debug windows-2025 has certmgr.exe --- .github/workflows/build.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5fc9a5850..82f908512 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -62,6 +62,9 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 + - uses: msys2/setup-msys2@v2 + id: setup-msys2 + - name: Install Winget uses: ./.github/actions/winget-install with: @@ -80,6 +83,12 @@ jobs: host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true + msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: From 978b2fe9cb72f055e0953546f170eb06a065a74e Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 11:22:00 +0530 Subject: [PATCH 27/40] Revert "debug: include tmate to debug windows-2025 has certmgr.exe" This reverts commit f5c51b4e1bfb63b5ad6be83838722e1f3eb6b6b9. --- .github/workflows/build.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 82f908512..5fc9a5850 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -62,9 +62,6 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - uses: msys2/setup-msys2@v2 - id: setup-msys2 - - name: Install Winget uses: ./.github/actions/winget-install with: @@ -83,12 +80,6 @@ jobs: host: ${{ matrix.runner.arch }} target: ${{ matrix.target_triple.arch }} - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - msys2-location: ${{ steps.setup-msys2.outputs.msys2-location }} - - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: From a3f6119570440eeb6bb57f371232d341dc66786a Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 11:22:06 +0530 Subject: [PATCH 28/40] Revert "ci: move to windows-2025 for x64 as winget comes pre installed" This reverts commit d413183c170cd0deec4854e6784faeeee9e3d7ec. --- .github/actions/winget-install/action.yaml | 23 ------------------- .github/workflows/build.yaml | 2 +- .github/workflows/cargo-audit.yaml | 2 +- .github/workflows/code-formatting-check.yaml | 6 ++--- .github/workflows/codeql.yaml | 4 ++-- .github/workflows/docs.yaml | 2 +- .github/workflows/lint.yaml | 4 ++-- .../workflows/local-development-makefile.yaml | 2 +- .github/workflows/test.yaml | 2 +- 9 files changed, 12 insertions(+), 35 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index 0ce503962..74ab3517c 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -7,26 +7,7 @@ inputs: runs: using: "composite" steps: - - name: Check if Winget is already available - id: check-winget - shell: pwsh - run: | - try { - $wingetVersion = winget --version 2>$null - if ($LASTEXITCODE -eq 0) { - Write-Host "Winget is already available: $wingetVersion" - Write-Host "Skipping winget installation." - Write-Output "skip-install=true" >> $env:GITHUB_OUTPUT - return - } - } - catch { - Write-Host "Winget not found, proceeding with installation..." - } - Write-Output "skip-install=false" >> $env:GITHUB_OUTPUT - - name: Get URIs for Winget v1.8.1911 assets - if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } @@ -53,7 +34,6 @@ runs: Write-Output "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies - if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | New-Item -Type Directory $env:RUNNER_TEMP/winget-install @@ -66,7 +46,6 @@ runs: Expand-Archive -Path "$env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:RUNNER_TEMP/winget-install/ -Force - name: Start Winget Installation for all Users - if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | # Use architecture-specific dependency paths @@ -81,13 +60,11 @@ runs: Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" - name: Install Winget for Current User (for better install diagnostics) - if: steps.check-winget.outputs.skip-install == 'false' shell: powershell run: | Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle - name: Wait for Completion of Winget Installation - if: steps.check-winget.outputs.skip-install == 'false' shell: pwsh run: | while ((Get-Command * | Select-String winget)?.ToString() -ne "winget.exe") { diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5fc9a5850..f291361c7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-2025 + - name: windows-latest arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/cargo-audit.yaml b/.github/workflows/cargo-audit.yaml index b1dd27f0b..b697ee0b5 100644 --- a/.github/workflows/cargo-audit.yaml +++ b/.github/workflows/cargo-audit.yaml @@ -17,7 +17,7 @@ concurrency: jobs: cargo_audit: name: Cargo Audit - runs-on: windows-2025 + runs-on: windows-latest permissions: issues: write checks: write diff --git a/.github/workflows/code-formatting-check.yaml b/.github/workflows/code-formatting-check.yaml index 4ab5b9daf..b1d73fde9 100644 --- a/.github/workflows/code-formatting-check.yaml +++ b/.github/workflows/code-formatting-check.yaml @@ -14,7 +14,7 @@ concurrency: jobs: cargo-fmt: name: .rs Formatting Check - runs-on: windows-2025 + runs-on: windows-latest steps: - name: Checkout Repository @@ -30,7 +30,7 @@ jobs: taplo-fmt: name: .toml Formatting Check - runs-on: windows-2025 + runs-on: windows-latest steps: - name: Checkout Repository @@ -49,7 +49,7 @@ jobs: cargo-sort: name: Check Dependencies are sorted lexicographically - runs-on: windows-2025 + runs-on: windows-latest steps: - name: Checkout Repository diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index d8c981c2e..745a9fa6c 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -14,7 +14,7 @@ concurrency: jobs: analyze: name: Analyze - runs-on: windows-2025 + runs-on: windows-latest permissions: security-events: write strategy: @@ -69,7 +69,7 @@ jobs: with: version: ${{ matrix.wdk.version }} source: ${{ matrix.wdk.source }} - host: 'amd64' # windows-2025 is x64-based + host: 'amd64' # windows-latest is x64-based target: ${{ matrix.target_triple.arch }} - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index f2f1dba3f..b0279dda7 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -21,7 +21,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-2025 + - name: windows-latest arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index da0006d03..5f6ea9f14 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,7 +24,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-2025 + - name: windows-latest arch: amd64 - name: windows-11-arm arch: arm64 @@ -89,7 +89,7 @@ jobs: unused_deps: name: Detect Unused Cargo Dependencies - runs-on: windows-2025 + runs-on: windows-latest steps: - name: Checkout Repository diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 6f4bd4b69..7f38fa244 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -21,7 +21,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-2025 + - name: windows-latest arch: amd64 - name: windows-11-arm arch: arm64 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf0519572..379f7d709 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false # Allow all matrix variants to complete even if some fail matrix: runner: - - name: windows-2025 + - name: windows-latest arch: amd64 - name: windows-11-arm arch: arm64 From ffed717f4f3d49d63a3a1e9e1e51d5a0a61ce204 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 17:38:14 +0530 Subject: [PATCH 29/40] debug: revert linker fix from wdm-driver --- .github/workflows/test.yaml | 5 ++++- crates/cargo-wdk/tests/wdm-driver/src/lib.rs | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 379f7d709..244508c56 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,8 +20,10 @@ jobs: runner: - name: windows-latest arch: amd64 + rust_target_triple: x86_64-pc-windows-msvc - name: windows-11-arm arch: arm64 + rust_target_triple: aarch64-pc-windows-msvc wdk: - version: 10.0.22621 # NI WDK @@ -78,6 +80,7 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} + targets: ${{ matrix.runner.rust_target_triple }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -85,4 +88,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.runner.rust_target_triple }} --all-features diff --git a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs index bc69c2364..bca383315 100644 --- a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs @@ -16,9 +16,9 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; -extern crate alloc; -use alloc::ffi::CString; -use core::hint::black_box; +// extern crate alloc; +// use alloc::ffi::CString; +// use core::hint::black_box; #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( @@ -26,6 +26,6 @@ pub unsafe extern "system" fn driver_entry( _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { // Prevent optimization: ensure allocator is linked (workaround for ARM64 linker issues) - black_box(CString::new("Hello World!\n").unwrap()); + // black_box(CString::new("Hello World!\n").unwrap()); 0 } From 4c2c3dbd9cc87dd84d5cea15dd856858db02ddab Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 18:42:13 +0530 Subject: [PATCH 30/40] debug: remove linker fix from wdm driver template --- crates/cargo-wdk/templates/wdm/lib.rs.tmp | 4 ---- crates/cargo-wdk/tests/wdm-driver/src/lib.rs | 6 ------ 2 files changed, 10 deletions(-) diff --git a/crates/cargo-wdk/templates/wdm/lib.rs.tmp b/crates/cargo-wdk/templates/wdm/lib.rs.tmp index a8d3235bf..3c1699a7b 100644 --- a/crates/cargo-wdk/templates/wdm/lib.rs.tmp +++ b/crates/cargo-wdk/templates/wdm/lib.rs.tmp @@ -16,14 +16,10 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; -extern crate alloc; -use alloc::ffi::CString; - #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { - let _ = CString::new("Hello World!\n").unwrap(); 0 } diff --git a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs index bca383315..3c1699a7b 100644 --- a/crates/cargo-wdk/tests/wdm-driver/src/lib.rs +++ b/crates/cargo-wdk/tests/wdm-driver/src/lib.rs @@ -16,16 +16,10 @@ use wdk_alloc::WdkAllocator; #[global_allocator] static GLOBAL_ALLOCATOR: WdkAllocator = WdkAllocator; -// extern crate alloc; -// use alloc::ffi::CString; -// use core::hint::black_box; - #[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry pub unsafe extern "system" fn driver_entry( _driver: PDRIVER_OBJECT, _registry_path: PCUNICODE_STRING, ) -> NTSTATUS { - // Prevent optimization: ensure allocator is linked (workaround for ARM64 linker issues) - // black_box(CString::new("Hello World!\n").unwrap()); 0 } From db9a000e91b2e10a6cae678e4dcde1da29f4e9b9 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Thu, 7 Aug 2025 20:06:57 +0530 Subject: [PATCH 31/40] debug: revert target changes from test workflow to reprod linker issue --- .github/workflows/test.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 244508c56..3931efc40 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,10 +20,10 @@ jobs: runner: - name: windows-latest arch: amd64 - rust_target_triple: x86_64-pc-windows-msvc + # rust_target_triple: x86_64-pc-windows-msvc - name: windows-11-arm arch: arm64 - rust_target_triple: aarch64-pc-windows-msvc + # rust_target_triple: aarch64-pc-windows-msvc wdk: - version: 10.0.22621 # NI WDK @@ -80,7 +80,7 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} - targets: ${{ matrix.runner.rust_target_triple }} + # targets: ${{ matrix.runner.rust_target_triple }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -88,4 +88,5 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.runner.rust_target_triple }} --all-features + # run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.runner.rust_target_triple }} --all-features + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features From f5d3d9f4d5bdebfe618fef20d1833518767f4ca5 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Fri, 8 Aug 2025 08:34:59 +0530 Subject: [PATCH 32/40] debug: coment out job exclusion criteria in test workflow --- .github/workflows/test.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3931efc40..91a8363f6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -43,14 +43,14 @@ jobs: - dev - release - # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries - exclude: - - runner: - name: windows-11-arm - arch: arm64 - wdk: - version: 10.0.22621 - source: winget + # # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + # exclude: + # - runner: + # name: windows-11-arm + # arch: arm64 + # wdk: + # version: 10.0.22621 + # source: winget runs-on: ${{ matrix.runner.name }} From 613d9d287dd45c493c2347027605a5f8b25efb68 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Fri, 8 Aug 2025 09:03:23 +0530 Subject: [PATCH 33/40] ci: revert changes to test workflow post debugging linker issue --- .github/workflows/test.yaml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 91a8363f6..379f7d709 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,10 +20,8 @@ jobs: runner: - name: windows-latest arch: amd64 - # rust_target_triple: x86_64-pc-windows-msvc - name: windows-11-arm arch: arm64 - # rust_target_triple: aarch64-pc-windows-msvc wdk: - version: 10.0.22621 # NI WDK @@ -43,14 +41,14 @@ jobs: - dev - release - # # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries - # exclude: - # - runner: - # name: windows-11-arm - # arch: arm64 - # wdk: - # version: 10.0.22621 - # source: winget + # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + exclude: + - runner: + name: windows-11-arm + arch: arm64 + wdk: + version: 10.0.22621 + source: winget runs-on: ${{ matrix.runner.name }} @@ -80,7 +78,6 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust_toolchain }} - # targets: ${{ matrix.runner.rust_target_triple }} - name: Install Cargo Expand uses: taiki-e/install-action@v2 @@ -88,5 +85,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - # run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.runner.rust_target_triple }} --all-features run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --all-features From 6880f8a8a5b32223e731de49874f447321da2eda Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Fri, 8 Aug 2025 17:31:51 +0530 Subject: [PATCH 34/40] ci: rename winget-install to install-winget for consistency --- .github/actions/{winget-install => install-winget}/action.yaml | 0 .github/workflows/build.yaml | 2 +- .github/workflows/codeql.yaml | 2 +- .github/workflows/docs.yaml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/local-development-makefile.yaml | 2 +- .github/workflows/test.yaml | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename .github/actions/{winget-install => install-winget}/action.yaml (100%) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/install-winget/action.yaml similarity index 100% rename from .github/actions/winget-install/action.yaml rename to .github/actions/install-winget/action.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f291361c7..fa4343375 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,7 +63,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 745a9fa6c..2fb1c2755 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -55,7 +55,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index b0279dda7..ccb12f42a 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5f6ea9f14..25ab069ca 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -60,7 +60,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 7f38fa244..c367a2dc9 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 379f7d709..a09176f2d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -57,7 +57,7 @@ jobs: uses: actions/checkout@v4 - name: Install Winget - uses: ./.github/actions/winget-install + uses: ./.github/actions/install-winget with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From cc923ec80ba2009abf18a2aa6eae1e4004c02cd6 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Fri, 8 Aug 2025 17:42:28 +0530 Subject: [PATCH 35/40] ci: refactor install-winget action temp path construction --- .github/actions/install-winget/action.yaml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/actions/install-winget/action.yaml b/.github/actions/install-winget/action.yaml index 74ab3517c..242fb8fb8 100644 --- a/.github/actions/install-winget/action.yaml +++ b/.github/actions/install-winget/action.yaml @@ -7,7 +7,7 @@ inputs: runs: using: "composite" steps: - - name: Get URIs for Winget v1.8.1911 assets + - name: Get URIs for Winget v1.11.400 assets shell: pwsh run: | $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } @@ -32,24 +32,25 @@ runs: Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV Write-Output "Architecture=$Architecture" >> $env:GITHUB_ENV Write-Output "WingetDependenciesZipDownloadUri=$WingetDependenciesZipDownloadUri" >> $env:GITHUB_ENV + Write-Output "InstallWingetTempDir=$env:RUNNER_TEMP/install-winget" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies shell: pwsh run: | - New-Item -Type Directory $env:RUNNER_TEMP/winget-install + New-Item -Type Directory $env:InstallWingetTempDir # Download winget and license (architecture-agnostic) - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDownloadUri -OutFile $env:InstallWingetTempDir/winget.msixbundle + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetLicenseDownloadUri -OutFile $env:InstallWingetTempDir/license.xml + Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:WingetDependenciesZipDownloadUri -OutFile $env:InstallWingetTempDir/DesktopAppInstaller_Dependencies.zip - Expand-Archive -Path "$env:RUNNER_TEMP/winget-install/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:RUNNER_TEMP/winget-install/ -Force + Expand-Archive -Path "$env:InstallWingetTempDir/DesktopAppInstaller_Dependencies.zip" -DestinationPath $env:InstallWingetTempDir/ -Force - name: Start Winget Installation for all Users shell: pwsh run: | # Use architecture-specific dependency paths - [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:RUNNER_TEMP/winget-install/$env:Architecture" -Filter '*.appx' -File -Force).FullName + [string[]]$DependencyPaths = (Get-ChildItem -Path "$env:InstallWingetTempDir/$env:Architecture" -Filter '*.appx' -File -Force).FullName $MicrosoftUIXamlDep = $($DependencyPaths[0]) $MicrosoftVCLibsDep = $($DependencyPaths[1]) @@ -57,12 +58,12 @@ runs: Write-Host "Found Dependency $MicrosoftUIXamlDep" Write-Host "Found Dependency $MicrosoftVCLibsDep" - Add-AppxProvisionedPackage -Online -PackagePath $env:RUNNER_TEMP/winget-install/winget.msixbundle -LicensePath $env:RUNNER_TEMP/winget-install/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" + Add-AppxProvisionedPackage -Online -PackagePath $env:InstallWingetTempDir/winget.msixbundle -LicensePath $env:InstallWingetTempDir/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" - name: Install Winget for Current User (for better install diagnostics) shell: powershell run: | - Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle + Add-AppxPackage $env:InstallWingetTempDir/winget.msixbundle - name: Wait for Completion of Winget Installation shell: pwsh From c810cf51cce4281a57af41bced18e463d7625b75 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Tue, 12 Aug 2025 16:08:45 +0530 Subject: [PATCH 36/40] ci: update comment for unable to install SDK scenario --- .github/workflows/build.yaml | 3 ++- .github/workflows/local-development-makefile.yaml | 2 +- .github/workflows/test.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fa4343375..68b6089f3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -55,7 +55,7 @@ jobs: runs-on: ${{ matrix.runner.name }} env: - # WDK 10.0.22621 installed via winget channel on ARM64 runner doesn't ship certmgr and makecert binaries + # Cert tools are unavailable because SDK 10.0.22621 cannot be installed on the ARM64 runner CERT_TOOLS_PRESENT: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} steps: @@ -107,6 +107,7 @@ jobs: # Run cargo-wdk on examples and tests - name: Install cargo-wdk + if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force - name: Build & Package Examples (via cargo-wdk) diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index c367a2dc9..134bae6f2 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,7 +35,7 @@ jobs: llvm: - 17.0.6 - # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + # Exclude WDK 10.0.22621 from the ARM64 runner, as the corresponding SDK cannot be installed exclude: - runner: name: windows-11-arm diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a09176f2d..536a83bc7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,7 +41,7 @@ jobs: - dev - release - # Exclude WDK 10.0.22621 with ARM64 runner as it doesn't ship certmgr and makecert binaries + # Exclude WDK 10.0.22621 from the ARM64 runner, as the corresponding SDK cannot be installed exclude: - runner: name: windows-11-arm From ea3071107d4480869f5417baec9086339ab44e17 Mon Sep 17 00:00:00 2001 From: Krishna Kumar Thokala Date: Tue, 12 Aug 2025 16:36:08 +0530 Subject: [PATCH 37/40] copilot: use tag instead of release number for winget installation Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Krishna Kumar Thokala --- .github/actions/install-winget/action.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/install-winget/action.yaml b/.github/actions/install-winget/action.yaml index 242fb8fb8..68ca24414 100644 --- a/.github/actions/install-winget/action.yaml +++ b/.github/actions/install-winget/action.yaml @@ -17,7 +17,10 @@ runs: Write-Host "Runner architecture: $Architecture" # winget-cli release v1.11.400 - $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/226250169' + # Define the winget-cli release tag to use + $WingetReleaseTag = "v1.11.400" + # Fetch release info by tag instead of magic number release ID + $ReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders "https://api.github.com/repos/microsoft/winget-cli/releases/tags/$WingetReleaseTag" $WingetDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } $WingetLicenseDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } $WingetDependenciesZipDownloadUri = $ReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('DesktopAppInstaller_Dependencies.zip') } From 86462bddcbc3eb9172bedf226163ca1f66c712bb Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Tue, 12 Aug 2025 19:16:40 +0530 Subject: [PATCH 38/40] ci: add sdk installation step to install-wdk action and also addressed issue with 10.0.22621 kit --- .github/actions/install-wdk/action.yml | 42 +++++++++++++++---- .github/workflows/build.yaml | 8 ---- .../workflows/local-development-makefile.yaml | 9 ---- .github/workflows/test.yaml | 9 ---- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 3a5618d0e..14cba4e8a 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -34,6 +34,17 @@ runs: } } + # Function to install or update a WinGet package + function Install-WinGetPackageIfNeeded($packageId, $packageName) { + if ((Get-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -ErrorAction SilentlyContinue).Id -eq $packageId) { + Write-Host "$packageName ($packageId) is already installed. Attempting to update..." + Update-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -Mode Silent -Force + } else { + Write-Host "Installing $packageName ($packageId)..." + Install-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -Mode Silent -Force + } + } + $hostArch = Normalize-Architecture '${{ inputs.host }}' $targetArch = Normalize-Architecture '${{ inputs.target }}' @@ -134,16 +145,33 @@ runs: Write-Output "WindowsSdkBinPath=$packages\Microsoft.Windows.SDK.CPP.$version\c\bin" >> $env:GITHUB_ENV } else { - Write-Host "Using Winget to install WDK version $inputVersion..." - $wdk = "Microsoft.WindowsWDK.$inputVersion" - if ((Get-WinGetPackage -Id $wdk -Source winget -MatchOption Equals).Id -eq '$wdk') { - Write-Host "$wdk is already installed. Attempting to update..." - Update-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + Write-Host "Using Winget to install WDK and SDK version $inputVersion..." + + # Install Windows SDK first + if ($sdkVersion -eq "10.0.22621") { + # Installing the 10.0.22621 SDK via winget is not working, so it is being installed using the winsdksetup.exe installer + + Write-Host "Installing Windows SDK 10.0.22621.5040 from Microsoft download link..." + $sdkInstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2311806" + $installerPath = "$env:RUNNER_TEMP\winsdksetup.exe" + + Write-Host "Downloading SDK installer from $sdkInstallerUrl..." + Invoke-WebRequest -Uri $sdkInstallerUrl -OutFile $installerPath -UseBasicParsing + + Write-Host "Running SDK installer with all features..." + Start-Process -FilePath $installerPath -ArgumentList "/quiet", "/features", "+" -Wait -NoNewWindow + + Write-Host "Cleaning up installer..." + Remove-Item $installerPath -Force -ErrorAction SilentlyContinue } else { - Write-Host "Installing $wdk..." - Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + $sdk = "Microsoft.WindowsSDK.$inputVersion" + Install-WinGetPackageIfNeeded $sdk "Windows SDK" } + # Install Windows WDK + $wdk = "Microsoft.WindowsWDK.$inputVersion" + Install-WinGetPackageIfNeeded $wdk "Windows WDK" + Write-Host "Setting Version_Number environment variable to $sdkVersion..." Write-Output "Version_Number=$sdkVersion.0" >> $env:GITHUB_ENV } diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 68b6089f3..96454f233 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -54,10 +54,6 @@ jobs: runs-on: ${{ matrix.runner.name }} - env: - # Cert tools are unavailable because SDK 10.0.22621 cannot be installed on the ARM64 runner - CERT_TOOLS_PRESENT: ${{ !(matrix.wdk.version == '10.0.22621' && matrix.runner.arch == 'arm64') }} - steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -102,20 +98,16 @@ jobs: run: cargo make --cwd ./examples build +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} - name: Package Examples (via Cargo Make) - if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo make --cwd ./examples package-driver-flow +${{ matrix.rust_toolchain }} --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple.name }} # Run cargo-wdk on examples and tests - name: Install cargo-wdk - if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force - name: Build & Package Examples (via cargo-wdk) - if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample working-directory: ./examples - name: Run build on tests folder (via cargo-wdk) - if: ${{ env.CERT_TOOLS_PRESENT == 'true' }} run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} working-directory: ./tests diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 134bae6f2..cee74797a 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -35,15 +35,6 @@ jobs: llvm: - 17.0.6 - # Exclude WDK 10.0.22621 from the ARM64 runner, as the corresponding SDK cannot be installed - exclude: - - runner: - name: windows-11-arm - arch: arm64 - wdk: - version: 10.0.22621 - source: winget - runs-on: ${{ matrix.runner.name }} steps: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 536a83bc7..f14076616 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,15 +41,6 @@ jobs: - dev - release - # Exclude WDK 10.0.22621 from the ARM64 runner, as the corresponding SDK cannot be installed - exclude: - - runner: - name: windows-11-arm - arch: arm64 - wdk: - version: 10.0.22621 - source: winget - runs-on: ${{ matrix.runner.name }} steps: From c7cd0a5ca287a85805bcc1aef7b17d135e16a6d3 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 13 Aug 2025 12:53:23 +0530 Subject: [PATCH 39/40] ci: change installation method for 10.0.22621 SDK --- .github/actions/install-wdk/action.yml | 41 +++++++------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 14cba4e8a..4a6d6f36b 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -34,17 +34,6 @@ runs: } } - # Function to install or update a WinGet package - function Install-WinGetPackageIfNeeded($packageId, $packageName) { - if ((Get-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -ErrorAction SilentlyContinue).Id -eq $packageId) { - Write-Host "$packageName ($packageId) is already installed. Attempting to update..." - Update-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -Mode Silent -Force - } else { - Write-Host "Installing $packageName ($packageId)..." - Install-WinGetPackage -Id $packageId -Source winget -MatchOption Equals -Mode Silent -Force - } - } - $hostArch = Normalize-Architecture '${{ inputs.host }}' $targetArch = Normalize-Architecture '${{ inputs.target }}' @@ -147,30 +136,22 @@ runs: Write-Host "Using Winget to install WDK and SDK version $inputVersion..." - # Install Windows SDK first + # Install Windows SDK 10.0.22621 explicitly when WDK 10.0.22621 is requested if ($sdkVersion -eq "10.0.22621") { - # Installing the 10.0.22621 SDK via winget is not working, so it is being installed using the winsdksetup.exe installer - - Write-Host "Installing Windows SDK 10.0.22621.5040 from Microsoft download link..." - $sdkInstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2311806" - $installerPath = "$env:RUNNER_TEMP\winsdksetup.exe" - - Write-Host "Downloading SDK installer from $sdkInstallerUrl..." - Invoke-WebRequest -Uri $sdkInstallerUrl -OutFile $installerPath -UseBasicParsing - - Write-Host "Running SDK installer with all features..." - Start-Process -FilePath $installerPath -ArgumentList "/quiet", "/features", "+" -Wait -NoNewWindow - - Write-Host "Cleaning up installer..." - Remove-Item $installerPath -Force -ErrorAction SilentlyContinue - } else { - $sdk = "Microsoft.WindowsSDK.$inputVersion" - Install-WinGetPackageIfNeeded $sdk "Windows SDK" + Write-Host "Installing 10.0.22621 SDK ..." + $sdk = "Microsoft.WindowsSDK.$sdkVersion" + Install-WinGetPackage -Id $sdk -Source winget -MatchOption Equals -Mode Silent -Force -Override '/q /features +' } # Install Windows WDK $wdk = "Microsoft.WindowsWDK.$inputVersion" - Install-WinGetPackageIfNeeded $wdk "Windows WDK" + if ((Get-WinGetPackage -Id $wdk -Source winget -MatchOption Equals).Id -eq '$wdk') { + Write-Host "$wdk is already installed. Attempting to update..." + Update-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + } else { + Write-Host "Installing $wdk..." + Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + } Write-Host "Setting Version_Number environment variable to $sdkVersion..." Write-Output "Version_Number=$sdkVersion.0" >> $env:GITHUB_ENV From def6187b9466b0a08b19ac47129b6787066382f5 Mon Sep 17 00:00:00 2001 From: krishnakumar4a4 Date: Wed, 13 Aug 2025 18:19:56 +0530 Subject: [PATCH 40/40] ci: fix wdk and LLVM installation --- .github/actions/install-llvm/action.yml | 23 +++++++++++---------- .github/actions/install-wdk/action.yml | 27 +++++++++++++------------ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/.github/actions/install-llvm/action.yml b/.github/actions/install-llvm/action.yml index 8f342f4ed..79c376174 100644 --- a/.github/actions/install-llvm/action.yml +++ b/.github/actions/install-llvm/action.yml @@ -11,17 +11,18 @@ runs: - name: Install LLVM ${{ inputs.version }} shell: pwsh run: | - # Use native winget.exe instead of PowerShell module for ARM64 compatibility - Write-Host "Existing LLVM installation(s):..." - winget list --id LLVM.LLVM --exact --accept-source-agreements --disable-interactivity - - Write-Host "Force Installing LLVM ${{ inputs.version }}..." - winget install --id LLVM.LLVM --version ${{ inputs.version }} --source winget --force --exact --silent --accept-source-agreements --accept-package-agreements --disable-interactivity - - if ($LASTEXITCODE -ne 0) { - Write-Error "LLVM ${{ inputs.version }} force installation failed with exit code: $LASTEXITCODE" - exit 1 + if ((Get-WinGetPackage -Id LLVM -Source winget -MatchOption Equals).InstalledVersion -eq '${{ inputs.version }}') { + Write-Host "LLVM ${{ inputs.version }} is already installed." + } else { + Write-Host "Installing LLVM ${{ inputs.version }}..." + Install-WinGetPackage -Id LLVM.LLVM -Version ${{ inputs.version }} -Source winget -MatchOption Equals -Mode Silent -Force + + # Check if WinGet installation succeeded + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "LLVM installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 + } } - Write-Host "Verifying LLVM installation..." clang --version diff --git a/.github/actions/install-wdk/action.yml b/.github/actions/install-wdk/action.yml index 4a6d6f36b..29b13e584 100644 --- a/.github/actions/install-wdk/action.yml +++ b/.github/actions/install-wdk/action.yml @@ -136,21 +136,22 @@ runs: Write-Host "Using Winget to install WDK and SDK version $inputVersion..." - # Install Windows SDK 10.0.22621 explicitly when WDK 10.0.22621 is requested - if ($sdkVersion -eq "10.0.22621") { - Write-Host "Installing 10.0.22621 SDK ..." - $sdk = "Microsoft.WindowsSDK.$sdkVersion" - Install-WinGetPackage -Id $sdk -Source winget -MatchOption Equals -Mode Silent -Force -Override '/q /features +' + $sdk = "Microsoft.WindowsSDK.$sdkVersion" + $wdk = "Microsoft.WindowsWDK.$inputVersion" + Write-Host "Installing $sdk..." + Install-WinGetPackage -Id $sdk -Source winget -MatchOption Equals -Mode Silent -Force -Override '/q /features +' + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "$sdk installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 } - # Install Windows WDK - $wdk = "Microsoft.WindowsWDK.$inputVersion" - if ((Get-WinGetPackage -Id $wdk -Source winget -MatchOption Equals).Id -eq '$wdk') { - Write-Host "$wdk is already installed. Attempting to update..." - Update-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force - } else { - Write-Host "Installing $wdk..." - Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + Write-Host "Installing $wdk..." + Install-WinGetPackage -Id $wdk -Source winget -MatchOption Equals -Mode Silent -Force + $installSuccess = $? + if (-not $installSuccess) { + Write-Error "$wdk installation failed. Last exit code: $LASTEXITCODE and success status: $installSuccess" + exit 1 } Write-Host "Setting Version_Number environment variable to $sdkVersion..."