0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-09 10:43:19 -05:00

Merge bitcoin/bitcoin#27429: ci: Run base install at most once

fa5af94de6 ci: Run base install at most once (MarcoFalke)

Pull request description:

  This should avoid errors when running it twice. For example, network errors on the second invocation of 'apt update'; or unguarded modifications such as APPEND_APT_SOURCES_LIST, which will append the same string repeatedly.

  The base install may be run twice in Cirrus CI with dockerfiles, or locally when running twice with DANGER_RUN_CI_ON_HOST specified.

ACKs for top commit:
  josibake:
    utACK fa5af94de6

Tree-SHA512: 020ba747e282076ddf10547025bb576ce626378d9f8313e09b1a5f99af1cf8237e44957aa4a0b8d64015bc730a090c83af0b3908a8eda15d3fb1ca7dae69dd7c
This commit is contained in:
fanquake 2023-04-07 07:41:51 +01:00
commit d6c2a46a4b
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
2 changed files with 18 additions and 11 deletions

View file

@ -6,6 +6,12 @@
export LC_ALL=C.UTF-8
CFG_DONE="ci.base-install-done" # Use a global git setting to remember whether this script ran to avoid running it twice
if [ "$(git config --global ${CFG_DONE})" == "true" ]; then
echo "Skip base install"
exit 0
fi
if [ -n "$DPKG_ADD_ARCH" ]; then
dpkg --add-architecture "$DPKG_ADD_ARCH"
@ -51,11 +57,9 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
fi
if [[ "${RUN_TIDY}" == "true" ]]; then
if [ ! -d "${DIR_IWYU}" ]; then
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
fi
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
fi
mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
@ -80,3 +84,5 @@ if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then
unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME"
yes | "${ANDROID_HOME}"/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_HOME}" --install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "platforms;android-${ANDROID_API_LEVEL}" "ndk;${ANDROID_NDK_VERSION}"
fi
git config --global ${CFG_DONE} "true"

View file

@ -55,14 +55,8 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
$CONTAINER_NAME)
export CI_CONTAINER_ID
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}"
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ro_base/ "$BASE_ROOT_DIR"
# Fixes permission issues when there is a container UID/GID mismatch with the owner
# of the mounted bitcoin src dir.
$CI_EXEC_CMD_PREFIX git config --global --add safe.directory "*"
else
echo "Running on host system without docker wrapper"
"${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
fi
CI_EXEC () {
@ -70,6 +64,13 @@ CI_EXEC () {
}
export -f CI_EXEC
CI_EXEC rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}" || echo "/ci_base_install/ missing"
CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
CI_EXEC rsync --archive --stats --human-readable /ro_base/ "${BASE_ROOT_DIR}" || echo "Nothing to copy from ro_base"
# Fixes permission issues when there is a container UID/GID mismatch with the owner
# of the git source code directory.
CI_EXEC git config --global --add safe.directory \"*\"
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
if [ "$CI_OS_NAME" == "macos" ]; then