-
Notifications
You must be signed in to change notification settings - Fork 160
Expand file tree
/
Copy pathpresubmit
More file actions
executable file
·37 lines (30 loc) · 964 Bytes
/
presubmit
File metadata and controls
executable file
·37 lines (30 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# Script to run presubmit checks. Devs can run this script locally before sending out PRs for review to ensure
# CI is passing for their PR.
set -e
cd "$(dirname "$0")/.."
export -f f
FMT_COMMAND="cargo fmt"
echo "Running $FMT_COMMAND..."
set -e
EXIT_CODE=0
# shellcheck enable=SC2000
$FMT_COMMAND -- --check || EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo 'Run `'$FMT_COMMAND'` to fix.'
exit $EXIT_CODE
fi
echo "Cargo fmt succeeded..."
echo "Running more restrictive clippy against the current diff..."
cargo-clippy-diff origin/main HEAD -- --no-deps -- -W clippy::unwrap_used -W clippy::unwrap_in_result
echo "Running clippy..."
cargo clippy --tests -- -D warnings
echo "clippy succeeded..."
echo "Running cargo test..."
cargo test
echo "Tests succeeded..."
for file in specs/*/*.yaml; do
echo "Validating '$file'..."
jsonschema-cli validate ./schemas/workflow.json "$file"
done
echo "Congrats! All presubmits checks passed."