From c9aba6c10a6ae719c6739730c88e45a62eb8ac73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Fri, 28 Feb 2025 22:01:10 +0800 Subject: [PATCH] windows: Use a clippy script instead of `xtask` (#25807) Closes #ISSUE Match the behaviour of our macOS and Linux tests Release Notes: - N/A *or* Added/Fixed/Improved ... --- .github/workflows/ci.yml | 3 +-- script/clippy.ps1 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 script/clippy.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7819052f2..3d2503aa50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -273,8 +273,7 @@ jobs: - name: cargo clippy working-directory: ${{ env.ZED_WORKSPACE }} - # Windows can't run shell scripts, so we need to use `cargo xtask`. - run: cargo xtask clippy + run: ./script/clippy.ps1 - name: Run tests uses: ./.github/actions/run_tests_windows diff --git a/script/clippy.ps1 b/script/clippy.ps1 new file mode 100644 index 0000000000..329ff599f2 --- /dev/null +++ b/script/clippy.ps1 @@ -0,0 +1,21 @@ +$ErrorActionPreference = "Stop" + +$needAddWorkspace = $false +if ($args -notcontains "-p" -and $args -notcontains "--package") { + $needAddWorkspace = $true +} + +# https://stackoverflow.com/questions/41324882/how-to-run-a-powershell-script-with-verbose-output/70020655#70020655 +Set-PSDebug -Trace 2 + +$Cargo = $env:CARGO +if (-not $Cargo) { + $Cargo = "cargo" +} + +if ($needAddWorkspace) { + & $Cargo clippy @args --workspace --release --all-targets --all-features -- --deny warnings +} +else { + & $Cargo clippy @args --release --all-targets --all-features -- --deny warnings +}