Add Bazel build to the ci

This commit is contained in:
Tommy Nguyen 2019-07-26 18:55:42 -04:00
parent 88b5952c3c
commit 18c9349a8c
No known key found for this signature in database
GPG Key ID: 8E347123F020B734
4 changed files with 72 additions and 3 deletions

View File

@ -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

5
NOTICE
View File

@ -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

5
ci/travis/build-bazel.sh Normal file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
export PATH=$PATH:$HOME/bin
bazel build --test_output=errors --verbose_failures=true --keep_going -- //...:all

31
ci/travis/install-bazel.sh Executable file
View File

@ -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