build.sh 732 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. #
  3. # Build file to set up and run tests
  4. set -ex
  5. # Install the latest Bazel version available
  6. use_bazel.sh latest
  7. bazel version
  8. # Print bazel testlogs to stdout when tests failed.
  9. function print_test_logs {
  10. # TODO(yannic): Only print logs of failing tests.
  11. testlogs_dir=$(bazel info bazel-testlogs)
  12. testlogs=$(find "${testlogs_dir}" -name "*.log")
  13. for log in $testlogs; do
  14. cat "${log}"
  15. done
  16. }
  17. # Change to repo root
  18. cd $(dirname $0)/../../..
  19. git submodule update --init --recursive
  20. trap print_test_logs EXIT
  21. bazel test --copt=-Werror --host_copt=-Werror \
  22. //:build_files_updated_unittest \
  23. //:protobuf_test \
  24. @com_google_protobuf//:cc_proto_blacklist_test
  25. trap - EXIT
  26. cd examples
  27. bazel build :all