Test HEAD bazel on travis.

- Add support for fetch HEAD bazel from their new setup.
- Switch travis to building with HEAD since bazel's ci is using the last release.
This commit is contained in:
Thomas Van Lenten 2018-02-28 16:40:41 -05:00
parent 08a89e561a
commit a60d9f83df
2 changed files with 26 additions and 11 deletions

View File

@ -9,7 +9,7 @@ matrix:
- os: linux
dist: trusty
sudo: false
env: BAZEL=RELEASE
env: BAZEL=HEAD
- os: linux
dist: trusty
sudo: false
@ -20,7 +20,7 @@ matrix:
- os: osx
osx_image: xcode9.2
env: BAZEL=RELEASE
env: BAZEL=HEAD
# No need for a BUILDIFER run on mac, the results will be the same.
# And linux boxes test faster on travis, so just use the one.

View File

@ -34,6 +34,18 @@ function github_latest_release_tag() {
| sed -e 's,https://.*/releases/tag/\(.*\),\1,'
}
# -------------------------------------------------------------------------------------------------
# Helper to get a download url out of bazel build metadata file.
function url_from_bazel_manifest() {
local MANIFEST_URL=$1
if [[ "${OS}" == "darwin" ]]; then
local JSON_OS="macos"
else
local JSON_OS="ubuntu1404"
fi
wget -O - "${MANIFEST_URL}" \
| python -c "import json; import sys; print json.load(sys.stdin)['platforms']['${JSON_OS}']['url']"
}
# -------------------------------------------------------------------------------------------------
# Helper to install bazel.
@ -46,18 +58,20 @@ function install_bazel() {
# macOS and trusty images have jdk8, so install bazel without jdk.
if [[ "${VERSION}" == "HEAD" ]]; then
# Still need a way to pull green build from buildkite.
# https://github.com/bazelbuild/continuous-integration/issues/95
echo "ERROR: Building of HEAD not currently supported."
exit 1
# bazelbuild/continuous-integration/issues/234 - they don't seem to have an installed
# just raw binaries?
mkdir -p "$HOME/bin"
wget -O "$HOME/bin/bazel" \
"$(url_from_bazel_manifest https://storage.googleapis.com/bazel-builds/metadata/latest.json)"
chmod +x "$HOME/bin/bazel"
else
URL="https://github.com/bazelbuild/bazel/releases/download/${VERSION}/bazel-${VERSION}-without-jdk-installer-${OS}-x86_64.sh"
wget -O install.sh \
"https://github.com/bazelbuild/bazel/releases/download/${VERSION}/bazel-${VERSION}-without-jdk-installer-${OS}-x86_64.sh"
chmod +x install.sh
./install.sh --user
rm -f install.sh
fi
wget -O install.sh "${URL}"
chmod +x install.sh
./install.sh --user
rm -f install.sh
bazel version
}
@ -81,6 +95,7 @@ function install_buildifier() {
URL="https://github.com/bazelbuild/buildtools/releases/download/${VERSION}/buildifier"
fi
mkdir -p "$HOME/bin"
wget -O "${HOME}/bin/buildifier" "${URL}"
chmod +x "${HOME}/bin/buildifier"
buildifier --version