Skip to content

Commit

Permalink
Use -Werror during diff time build (#198)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #198

Differential Revision: D36138984

fbshipit-source-id: 7ee393b92335caf05e04ff10bda49a74414841f0
  • Loading branch information
adshastri authored and facebook-github-bot committed May 4, 2022
1 parent ea4765c commit f2bf999
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ jobs:

- name: Build fbpcf docker image
run: |
./build-docker.sh -u
# The "-d" flag builds the library with -Werror
# so we can catch warnings at diff time.
./build-docker.sh -u -d
- name: Sanity check fbpcf library
timeout-minutes: 3
Expand Down
11 changes: 10 additions & 1 deletion build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Usage: $PROG_NAME [-u] [-f] [-t TAG]
-u: builds the docker images against ubuntu (default)
-f: forces a rebuild of all docker image dependencies (even if they already exist)
-d: whether to build in dev mode. This sets the -Werror flag during the cmake build.
-t TAG: Use the specified tag for the built image (default: latest)
EOF
exit 1
Expand All @@ -32,14 +33,16 @@ OS_RELEASE="${UBUNTU_RELEASE}"
DOCKER_EXTENSION=".ubuntu"
FORCE_REBUILD=false
TAG="latest"
while getopts "u,f,t:" o; do
DEV_MODE=false
while getopts "u,f,d,t:" o; do
case $o in
u)
IMAGE_PREFIX="ubuntu"
OS_RELEASE="${UBUNTU_RELEASE}"
DOCKER_EXTENSION=".ubuntu"
;;
f) FORCE_REBUILD=true ;;
d) DEV_MODE=true ;;
t) TAG=$OPTARG;;
*) usage ;;
esac
Expand Down Expand Up @@ -91,11 +94,17 @@ build_dep_image "${FOLLY_IMAGE}" "folly" "--build-arg os_release=${OS_RELEASE} -
FOLLY_IMAGE="${RETURN}"

printf "\nBuilding fbpcf/%s docker image...\n" ${IMAGE_PREFIX}
CMAKE_FLAGS=""
if [ "${DEV_MODE}" == true ]; then
printf "Using dev mode. Passing -Werror to cmake."
CMAKE_FLAGS="-Werror"
fi
docker build \
--build-arg os_release="${OS_RELEASE}" \
--build-arg emp_image="${EMP_IMAGE}" \
--build-arg aws_image="${AWS_IMAGE}" \
--build-arg folly_image="${FOLLY_IMAGE}" \
--build-arg gcp_image="${GCP_IMAGE}" \
--build-arg cmake_flags="${CMAKE_FLAGS}" \
--compress \
-t "fbpcf/${IMAGE_PREFIX}:${TAG}" -f "docker/Dockerfile${DOCKER_EXTENSION}" .
3 changes: 2 additions & 1 deletion docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ARG emp_image="fbpcf/ubuntu-emp:0.2.3"
ARG aws_image="fbpcf/ubuntu-aws-s3-core:1.8.177"
ARG folly_image="fbpcf/ubuntu-folly:2021.03.29.00"
ARG gcp_image="fbpcf/ubuntu-gcp-cloud-cpp:1.32.1"
ARG cmake_flags=""

FROM ${emp_image} as emp
FROM ${aws_image} as aws
Expand Down Expand Up @@ -57,7 +58,7 @@ COPY example/ ./example
# Link all libraries post-install
RUN ldconfig

RUN cmake . -DTHREADING=ON -DEMP_USE_RANDOM_DEVICE=ON
RUN cmake . -DTHREADING=ON -DEMP_USE_RANDOM_DEVICE=ON $cmake_flags
RUN make && make install

CMD ["/bin/bash"]

0 comments on commit f2bf999

Please sign in to comment.