Stop using xtask for clippy (#13223)

This fixes an extra 10 second delay when needing to recompile xtask, and
allows passing arbitrary clippy args (like --allow-dirty)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-06-18 13:49:44 -06:00 committed by GitHub
parent 490a75aee6
commit 6cea9813ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 9 deletions

View file

@ -51,6 +51,9 @@ jobs:
- name: Check unused dependencies - name: Check unused dependencies
uses: bnjbvr/cargo-machete@main uses: bnjbvr/cargo-machete@main
- name: Check licenses are present
run: script/check-licenses
- name: Check license generation - name: Check license generation
run: script/generate-licenses /tmp/zed_licenses_output run: script/generate-licenses /tmp/zed_licenses_output
@ -87,7 +90,7 @@ jobs:
clean: false clean: false
- name: cargo clippy - name: cargo clippy
run: cargo xtask clippy run: ./script/clippy
- name: Run tests - name: Run tests
uses: ./.github/actions/run_tests uses: ./.github/actions/run_tests
@ -114,7 +117,7 @@ jobs:
clean: false clean: false
- name: cargo clippy - name: cargo clippy
run: cargo xtask clippy run: ./script/clippy
- name: Run tests - name: Run tests
uses: ./.github/actions/run_tests uses: ./.github/actions/run_tests
@ -139,7 +142,7 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
- name: cargo clippy - name: cargo clippy
run: cargo xtask clippy run: ./script/clippy
- name: Build Zed - name: Build Zed
run: cargo build -p zed run: cargo build -p zed

View file

@ -27,7 +27,7 @@ jobs:
uses: ./.github/actions/check_style uses: ./.github/actions/check_style
- name: Run clippy - name: Run clippy
run: cargo xtask clippy run: ./script/clippy
tests: tests:
name: Run tests name: Run tests

View file

@ -32,7 +32,7 @@ jobs:
uses: ./.github/actions/check_style uses: ./.github/actions/check_style
- name: Run clippy - name: Run clippy
run: cargo xtask clippy run: ./script/clippy
tests: tests:
timeout-minutes: 60 timeout-minutes: 60
name: Run tests name: Run tests

View file

@ -1,7 +1,7 @@
[ [
{ {
"label": "clippy", "label": "clippy",
"command": "cargo", "command": "./script/clippy",
"args": ["xtask", "clippy"] "args": []
} }
] ]

20
script/check-licenses Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
check_license () {
for license in "LICENSE-AGPL" "LICENSE-GPL" "LICENSE-APACHE"; do
if [[ -L "$1/$license" ]]; then
return 0
elif [[ -e "$1/$license" ]]; then
echo "Error: $1/$license exists but is not a symlink."
exit 1
fi
done
echo "Error: $1 does not contain a license symlink"
exit 1
}
git ls-files **/*/Cargo.toml | while read cargo_toml; do
check_license $(dirname "$cargo_toml");
done

View file

@ -1,5 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euxo pipefail set -euo pipefail
cargo xtask clippy if [[ ! " $* " == *" -p "* && ! " $* " == *" --package "* ]]; then
set -- "$@" --workspace
fi
set -x
"${CARGO:-cargo}" clippy "$@" --release --all-targets --all-features -- --deny warnings