ci: Add shellcheck for scripts (#20631)
Fixes shellcheck errors in script/* Adds a couple trailing newlines. Adds `script/shellcheck-scripts` and associated CI machinery. Current set ultra-conservative, does not output warnings, only errors.
This commit is contained in:
parent
5b317f60df
commit
5b9916e34b
10 changed files with 48 additions and 12 deletions
21
.github/workflows/script_checks.yml
vendored
Normal file
21
.github/workflows/script_checks.yml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
name: Script
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "script/**"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
name: "ShellCheck Scripts"
|
||||
if: github.repository_owner == 'zed-industries'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
- name: Shellcheck ./scripts
|
||||
run: |
|
||||
./script/shellcheck-scripts error
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
This script analyzes all the highlight.scm files in our embedded languages and extensions.
|
||||
It counts the number of unique instances of @{name} and the languages in which they are used.
|
||||
|
|
|
@ -69,7 +69,9 @@ strip --strip-debug "${target_dir}/${remote_server_triple}/release/remote_server
|
|||
|
||||
|
||||
# Ensure that remote_server does not depend on libssl nor libcrypto, as we got rid of these deps.
|
||||
! ldd "${target_dir}/${remote_server_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'
|
||||
if ldd "${target_dir}/${remote_server_triple}/release/remote_server" | grep -q 'libcrypto\|libssl'; then
|
||||
echo "Error: remote_server still depends on libssl or libcrypto" && exit 1
|
||||
fi
|
||||
|
||||
suffix=""
|
||||
if [ "$channel" != "stable" ]; then
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eu
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 <MAX_SIZE_IN_GB>"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
set -eu
|
||||
source script/lib/deploy-helpers.sh
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
if [[ $# != 1 ]]; then
|
||||
echo "Usage: $0 <production|staging> (postgrest not needed on preview or nightly)"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -eu
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <crate_name>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 [production|staging|...]"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -10,4 +10,4 @@ export GPUProfilerEnabled="YES"
|
|||
export METAL_DEBUG_ERROR_MODE=0
|
||||
export LD_LIBRARY_PATH="/Applications/Xcode.app/Contents/Developer/../SharedFrameworks/"
|
||||
|
||||
cargo run $@
|
||||
cargo run "$@"
|
||||
|
|
12
script/shellcheck-scripts
Executable file
12
script/shellcheck-scripts
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
mode=${1:-error}
|
||||
[[ "$mode" =~ ^(error|warning)$ ]] || { echo "Usage: $0 [error|warning]"; exit 1; }
|
||||
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
find script -maxdepth 1 -type f -print0 |
|
||||
xargs -0 grep -l -E '^#!(/bin/|/usr/bin/env )(sh|bash|dash)' |
|
||||
xargs -r shellcheck -x -S "$mode" -C
|
|
@ -19,12 +19,12 @@ if [[ -n "${1:-}" ]]; then
|
|||
target="$1"
|
||||
else
|
||||
echo "Error: Target '$1' is not allowed"
|
||||
echo "Usage: $0 [${allowed_targets[@]}]"
|
||||
echo "Usage: $0 [${allowed_targets[*]}]"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: Target is not specified"
|
||||
echo "Usage: $0 [${allowed_targets[@]}]"
|
||||
echo "Usage: $0 [${allowed_targets[*]}]"
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploading nightly for target: $target"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue