Skip to content

Commit d9d013d

Browse files
authored
ci(gcb): build quickstarts during install test (#6233)
In order to verify that our installed artifacts work, this PR compiles our quickstarts against our installed artifacts. Part of #6163
1 parent c364f19 commit d9d013d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

ci/cloudbuild/builds/cmake-install.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ set -eu
1818

1919
source "$(dirname "$0")/../../lib/init.sh"
2020
source module ci/cloudbuild/builds/lib/cmake.sh
21+
source module ci/etc/quickstart-config.sh
22+
source module ci/lib/io.sh
2123

2224
export CC=clang
2325
export CXX=clang++
@@ -141,4 +143,28 @@ while IFS= read -r -d '' f; do
141143
fi
142144
done < <(find "${INSTALL_PREFIX}" -type f -print0)
143145

146+
# Verify that our installed artifacts are usable by compiling our quickstart
147+
# binaries against our installed artifacts.
148+
for lib in $(quickstart::libraries); do
149+
mapfile -t run_args < <(quickstart::arguments "${lib}")
150+
io::log_h2 "Building quickstart: ${lib}"
151+
if [[ "${PROJECT_ID:-}" != "cloud-cpp-testing-resources" ]]; then
152+
run_args=() # Empties these args so we don't execute quickstarts below
153+
io::log_yellow "Not executing quickstarts," \
154+
"which can only run in GCB project 'cloud-cpp-testing-resources'"
155+
fi
156+
157+
io::log "[ CMake ]"
158+
src_dir="${PROJECT_ROOT}/google/cloud/${lib}/quickstart"
159+
bin_dir="${PROJECT_ROOT}/cmake-out/quickstart-${lib}"
160+
cmake -H"${src_dir}" -B"${bin_dir}" "-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX}"
161+
cmake --build "${bin_dir}"
162+
test "${#run_args[@]}" -ne 0 && "${bin_dir}/quickstart" "${run_args[@]}"
163+
164+
echo
165+
io::log "[ Make ]"
166+
make -C "${src_dir}"
167+
test "${#run_args[@]}" -ne 0 && "${src_dir}/quickstart" "${run_args[@]}"
168+
done
169+
144170
exit "${exit_code}"

ci/cloudbuild/fedora.Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,7 @@ RUN dnf makecache && dnf install -y java-latest-openjdk-devel
153153

154154
# Install Bazel because some of the builds need it.
155155
RUN /var/tmp/ci/install-bazel.sh
156+
157+
# Some of the above libraries may have installed in /usr/local, so make sure
158+
# those library directories will be found.
159+
RUN ldconfig /usr/local/lib*

0 commit comments

Comments
 (0)