diff --git a/.travis.yml b/.travis.yml index 484c9350d..f60a51967 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,12 @@ matrix: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-4.9', 'valgrind', 'ninja-build'] + # Bazel + - os: linux + compiler: gcc + install: ci/travis/install-bazel.sh + script: ci/travis/build-bazel.sh + # clang sanitizer - os: linux compiler: clang @@ -332,3 +338,31 @@ script: brew install nlohmann_json --HEAD ; brew test nlohmann_json ; fi + +# The following code is an excerpt from google-cloud-cpp. +# +# Copyright 2017 Google Inc. +# +# 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. + +cache: + directories: + # Cache the Bazel directories, in builds that do not use Bazel this is + # empty and trivial to cache. + - $HOME/.cache/bazel + timeout: 900 + +before_cache: + # Do not save the Bazel installation, reinstall each time, it fails to install + # if the installation is in the cache. + - rm -fr ${HOME}/.cache/bazel/_bazel_${USER}/install diff --git a/NOTICE b/NOTICE index 60d9568da..46858e802 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,5 @@ -This product contains modified files from google-cloud-cpp v0.11.0, which is -available under a "Apache 2.0" License. For details, see -cmake/CreateBazelConfig.cmake. +This product contains files and code excerpts from google-cloud-cpp, which is +available under a "Apache 2.0" License. Apache License Version 2.0, January 2004 diff --git a/ci/travis/build-bazel.sh b/ci/travis/build-bazel.sh new file mode 100644 index 000000000..f6d56a1e9 --- /dev/null +++ b/ci/travis/build-bazel.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export PATH=$PATH:$HOME/bin + +bazel build --test_output=errors --verbose_failures=true --keep_going -- //...:all diff --git a/ci/travis/install-bazel.sh b/ci/travis/install-bazel.sh new file mode 100755 index 000000000..b3d8c132c --- /dev/null +++ b/ci/travis/install-bazel.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# Copyright 2018 Google LLC +# +# 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 -eu + +sudo apt-get update +sudo apt-get install -y \ + gcc \ + g++ \ + unzip \ + wget \ + zip + +readonly BAZEL_VERSION=0.24.0 +readonly GITHUB_DL="https://github.com/bazelbuild/bazel/releases/download" +wget -q "${GITHUB_DL}/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" +chmod +x "bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" +./bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh --user