Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -Werror during diff time build #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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"]