ci: travis infrastructure and bazel.build target to validate protos build. (#18)

This is a slimmed down version of what we have for
https://github.com/lyft/envoy/.
pull/17/head
htuch 8 years ago committed by GitHub
parent 94e4ef1f80
commit ad1673648d
  1. 15
      .travis.yml
  2. 36
      ci/build_setup.sh
  3. 17
      ci/ci_steps.sh
  4. 18
      ci/do_ci.sh
  5. 11
      ci/run_envoy_docker.sh

@ -0,0 +1,15 @@
language: minimal
sudo: required
services:
- docker
install:
- gem install travis --no-rdoc --no-ri
matrix:
fast_finish: true
env:
- TEST_TYPE=bazel.build
script: ./ci/ci_steps.sh
branches:
only:
- master

@ -0,0 +1,36 @@
#!/bin/bash
# Configure environment variables for Bazel build and test.
set -e
NUM_CPUS=`grep -c ^processor /proc/cpuinfo`
export ENVOY_SRCDIR=/source
export BUILD_DIR=/build
if [[ ! -d "${BUILD_DIR}" ]]
then
echo "${BUILD_DIR} mount missing - did you forget -v <something>:${BUILD_DIR}?"
exit 1
fi
# Environment setup.
export USER=bazel
export TEST_TMPDIR=/build/tmp
export BAZEL="bazel"
# Not sandboxing, since non-privileged Docker can't do nested namespaces.
BAZEL_OPTIONS="--package_path %workspace%:/source"
export BAZEL_QUERY_OPTIONS="${BAZEL_OPTIONS}"
export BAZEL_BUILD_OPTIONS="--strategy=Genrule=standalone --spawn_strategy=standalone \
--verbose_failures ${BAZEL_OPTIONS} --jobs=${NUM_CPUS}"
export BAZEL_TEST_OPTIONS="${BAZEL_BUILD_OPTIONS} --cache_test_results=no --test_output=all"
[[ "${BAZEL_EXPUNGE}" == "1" ]] && "${BAZEL}" clean --expunge
function cleanup() {
# Remove build artifacts. This doesn't mess with incremental builds as these
# are just symlinks.
rm -f "${ENVOY_SRCDIR}"/bazel-*
}
trap cleanup EXIT

@ -0,0 +1,17 @@
#!/bin/bash
# Script that lists all the steps take by the CI system when doing Envoy builds.
set -e
# We reuse the https://github.com/lyft/envoy/ CI image here to get Bazel.
ENVOY_BUILD_SHA=22c55f8ec756c5ddeb26c3424e128a91aec23116
# Lint travis file.
travis lint .travis.yml --skip-completion-check
# Where the Envoy build takes place.
export ENVOY_API_BUILD_DIR=/tmp/envoy-api-docker-build
# Do a build matrix with different types of builds docs, coverage, bazel.release, etc.
docker run -t -i -v "$ENVOY_API_BUILD_DIR":/build -v $TRAVIS_BUILD_DIR:/source \
lyft/envoy-build:$ENVOY_BUILD_SHA /bin/bash -c "cd /source && ci/do_ci.sh $TEST_TYPE"

@ -0,0 +1,18 @@
#!/bin/bash
# Run a CI build/test target, e.g. docs, asan.
set -e
. "$(dirname "$0")"/build_setup.sh
echo "building using ${NUM_CPUS} CPUs"
if [[ "$1" == "bazel.build" ]]; then
echo "bazel build..."
bazel --batch build ${BAZEL_BUILD_OPTIONS} //...
exit 0
else
echo "Invalid do_ci.sh target, see ci/README.md for valid targets."
exit 1
fi

@ -0,0 +1,11 @@
#!/bin/bash
set -e
[[ -z "${IMAGE_ID}" ]] && IMAGE_ID="latest"
[[ -z "${ENVOY_API_DOCKER_BUILD_DIR}" ]] && ENVOY_API_DOCKER_BUILD_DIR=/tmp/envoy-api-docker-build
mkdir -p "${ENVOY_API_DOCKER_BUILD_DIR}"
docker pull lyft/envoy-build:"${IMAGE_ID}"
docker run -t -i -u $(id -u):$(id -g) -v "${ENVOY_API_DOCKER_BUILD_DIR}":/build \
-v "$PWD":/source lyft/envoy-build:"${IMAGE_ID}" /bin/bash -c "cd source && $*"
Loading…
Cancel
Save