00_setup_env.sh raw

   1  #!/usr/bin/env bash
   2  #
   3  # Copyright (c) 2019-present The Bitcoin Core developers
   4  # Distributed under the MIT software license, see the accompanying
   5  # file COPYING or http://www.opensource.org/licenses/mit-license.php.
   6  
   7  export LC_ALL=C.UTF-8
   8  
   9  set -o errexit -o nounset -o pipefail -o xtrace
  10  
  11  # The source root dir, usually from git, usually read-only.
  12  # The ci system copies this folder.
  13  BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
  14  export BASE_READ_ONLY_DIR
  15  # The destination root dir inside the container.
  16  # This folder will also hold any SDKs.
  17  # This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR
  18  export BASE_ROOT_DIR="${BASE_ROOT_DIR:-/ci_container_base}"
  19  # The depends dir.
  20  # This folder exists only on the ci guest, and on the ci host as a volume.
  21  export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
  22  # A folder for the ci system to put temporary files (build result, datadirs for tests, ...)
  23  # The name contains a space and a non-ASCII symbol to confirm the build and
  24  # tests handle word-splitting and UTF8 correctly.
  25  # This folder only exists on the ci guest.
  26  export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch_ ₿🧪_}
  27  
  28  echo "Setting specific values in env"
  29  # shellcheck disable=SC1090
  30  source "${FILE_ENV}"
  31  
  32  echo "Fallback to default values in env (if not yet set)"
  33  # The number of parallel jobs to pass down to make and test_runner.py
  34  export MAKEJOBS=${MAKEJOBS:--j$(if command -v nproc > /dev/null 2>&1; then nproc; else sysctl -n hw.logicalcpu; fi)}
  35  
  36  export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
  37  export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
  38  export RUN_TIDY=${RUN_TIDY:-false}
  39  # By how much to scale the test_runner timeouts (option --timeout-factor).
  40  # This is needed because some ci machines have slow CPU or disk, so sanitizers
  41  # might be slow or a reindex might be waiting on disk IO.
  42  export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40}
  43  export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
  44  
  45  # Randomize test order.
  46  # See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html
  47  export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1}
  48  # See man 7 debconf
  49  export DEBIAN_FRONTEND=noninteractive
  50  export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-2G}
  51  export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
  52  export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
  53  # The cache dir.
  54  # This folder exists only on the ci guest, and on the ci host as a volume.
  55  export CCACHE_DIR="${CCACHE_DIR:-$BASE_SCRATCH_DIR/ccache}"
  56  # Folder where the build result is put (bin and lib).
  57  export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out}
  58  # The folder for previous release binaries.
  59  # This folder exists only on the ci guest, and on the ci host as a volume.
  60  export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/prev_releases}
  61  export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential pkgconf curl ca-certificates ccache python3-dev rsync git procps bison e2fsprogs cmake ninja-build}
  62  export GOAL=${GOAL:-install}
  63  export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
  64  export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry"}
  65  
  66  # The --platform argument used with `docker build` and `docker run`.
  67  export CI_IMAGE_PLATFORM=${CI_IMAGE_PLATFORM:-"linux"} # Force linux, but use native arch by default
  68