From 4cb96266a403ad903f75ea03304d4903709d0b1c Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 7 Nov 2024 15:34:18 -0800 Subject: [PATCH 1/2] refactor: use `is_none_or` for `clippy::nonminimal_bool` and resolve `clippy::needless_raw_string_hashes` (#231) Signed-off-by: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Co-authored-by: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> --- .github/actions/winget-install/action.yaml | 27 +++++++++++++--------- crates/wdk-build/src/utils.rs | 4 +--- crates/wdk-sys/build.rs | 4 ++-- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/actions/winget-install/action.yaml b/.github/actions/winget-install/action.yaml index fbffe5b7..a10a986e 100644 --- a/.github/actions/winget-install/action.yaml +++ b/.github/actions/winget-install/action.yaml @@ -7,22 +7,22 @@ inputs: runs: using: "composite" steps: - - name: Get URIs for Latest Winget assets + - name: Get URIs for Winget v1.8.1911 assets shell: pwsh run: | $AuthenticatedHeaders = @{ "Authorization" = "Bearer ${{ inputs.GITHUB_TOKEN }}" } - $LatestReleaseInfo = Invoke-RestMethod -Headers $AuthenticatedHeaders 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' - $LatestWingetDownloadUri = $LatestReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('.msixbundle') } - $LatestWingetLicenseDownloadUri = $LatestReleaseInfo.assets.browser_download_url | Where-Object { $_.EndsWith('License1.xml') } + $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') } # Print to logs - Write-Host "LatestWingetDownloadUri=$LatestWingetDownloadUri" - Write-Host "LatestWingetLicenseDownloadUri=$LatestWingetLicenseDownloadUri" + Write-Host "WingetDownloadUri=$WingetDownloadUri" + Write-Host "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" # Save output for next step - Write-Output "LatestWingetDownloadUri=$LatestWingetDownloadUri" >> $env:GITHUB_ENV - Write-Output "LatestWingetLicenseDownloadUri=$LatestWingetLicenseDownloadUri" >> $env:GITHUB_ENV + Write-Output "WingetDownloadUri=$WingetDownloadUri" >> $env:GITHUB_ENV + Write-Output "WingetLicenseDownloadUri=$WingetLicenseDownloadUri" >> $env:GITHUB_ENV - name: Download Winget Assets and Dependencies shell: pwsh @@ -30,14 +30,19 @@ runs: 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 - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:LatestWingetDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/winget.msixbundle - Invoke-WebRequest -Headers $AuthenticatedHeaders -Uri $env:LatestWingetLicenseDownloadUri -OutFile $env:RUNNER_TEMP/winget-install/license.xml + 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 + - 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 + - name: Install Winget for Current User (for better install diagnostics) + shell: powershell + run: | + Add-AppxPackage $env:RUNNER_TEMP/winget-install/winget.msixbundle + - name: Wait for Completion of Winget Installation shell: pwsh run: | diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index c8b6a3ee..4f4f6351 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -234,9 +234,7 @@ pub fn validate_wdk_version_format>(version_string: S) -> bool { let version_parts: Vec<&str> = version.split('.').collect(); // First, check if we have "10" as our first value - if !version_parts.first().is_some_and(|first| *first == "10") { - // FIXME: Once is_some_or is stabilized, replace the above with: - // if version_parts.first().is_none_or(|first| *first != "10") { + if version_parts.first().is_none_or(|first| *first != "10") { return false; } diff --git a/crates/wdk-sys/build.rs b/crates/wdk-sys/build.rs index f0b37dd7..37f350f3 100644 --- a/crates/wdk-sys/build.rs +++ b/crates/wdk-sys/build.rs @@ -127,13 +127,13 @@ macro_rules! call_unsafe_wdf_function_binding {{ }}"# ); static ref TEST_STUBS_TEMPLATE: String = format!( - r#" + r" use crate::WDFFUNC; /// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile #[no_mangle] pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null(); -"#, +", ); } From f46394e52071639f0605c9f6365f67e10c3f17e3 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 7 Nov 2024 15:35:28 -0800 Subject: [PATCH 2/2] docs: add release instructions (#228) --- RELEASE.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 RELEASE.md diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..567cc08e --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,23 @@ +## Release Process + +The release process for this repository leverages [`release-plz`](https://github.com/MarcoIeni/release-plz) to automate some of the steps. Only maintainers with the necessary permissions can release new versions of this repository. + +1. Install `release-plz`: One option is by running `cargo install --locked release-plz` +1. Checkout the latest code on `main` branch +1. Create a release PR: `release-plz release-pr --git-token ` +1. In the Pull Request: + 1. Check that the new versions automatically determined by `release-plz` make sense + 1. In the PR description, if there are API-breaking changes detected for a crate, make sure that that crate shows a major semver bump + 1. If no API-breaking changes are detected, [conventional commits](https://www.conventionalcommits.org/) will be used to determine what type of version bump it should be. This means that `release-plz` may say there are no API-breaking changes detected, but there may still be a major version bump if the commit titles suggest there is a change that warrants it. + 1. If the versions are not what you expect, you can manually override them by running `release-plz set-version `. This will update the package versions and the changelogs, but the PR description may need manual editing. +1. Checkout the generated release branch locally in order to: + 1. Update all docs to reflect new versions + 1. Update all `cargo-make` files to use the new versions (ex. for `wdk-build` in [rust-driver-makefile.toml](./crates/wdk-build/rust-driver-makefile.toml)) + 1. Update all the [example drivers](./examples/) and [workspace-level tests](./tests/) to use new versions. These are not part of the same `cargo-workspace` as the rest of the crates, so they need to be updated manually. + 1. Check that the release notes are correct and edit as needed +1. Do a last sanity check of all of the [example drivers](./examples/) (i.e. install and verify that all logs are as expected) +1. Run `release-plz release --dry-run` to check that the release will be successful +1. Merge the release Pull Request +1. Run `release-plz release` + 1. This will release the crates to crates.io and create draft releases on Github +1. Publish all the Github releases