Add bazel distribtests (minimalist version that only tests with bazel 3.x and 4.x) (#27486)

* Make repo globally buildable

* Add initial distrib test script

* Add test script

* Support multiple versions

* Split out a separate latest version test

* Integrate with kokoro

* make tools/bazel version overridable

* added simplified test_single_bazel_version.sh

* cleanup .bazelignore

* only test 3.x and 4.x

* always test all the bazel versions

* revert unnecessary changes

* revert unnecessary changes

* fix shellcheck error

Co-authored-by: Richard Belleville <rbellevi@google.com>
pull/27500/head
Jan Tattermusch 3 years ago committed by GitHub
parent 044253e5bd
commit fa8a122862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .bazelignore
  2. 36
      test/distrib/bazel/run_bazel_distrib_test.sh
  3. 27
      test/distrib/bazel/test_latest_bazel_version.sh
  4. 45
      test/distrib/bazel/test_single_bazel_version.sh
  5. 2
      tools/bazel
  6. 26
      tools/internal_ci/linux/grpc_bazel_distribtest.cfg
  7. 25
      tools/internal_ci/linux/grpc_bazel_distribtest.sh
  8. 26
      tools/internal_ci/linux/grpc_bazel_distribtest_latest.cfg
  9. 25
      tools/internal_ci/linux/grpc_bazel_distribtest_latest.sh

@ -6,12 +6,22 @@ bins
libs
objs
third_party/abseil-cpp
third_party/benchmark
third_party/boringssl
third_party/bloaty
third_party/boringssl-with-bazel
third_party/envoy-api
third_party/googleapis
third_party/googletest
third_party/opencensus-proto
third_party/protobuf
third_party/protoc-gen-validate
third_party/re2
third_party/udpa
third_party/upb
bazel/test/python_test_repo
# Directories generated by setuptools build containing BUILD files.
src/python/grpcio_tests/src/
tools/distrib/python/grpcio_tools/grpc_root/

@ -0,0 +1,36 @@
#!/usr/bin/env bash
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
cd "$(dirname "$0")"
# TODO(jtattermusch): make build work with bazel 2.2.0 and bazel 1.2.1 if that's reasonably simple.
SUPPORTED_VERSIONS=(
"3.7.2"
"4.0.0"
)
FAILED_VERSIONS=""
for VERSION in "${SUPPORTED_VERSIONS[@]}"; do
echo "Running bazel distribtest with bazel version ${VERSION}"
./test_single_bazel_version.sh "${VERSION}" || FAILED_VERSIONS="${FAILED_VERSIONS}${VERSION} "
done
if [ "$FAILED_VERSIONS" != "" ]
then
echo "Bazel distribtest failed: Failed to build with bazel versions ${FAILED_VERSIONS}"
exit 1
fi

@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
cd "$(dirname "$0")"
GITHUB_URL="https://github.com"
REPO="bazelbuild/bazel"
VERSION=$(curl -Ls "${GITHUB_URL}/${REPO}/releases/latest" | \
grep "href=.*\.tar.gz" | \
grep -o "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*")
./test_single_bazel_version.sh "$VERSION"

@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -ex
if [ "$#" != "1" ] ; then
echo "Must supply bazel version to be tested." >/dev/stderr
exit 1
fi
VERSION="$1"
cd "$(dirname "$0")"/../../..
EXCLUDED_TARGETS=(
# iOS platform fails the analysis phase since there is no toolchain available
# for it.
"-//src/objective-c/..."
"-//third_party/objective_c/..."
# This could be a legitmate failure due to bitrot.
"-//src/proto/grpc/testing:test_gen_proto"
# This appears to be a legitimately broken BUILD file. There's a reference to
# a non-existent "link_dynamic_library.sh".
"-//third_party/toolchains/bazel_0.26.0_rbe_windows:all"
# TODO(jtattermusch): add back once fixed
"-//examples/android/binder/..."
)
export OVERRIDE_BAZEL_VERSION="$VERSION"
bazel build -- //... "${EXCLUDED_TARGETS[@]}"

@ -42,7 +42,7 @@ fi
# IMPORTANT: if you update the version here, other parts of infrastructure might needs updating as well
# (e.g. win RBE builds, sanity checks, bazel toolchains etc.)
VERSION=4.2.1
VERSION=${OVERRIDE_BAZEL_VERSION:-4.2.1}
echo "INFO: Running bazel wrapper (see //tools/bazel for details), bazel version $VERSION will be used instead of system-wide bazel installation." >&2
# update tools/update_mirror.sh to populate the mirror with new bazel archives

@ -0,0 +1,26 @@
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Config file for the internal CI (in protobuf text format)
# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_bazel_distribtest.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
regex: "github/grpc/artifacts/**"
}
}

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Build portability tests with an updated submodule
set -ex
# change to grpc repo root
cd $(dirname $0)/../../..
source tools/internal_ci/helper_scripts/prepare_build_linux_rc
./test/distrib/bazel/run_bazel_distrib_test.sh

@ -0,0 +1,26 @@
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Config file for the internal CI (in protobuf text format)
# Location of the continuous shell script in repository.
build_file: "tools/internal_ci/linux/grpc_bazel_distribtest_latest.sh"
timeout_mins: 120
action {
define_artifacts {
regex: "**/*sponge_log.*"
regex: "github/grpc/reports/**"
regex: "github/grpc/artifacts/**"
}
}

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Build portability tests with an updated submodule
set -ex
# change to grpc repo root
cd $(dirname $0)/../../..
source tools/internal_ci/helper_scripts/prepare_build_linux_rc
./test/distrib/bazel/test_latest_bazel_version.sh
Loading…
Cancel
Save