Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,24 @@ install:
- chmod -R 777 $TRAVIS_BUILD_DIR

script:
- docker run -v$TRAVIS_BUILD_DIR:/phd chriscummins/phd_build:latest -c "./tools/flaky_bazel.sh run --config=travis //tools:whoami"
- >
docker run \
-u root \
-v$TRAVIS_BUILD_DIR:/phd \
-v/var/run/docker.sock:/var/run/docker.sock \
-v$HOME/.cache/bazel/_bazel_docker:/home/docker/.cache/bazel/_bazel_docker \
chriscummins/phd_build:latest \
-c "./tools/flaky_bazel.sh run --config=travis //tools:whoami"
- >
docker run \
-u root \
-v$TRAVIS_BUILD_DIR:/phd \
-v/var/run/docker.sock:/var/run/docker.sock \
-v$HOME/.cache/bazel/_bazel_docker:/home/docker/.cache/bazel/_bazel_docker \
--env COMMIT_RANGE=$TRAVIS_COMMIT_RANGE \
--env TEST_ARGS=--config=travis \
chriscummins/phd_build:latest \
-c "./third_party/bazel/ci.sh"

notifications:
email:
Expand Down
3 changes: 3 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
load("@build_stack_rules_proto//python:python_grpc_library.bzl", "python_grpc_library")

exports_files([
".travis.yml",
"README.md",
"INSTALL.md",
"CONTRIBUTING.md",
"WORKSPACE",
"version.txt",
"deployment.properties",
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ container_pull(
# Defined in //tools/docker/phd_build:Dockerfile
container_pull(
name = "phd_build",
digest = "sha256:47fa263c92568900f831c0cab664a97baabfafa9a3e31cff7fe058140a5ce629",
digest = "sha256:d4f29cd4f28b3276ecea0c672d2d53bfffbbdbbad5088853378bb06ae3d8d09d",
registry = "index.docker.io",
repository = "chriscummins/phd_build",
)
Expand Down
18 changes: 14 additions & 4 deletions third_party/bazel/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,20 @@
# value for COMMIT_RANGE.
# When running in Travis-CI, you can directly use the $TRAVIS_COMMIT_RANGE
# environment variable.

COMMIT_RANGE=${COMMIT_RANGE:-$(git merge-base origin/master HEAD)".."}

# Go to the root of the repo
cd "$(git rev-parse --show-toplevel)"

returncode=0

# Get a list of the current files in package form by querying Bazel.
files=()
for file in $(git diff --name-only ${COMMIT_RANGE}); do
files+=($(bazel query $file))
echo $(bazel query $file)
query_files=$(bazel query --keep_going --noshow_progress $file)
returncode=$((returncode + $?))
echo "$query_files"
files+=($query_files)
done

# Query for the associated buildables
Expand All @@ -62,6 +65,7 @@ buildables=$(bazel query \
if [[ ! -z $buildables ]]; then
echo "Building binaries"
bazel build $buildables
returncode=$((returncode + $?))
fi

tests=$(bazel query \
Expand All @@ -71,5 +75,11 @@ tests=$(bazel query \
# Run the tests if there were results
if [[ ! -z $tests ]]; then
echo "Running tests"
bazel test $tests
bazel test $TEST_ARGS $tests
returncode=$((returncode + $?))
fi

if [[ $returncode != 0 ]]; then
echo "There were errors" >&2
exit 1
fi
15 changes: 8 additions & 7 deletions tools/docker/phd_build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ ENV DEBIAN_FRONTEND noninteractive
# Install packages.
RUN apt-get update && apt-get install -y --no-install-recommends \
# Packages required to build code.
unzip \
apt-transport-https \
ca-certificates gnupg-agent \
g++ \
zlib1g-dev \
m4 \
ocl-icd-opencl-dev \
patch \
python \
apt-transport-https \
ca-certificates gnupg-agent \
python-dev \
software-properties-common \
texlive-full \
patch \
unzip \
zip \
m4 \
zlib1g-dev \
# Packages required to build matplotlib.
pkg-config \
libfreetype6-dev \
Expand Down Expand Up @@ -67,7 +68,7 @@ RUN apt update \
&& rm -rf /var/lib/apt/lists/*

# Install bazel.
ENV BAZEL_VERSION 2.0.0
ENV BAZEL_VERSION 3.1.0
RUN curl -L -o /tmp/bazel.sh https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \
bash /tmp/bazel.sh && rm /tmp/bazel.sh

Expand Down
4 changes: 2 additions & 2 deletions tools/flaky_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
set -eu
export max_attempts=5
export returncode=1
for _ in $(seq $max_attempts); do bazel $@ && {
for i in $(seq $max_attempts); do bazel $@ && {
returncode=0
break
} || echo "> returncode: $?"; done
} || echo "> flaky bazel attempt $i of $max_attempts, returncode: $?"; done
exit $returncode
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.04.25
20.04.26