mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 20:14:23 +08:00
CI: Use a cached copy of GoogleTest in CMake builds if possible
to minimize the possibility of errors downloading from GitHub PiperOrigin-RevId: 835321189 Change-Id: I16101c5a5ead106c5a9beb254dde31a2b5e5df75
This commit is contained in:
committed by
Copybara-Service
parent
8cd0e4447b
commit
8036cae8ac
@@ -16,4 +16,4 @@
|
||||
# Keep this in sync with the commit in the MODULE.bazel file.
|
||||
readonly ABSL_GOOGLETEST_VERSION="1.17.0"
|
||||
|
||||
readonly ABSL_GOOGLETEST_DOWNLOAD_URL="https://github.com/google/googletest/releases/download/v${ABSL_GOOGLETEST_VERSION}/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
ABSL_GOOGLETEST_DOWNLOAD_URL="https://github.com/google/googletest/releases/download/v${ABSL_GOOGLETEST_VERSION}/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
|
||||
@@ -26,6 +26,12 @@ fi
|
||||
|
||||
source "${ABSEIL_ROOT}/ci/cmake_common.sh"
|
||||
|
||||
# Avoid depending on GitHub by looking for a cached copy of GoogleTest.
|
||||
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz" ]]; then
|
||||
ABSL_GOOGLETEST_DOWNLOAD_URL="file:///distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
DOCKER_EXTRA_ARGS="--mount type=bind,source=${KOKORO_GFILE_DIR}/distdir,target=/distdir,readonly ${DOCKER_EXTRA_ARGS:-}"
|
||||
fi
|
||||
|
||||
source "${ABSEIL_ROOT}/ci/linux_docker_containers.sh"
|
||||
readonly DOCKER_CONTAINER=${LINUX_GCC_LATEST_CONTAINER}
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ fi
|
||||
|
||||
source "${ABSEIL_ROOT}/ci/cmake_common.sh"
|
||||
|
||||
# Avoid depending on GitHub by looking for a cached copy of GoogleTest.
|
||||
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz" ]]; then
|
||||
ABSL_GOOGLETEST_DOWNLOAD_URL="file:///distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
DOCKER_EXTRA_ARGS="--mount type=bind,source=${KOKORO_GFILE_DIR}/distdir,target=/distdir,readonly ${DOCKER_EXTRA_ARGS:-}"
|
||||
fi
|
||||
|
||||
if [[ -z ${ABSL_CMAKE_CXX_STANDARDS:-} ]]; then
|
||||
ABSL_CMAKE_CXX_STANDARDS="17 20"
|
||||
fi
|
||||
|
||||
@@ -22,6 +22,12 @@ fi
|
||||
|
||||
source "${ABSEIL_ROOT}/ci/cmake_common.sh"
|
||||
|
||||
# Avoid depending on GitHub by looking for a cached copy of GoogleTest.
|
||||
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz" ]]; then
|
||||
ABSL_GOOGLETEST_DOWNLOAD_URL="file:///distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
DOCKER_EXTRA_ARGS="--mount type=bind,source=${KOKORO_GFILE_DIR}/distdir,target=/distdir,readonly ${DOCKER_EXTRA_ARGS:-}"
|
||||
fi
|
||||
|
||||
if [[ -z ${ABSL_CMAKE_CXX_STANDARDS:-} ]]; then
|
||||
ABSL_CMAKE_CXX_STANDARDS="17"
|
||||
fi
|
||||
|
||||
@@ -31,6 +31,11 @@ ABSEIL_ROOT=$(realpath ${ABSEIL_ROOT})
|
||||
|
||||
source "${ABSEIL_ROOT}/ci/cmake_common.sh"
|
||||
|
||||
# Avoid depending on GitHub by looking for a cached copy of GoogleTest.
|
||||
if [[ -r "${KOKORO_GFILE_DIR:-}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz" ]]; then
|
||||
ABSL_GOOGLETEST_DOWNLOAD_URL="${KOKORO_GFILE_DIR}/distdir/googletest-${ABSL_GOOGLETEST_VERSION}.tar.gz"
|
||||
fi
|
||||
|
||||
if [[ -z ${ABSL_CMAKE_BUILD_TYPES:-} ]]; then
|
||||
ABSL_CMAKE_BUILD_TYPES="Debug"
|
||||
fi
|
||||
|
||||
@@ -17,7 +17,12 @@ SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
:: The version of GoogleTest to be used in the CMake tests in this directory.
|
||||
:: Keep this in sync with the version in the WORKSPACE file.
|
||||
SET ABSL_GOOGLETEST_VERSION=1.17.0
|
||||
SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/releases/download/v%ABSL_GOOGLETEST_VERSION%/googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz
|
||||
|
||||
IF EXIST %KOKORO_GFILE_DIR%\distdir\googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz (
|
||||
SET ABSL_GOOGLETEST_DOWNLOAD_URL=file://%KOKORO_GFILE_DIR%\distdir\googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz
|
||||
) ELSE (
|
||||
SET ABSL_GOOGLETEST_DOWNLOAD_URL=https://github.com/google/googletest/releases/download/v%ABSL_GOOGLETEST_VERSION%/googletest-%ABSL_GOOGLETEST_VERSION%.tar.gz
|
||||
)
|
||||
|
||||
:: Replace '\' with '/' in Windows paths for CMake.
|
||||
:: Note that this cannot go inside the IF block above, because BAT files are weird.
|
||||
|
||||
Reference in New Issue
Block a user