2021-12-13 07:54:31 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2023-08-16 19:27:31 +02:00
|
|
|
# Copyright (c) 2019-2020 The Bitcoin Core developers
|
2021-12-13 07:54:31 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
export LC_ALL=C.UTF-8
|
|
|
|
|
2019-12-04 19:22:23 +01:00
|
|
|
# The root dir.
|
|
|
|
# The ci system copies this folder.
|
2020-04-28 17:49:43 +02:00
|
|
|
# This is where the depends build is done.
|
2019-12-04 19:22:23 +01:00
|
|
|
BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
|
|
|
|
export BASE_ROOT_DIR
|
|
|
|
|
2019-09-24 22:22:24 +02:00
|
|
|
echo "Setting specific values in env"
|
|
|
|
if [ -n "${FILE_ENV}" ]; then
|
|
|
|
set -o errexit;
|
|
|
|
# shellcheck disable=SC1090
|
|
|
|
source "${FILE_ENV}"
|
|
|
|
fi
|
2021-12-13 07:54:31 +01:00
|
|
|
|
2022-04-07 18:03:41 +02:00
|
|
|
export BUILD_TARGET=${BUILD_TARGET:-linux64}
|
|
|
|
export PULL_REQUEST=${PULL_REQUEST:-false}
|
|
|
|
export JOB_NUMBER=${JOB_NUMBER:-1}
|
|
|
|
|
2019-09-24 22:22:24 +02:00
|
|
|
echo "Fallback to default values in env (if not yet set)"
|
2019-08-27 21:44:57 +02:00
|
|
|
# The number of parallel jobs to pass down to make and test_runner.py
|
2022-04-07 18:03:41 +02:00
|
|
|
MAKEJOBS="-j$(nproc)"
|
|
|
|
export MAKEJOBS
|
2019-08-27 21:44:57 +02:00
|
|
|
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
|
2019-12-03 17:00:58 +01:00
|
|
|
# This folder only exists on the ci host.
|
2020-04-13 17:44:59 +02:00
|
|
|
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
|
2022-06-22 19:17:47 +02:00
|
|
|
# What host to compile for. See also ./depends/README.md
|
|
|
|
# Tests that need cross-compilation export the appropriate HOST.
|
|
|
|
# Tests that run natively guess the host
|
|
|
|
export HOST=${HOST:-$("$BASE_ROOT_DIR/depends/config.guess")}
|
2019-09-30 23:26:22 +02:00
|
|
|
# Whether to prefer BusyBox over GNU utilities
|
|
|
|
export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
|
2020-07-14 08:38:37 +02:00
|
|
|
|
2021-12-13 07:54:31 +01:00
|
|
|
export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
|
2024-01-19 22:48:01 +01:00
|
|
|
export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
|
2023-06-04 19:52:35 +02:00
|
|
|
export RUN_SECURITY_TESTS=${RUN_SECURITY_TESTS:-false}
|
2020-08-15 15:38:51 +02:00
|
|
|
# By how much to scale the test_runner timeouts (option --timeout-factor).
|
|
|
|
# This is needed because some ci machines have slow CPU or disk, so sanitizers
|
|
|
|
# might be slow or a reindex might be waiting on disk IO.
|
|
|
|
export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-4}
|
2020-05-21 09:10:52 +02:00
|
|
|
export TEST_RUNNER_ENV=${TEST_RUNNER_ENV:-}
|
2021-12-13 07:54:31 +01:00
|
|
|
export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
|
2024-03-27 19:10:59 +01:00
|
|
|
export RUN_SYMBOL_TESTS=${RUN_SYMBOL_TESTS:-false}
|
2020-07-14 08:38:37 +02:00
|
|
|
export EXPECTED_TESTS_DURATION_IN_SECONDS=${EXPECTED_TESTS_DURATION_IN_SECONDS:-1000}
|
|
|
|
|
2020-02-10 14:50:29 +01:00
|
|
|
export CONTAINER_NAME=${CONTAINER_NAME:-ci_unnamed}
|
2023-05-10 11:52:49 +02:00
|
|
|
export DOCKER_NAME_TAG=${DOCKER_NAME_TAG:-ubuntu:focal}
|
2019-09-24 22:22:24 +02:00
|
|
|
# Randomize test order.
|
|
|
|
# See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html
|
|
|
|
export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1}
|
2020-05-19 09:48:39 +02:00
|
|
|
# See man 7 debconf
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2022-04-07 18:03:41 +02:00
|
|
|
export HOST_CACHE_DIR=${HOST_CACHE_DIR:-$BASE_ROOT_DIR/ci-cache-$BUILD_TARGET}
|
|
|
|
export CACHE_DIR=${CACHE_DIR:-$HOST_CACHE_DIR}
|
2021-12-13 07:54:31 +01:00
|
|
|
export CCACHE_SIZE=${CCACHE_SIZE:-100M}
|
|
|
|
export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
|
|
|
|
export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
|
2019-12-03 17:00:58 +01:00
|
|
|
# The cache dir.
|
|
|
|
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
|
2022-04-07 18:03:41 +02:00
|
|
|
export CCACHE_DIR=${CCACHE_DIR:-$CACHE_DIR/ccache}
|
2019-12-03 17:00:58 +01:00
|
|
|
# The depends dir.
|
|
|
|
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
|
|
|
|
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
|
2020-04-28 17:49:43 +02:00
|
|
|
# Folder where the build result is put (bin and lib).
|
2019-12-03 17:00:58 +01:00
|
|
|
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out/$HOST}
|
2020-04-28 17:49:43 +02:00
|
|
|
# Folder where the build is done (dist and out-of-tree build).
|
|
|
|
export BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-ci}
|
2020-02-12 15:19:50 +01:00
|
|
|
export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/releases/$HOST}
|
2021-12-13 07:54:31 +01:00
|
|
|
export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
|
2020-01-22 21:09:07 +01:00
|
|
|
export DOCKER_PACKAGES=${DOCKER_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git procps}
|
2021-12-13 07:54:31 +01:00
|
|
|
export GOAL=${GOAL:-install}
|
2019-12-03 17:00:58 +01:00
|
|
|
export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
|
2021-12-13 07:54:31 +01:00
|
|
|
export PATH=${BASE_ROOT_DIR}/ci/retry:$PATH
|
2020-04-29 17:14:10 +02:00
|
|
|
export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"}
|
2022-04-07 18:03:41 +02:00
|
|
|
# Dash's Docker-specifics
|
|
|
|
export BUILDER_IMAGE_NAME="dash-builder-$BUILD_TARGET-$JOB_NUMBER"
|
|
|
|
export DOCKER_RUN_VOLUME_ARGS="-v $BASE_ROOT_DIR:$BASE_ROOT_DIR -v $HOST_CACHE_DIR:$CACHE_DIR"
|
|
|
|
export DOCKER_RUN_ENV_ARGS="-e BASE_ROOT_DIR=$BASE_ROOT_DIR -e CACHE_DIR=$CACHE_DIR -e PULL_REQUEST=$PULL_REQUEST -e COMMIT_RANGE=$COMMIT_RANGE -e JOB_NUMBER=$JOB_NUMBER -e BUILD_TARGET=$BUILD_TARGET"
|
|
|
|
export DOCKER_RUN_ARGS="$DOCKER_RUN_VOLUME_ARGS $DOCKER_RUN_ENV_ARGS"
|
|
|
|
export DOCKER_RUN_IN_BUILDER="docker run -t --rm -w $BASE_ROOT_DIR $DOCKER_RUN_ARGS $BUILDER_IMAGE_NAME"
|