build.sh 669 B

123456789101112131415161718192021222324252627282930
  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 :build_files_updated_unittest :protobuf_test --copt=-Werror --host_copt=-Werror
  22. trap - EXIT
  23. cd examples
  24. bazel build :all