From 22113b7cfa1c0aa7e2b64c069dda4bb48134237a Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Tue, 23 Dec 2025 15:43:42 -0500 Subject: [PATCH 1/5] ci: install winget via Repair-WinGetPackageManager --- .github/actions/install-winget/action.yaml | 78 ------------------- .github/workflows/build.yaml | 12 +-- .github/workflows/docs.yaml | 13 ++-- .github/workflows/lint.yaml | 13 ++-- .../workflows/local-development-makefile.yaml | 13 ++-- .github/workflows/test.yaml | 13 ++-- 6 files changed, 35 insertions(+), 107 deletions(-) delete mode 100644 .github/actions/install-winget/action.yaml diff --git a/.github/actions/install-winget/action.yaml b/.github/actions/install-winget/action.yaml deleted file mode 100644 index 5591288c0..000000000 --- a/.github/actions/install-winget/action.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: "Install Winget" -description: "Install winget on windows runners since its not installed by default: https://github.com/actions/runner-images/issues/6472" -inputs: - GITHUB_TOKEN: - description: "GitHub token to execute authenticated Github API requests (for higher rate limit)" - required: true -runs: - using: "composite" - steps: - - name: Get URIs for Winget v1.11.400 assets - shell: pwsh - run: | - $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } - - # Detect runner architecture - $Architecture = if ($env:RUNNER_ARCH -eq "ARM64") { "arm64" } else { "x64" } - Write-Host "Runner architecture: $Architecture" - - # winget-cli release v1.11.400 - # 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') } - - # Print to logs - Write-Host "WingetDownloadUri=$WingetDownloadUri" - Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" - 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 "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: | - $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } - New-Item -Type Directory $env:InstallWingetTempDir - - # Download winget and license (architecture-agnostic) - 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: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:InstallWingetTempDir/$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:InstallWingetTempDir/winget.msixbundle -LicensePath $env:InstallWingetTempDir/license.xml -DependencyPackagePath "$MicrosoftUIXamlDep", "$MicrosoftVCLibsDep" - - - name: Install Winget for Current User (for better install diagnostics) - shell: pwsh - run: | - Add-AppxPackage $env:InstallWingetTempDir/winget.msixbundle - - - name: Wait for Completion of Winget Installation - shell: pwsh - run: | - while ((Get-Command * | Select-String winget)?.ToString() -ne "winget.exe") { - Start-Sleep -Seconds 1 - } - Write-Output "Winget Version: $(winget --version)" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 098bfd791..90056dd50 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -60,16 +60,18 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Install Winget - if: matrix.runner.name == 'windows-11-arm' - uses: ./.github/actions/install-winget - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install Winget PowerShell Module shell: pwsh run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force + - name: Install Winget + if: matrix.runner.name == 'windows-11-arm' + shell: pwsh + run: | + Repair-WinGetPackageManager -Latest -Force + Write-Output "Winget Version: $(winget --version)" + - name: Install LLVM ${{ matrix.llvm }} uses: ./.github/actions/install-llvm with: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index fcf0385c4..5968833de 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -58,16 +58,17 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Install Winget - if: matrix.runner.name == 'windows-11-arm' - uses: ./.github/actions/install-winget - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget PowerShell Module shell: pwsh run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force + - name: Install Winget + if: matrix.runner.name == 'windows-11-arm' + shell: pwsh + run: | + Repair-WinGetPackageManager -Latest -Force + Write-Output "Winget Version: $(winget --version)" + - name: Install LLVM ${{ matrix.llvm }} uses: ./.github/actions/install-llvm with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b0d158291..a143e57db 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -61,16 +61,17 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Install Winget - if: matrix.runner.name == 'windows-11-arm' - uses: ./.github/actions/install-winget - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget PowerShell Module shell: pwsh run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force + - name: Install Winget + if: matrix.runner.name == 'windows-11-arm' + shell: pwsh + run: | + Repair-WinGetPackageManager -Latest -Force + Write-Output "Winget Version: $(winget --version)" + - name: Install LLVM ${{ matrix.llvm }} uses: ./.github/actions/install-llvm with: diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 1f7170f87..7e7d1d202 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -43,16 +43,17 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Install Winget - if: matrix.runner.name == 'windows-11-arm' - uses: ./.github/actions/install-winget - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget PowerShell Module shell: pwsh run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force + - name: Install Winget + if: matrix.runner.name == 'windows-11-arm' + shell: pwsh + run: | + Repair-WinGetPackageManager -Latest -Force + Write-Output "Winget Version: $(winget --version)" + - name: Install LLVM ${{ matrix.llvm }} uses: ./.github/actions/install-llvm with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2d245d923..5db567f63 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,16 +50,17 @@ jobs: - name: Checkout Repository uses: actions/checkout@v5 - - name: Install Winget - if: matrix.runner.arch == 'arm64' - uses: ./.github/actions/install-winget - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Winget PowerShell Module shell: pwsh run: Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force + - name: Install Winget + if: matrix.runner.arch == 'arm64' + shell: pwsh + run: | + Repair-WinGetPackageManager -Latest -Force + Write-Output "Winget Version: $(winget --version)" + - name: Install LLVM ${{ matrix.llvm }} uses: ./.github/actions/install-llvm with: From f4ab87627bf2d62cb5376f81e4275f30f69f03d5 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 10 Dec 2025 13:54:19 -0800 Subject: [PATCH 2/5] test: update macro expansion test collateral for beta toolchain --- .../tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs | 2 +- .../tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs index 634a9719f..b1451a812 100644 --- a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/bug_unused_imports.expanded.rs @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs index 0049301cf..d99bbb959 100644 --- a/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/beta/macrotest/wdf_driver_create.expanded.rs @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; From 98fd30096e833d02696470e5407c264210c76938 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Tue, 23 Dec 2025 19:09:34 -0500 Subject: [PATCH 3/5] update to cargo-expand 1.0.119 --- .github/workflows/test.yaml | 2 +- CONTRIBUTING.md | 2 +- Makefile.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5db567f63..326ec7bb0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -89,7 +89,7 @@ jobs: - name: Install Cargo Expand uses: taiki-e/install-action@v2 with: - tool: cargo-expand@1.0.85 + tool: cargo-expand@1.0.119 - name: Install Cargo Make uses: taiki-e/install-action@v2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 287e49bec..c2aa328a8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,7 +88,7 @@ That's it! Thank you for your contribution! The following tools should be installed as a part of the `windows-drivers-rs` developer workflow: * `cargo-audit`: `cargo install --locked cargo-audit` -* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.85` +* `cargo-expand`: `cargo install --locked cargo-expand --version 1.0.119` * `cargo-machete`: `cargo install --locked cargo-machete` * `cargo-sort`: `cargo install --locked cargo-sort` * `taplo-cli`: `cargo install --locked taplo-cli` diff --git a/Makefile.toml b/Makefile.toml index a2bcf46e6..a42c36614 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -54,7 +54,7 @@ assert ${success} "Failed to delete tests directory" install_crate = { crate_name = "cargo-expand", binary = "cargo", test_arg = [ "expand", "--version", -], version = "1.0.85" } +], version = "1.0.119" } [tasks.audit] args = ["audit", "--deny", "warnings"] From 0c47dbd53a2168413e0d38e9c730ded49f73216e Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 25 Dec 2025 09:58:39 -0500 Subject: [PATCH 4/5] update collateral for other toolchains --- .../outputs/nightly/macrotest/bug_unused_imports.expanded.rs | 2 +- .../outputs/nightly/macrotest/wdf_driver_create.expanded.rs | 2 +- .../outputs/stable/macrotest/bug_unused_imports.expanded.rs | 2 +- .../outputs/stable/macrotest/wdf_driver_create.expanded.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs index 634a9719f..b1451a812 100644 --- a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/bug_unused_imports.expanded.rs @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs index 0049301cf..d99bbb959 100644 --- a/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/nightly/macrotest/wdf_driver_create.expanded.rs @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs index 634a9719f..b1451a812 100644 --- a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/bug_unused_imports.expanded.rs @@ -86,7 +86,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; diff --git a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs index 0049301cf..d99bbb959 100644 --- a/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs +++ b/tests/wdk-macros-tests/tests/outputs/stable/macrotest/wdf_driver_create.expanded.rs @@ -63,7 +63,7 @@ pub extern "system" fn driver_entry( ::core::panicking::panic_fmt( format_args!( "internal error: entered unreachable code: {0}", - format_args!("Option should never be None") + format_args!("Option should never be None"), ), ); }; From 68b0ae3df70db86212ce53bfe12bc6fe070dbc28 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 25 Dec 2025 15:57:28 -0500 Subject: [PATCH 5/5] Revert "ci: pin nightly version in CI due to macrotest bug (#587)" This reverts commit fbdd7928076ba3abc614ab60875b0325ee477dc2. --- .github/workflows/test.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 326ec7bb0..e034d3709 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -37,8 +37,7 @@ jobs: rust_toolchain: - stable - beta - # Pin nightly version temporarily due to bug in macrotest: https://github.com/eupn/macrotest/issues/131 - - nightly-2025-11-20 + - nightly cargo_profile: - dev