Debian Codegraph @

debian/missing-sources/zerocopy/githooks/pre-push

raw symbols SCIP
1 #!/usr/bin/env bash
2 #
3 # Copyright 2024 The Fuchsia Authors
4 #
5 # Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
6 # <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
7 # license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
8 # This file may not be copied, modified, or distributed except according to
9 # those terms.
10
11 set -eo pipefail
12 echo "Running pre-push git hook: $0"
13 # Forego redirecting stdout to /dev/null on check_fmt.sh because the output from
14 # `cargo fmt` is useful (and the good stuff is not delivered by stderr).
15 #
16 # Background all jobs and wait for them so they can run in parallel.
17 ./ci/check_actions.sh & ACTIONS_PID=$!
18 ./ci/check_fmt.sh & FMT_PID=$!
19 ./ci/check_all_toolchains_tested.sh >/dev/null & TOOLCHAINS_PID=$!
20 ./ci/check_job_dependencies.sh >/dev/null & JOB_DEPS_PID=$!
21 ./ci/check_readme.sh >/dev/null & README_PID=$!
22 ./ci/check_stale_stderr.sh >/dev/null & STALE_STDERR_PID=$!
23 ./ci/check_todo.sh >/dev/null & XODO_PID=$!
24 ./ci/check_versions.sh >/dev/null & VERSIONS_PID=$!
25 ./ci/check_msrv_is_minimal.sh >/dev/null & MSRV_PID=$!
26
27 # `wait <pid>` exits with the same status code as the job it's waiting for.
28 # Since we `set -e` above, this will have the effect of causing the entire
29 # script to exit with a non-zero status code if any of these jobs does the same.
30 # Note that, while `wait` (with no PID argument) waits for all backgrounded
31 # jobs, it exits with code 0 even if one of the backgrounded jobs does not, so
32 # we can't use it here.
33 wait $ACTIONS_PID
34 wait $FMT_PID
35 wait $TOOLCHAINS_PID
36 wait $JOB_DEPS_PID
37 wait $README_PID
38 wait $STALE_STDERR_PID
39 wait $XODO_PID
40 wait $VERSIONS_PID
41 wait $MSRV_PID
42
43 # Ensure that this script calls all scripts in `ci/*`. This isn't a foolproof
44 # check since it just checks for the string in this script (e.g., it could be in
45 # a comment, which would trigger a false positive), but it should catch obvious
46 # errors. Also note that this entire hook is a nice-to-have - failures that
47 # aren't caught here will still be caught in CI.
48 #
49 # This was added because, in #728, we added `ci/check_all_toolchains_tested.sh`
50 # without calling it from this script.
51 GLOBIGNORE="./*/release_crate_version.sh" # We don't want to run this one
52 for f in ./ci/*; do
53 grep "$f" githooks/pre-push >/dev/null || { echo "$f not called from githooks/pre-push" >&2 ; exit 1; }
54 done
55 unset GLOBIGNORE