Skip to content

Commit

Permalink
Add job to test CMake builds of tink-cc with preinstalled dependencies
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 590985176
Change-Id: I426b3e3e9adb7e2b44d24f0b18f2c311d01d94f7
  • Loading branch information
morambro authored and copybara-github committed Dec 14, 2023
1 parent b9eb8ad commit 785345f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
52 changes: 52 additions & 0 deletions kokoro/gcp_ubuntu/cmake_installed_deps/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

# Builds and tests tink-cc and its examples using CMake with preinstalled deps.
#
# The behavior of this script can be modified using the following optional env
# variables:
#
# - CONTAINER_IMAGE (unset by default): By default when run locally this script
# executes tests directly on the host. The CONTAINER_IMAGE variable can be set
# to execute tests in a custom container image for local testing. E.g.:
#
# CONTAINER_IMAGE="us-docker.pkg.dev/tink-test-infrastructure/tink-ci-images/linux-tink-cc-cmake-installed-deps:latest" \
# sh ./kokoro/gcp_ubuntu/cmake_installed_deps/run_tests.sh
#
set -euo pipefail

RUN_COMMAND_ARGS=()
if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]]; then
readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)"
cd "${TINK_BASE_DIR}/tink_cc"
source kokoro/testutils/cc_test_container_images.sh
CONTAINER_IMAGE="${TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE}"
RUN_COMMAND_ARGS+=( -k "${TINK_GCR_SERVICE_KEY}" )
fi
readonly CONTAINER_IMAGE

if [[ -n "${CONTAINER_IMAGE:-}" ]]; then
RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" )
fi

./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \
./kokoro/testutils/run_cmake_tests.sh . -DTINK_USE_SYSTEM_OPENSSL=ON \
-DTINK_USE_INSTALLED_ABSEIL=ON -DTINK_USE_INSTALLED_GOOGLETEST=ON

./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" \
./kokoro/testutils/run_cmake_tests.sh "examples" \
-DTINK_USE_SYSTEM_OPENSSL=ON -DTINK_USE_INSTALLED_ABSEIL=ON \
-DTINK_USE_INSTALLED_GOOGLETEST=ON
4 changes: 4 additions & 0 deletions kokoro/testutils/cc_test_container_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ readonly TINK_CC_CMAKE_AND_OPENSSL_3_IMAGE_NAME="linux-tink-cc-cmake-and-openssl
readonly TINK_CC_CMAKE_AND_OPENSSL_3_IMAGE_HASH="8e890867759c120d91b4e5726a38e644acfc365a172bbedb1f72bb03e4befaaf"
readonly TINK_CC_CMAKE_AND_OPENSSL_3_IMAGE="$(_image_prefix)/${TINK_CC_CMAKE_AND_OPENSSL_3_IMAGE_NAME}@sha256:${TINK_CC_CMAKE_AND_OPENSSL_3_IMAGE_HASH}"

readonly TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE_NAME="linux-tink-cc-cmake-installed-deps"
readonly TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE_HASH="8cac4bb649d41314988fd6f1844f706b4df67e9d98f5f1810d95e900b69825de"
readonly TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE="$(_image_prefix)/${TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE_NAME}@sha256:${TINK_CC_CMAKE_WITH_INSTALLED_DEPS_IMAGE_HASH}"

unset -f _image_prefix

0 comments on commit 785345f

Please sign in to comment.