mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-04-19 03:01:06 -04:00
**What type of PR is this?** Other **What does this PR do? Why is it needed?** This wont pass til #16252 merges **Which issues(s) does this PR fix?** **Other notes for review** **Acknowledgements** - [x] I have read [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md). - [x] I have included a uniquely named [changelog fragment file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd). - [x] I have added a description with sufficient context for reviewers to understand this PR. - [x] I have tested that my changes work as expected and I added a testing plan to the PR description (if applicable).
46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Continuous Integration script to check that BUILD.bazel files and deps.bzl
|
|
# are as expected when generated from gazelle.
|
|
|
|
set -euo pipefail
|
|
|
|
exit_code=0
|
|
|
|
# Duplicate redirect 5 to stdout so that it can be captured, but still printed
|
|
# nicely.
|
|
exec 5>&1
|
|
|
|
echo "Checking deps.bzl is in sync with go.mod..."
|
|
bazel --batch --bazelrc=.buildkite-bazelrc run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true
|
|
|
|
if git diff --exit-code deps.bzl; then
|
|
echo "OK: deps.bzl is in sync with go.mod"
|
|
else
|
|
echo ""
|
|
echo "FAIL: deps.bzl is out of sync with go.mod"
|
|
exit_code=1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Checking BUILD.bazel files..."
|
|
build_changes=$(bazel --batch --bazelrc=.buildkite-bazelrc run //:gazelle -- fix --mode=diff | tee >(cat - >&5)) || true
|
|
|
|
if [ -z "$build_changes" ]; then
|
|
echo "OK: BUILD.bazel files are in sync"
|
|
else
|
|
echo "FAIL: BUILD.bazel files are out of sync"
|
|
exit_code=1
|
|
fi
|
|
|
|
echo ""
|
|
if [ $exit_code -eq 0 ]; then
|
|
echo "All gazelle checks passed"
|
|
else
|
|
echo "Gazelle checks failed. Please run:"
|
|
echo " bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true"
|
|
echo " bazel run //:gazelle -- fix"
|
|
fi
|
|
|
|
exit $exit_code
|