1 #!/usr/bin/env bash
2 #
3 # Copyright (c) 2019-present The Limenka 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 -ex
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 # This folder only exists on the ci guest.
24 export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch}
25 # A folder for the ci system to put executables.
26 # This folder only exists on the ci guest.
27 export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/"
28 29 echo "Setting specific values in env"
30 if [ -n "${FILE_ENV}" ]; then
31 set -o errexit;
32 # shellcheck disable=SC1090
33 source "${FILE_ENV}"
34 fi
35 36 echo "Fallback to default values in env (if not yet set)"
37 # The number of parallel jobs to pass down to make and test_runner.py
38 export MAKEJOBS=${MAKEJOBS:--j$(if command -v nproc > /dev/null 2>&1; then nproc; else sysctl -n hw.logicalcpu; fi)}
39 # Whether to prefer BusyBox over GNU utilities
40 export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
41 42 export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
43 export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
44 export RUN_TIDY=${RUN_TIDY:-false}
45 # By how much to scale the test_runner timeouts (option --timeout-factor).
46 # This is needed because some ci machines have slow CPU or disk, so sanitizers
47 # might be slow or a reindex might be waiting on disk IO.
48 export TEST_RUNNER_TIMEOUT_FACTOR=${TEST_RUNNER_TIMEOUT_FACTOR:-40}
49 export RUN_FUZZ_TESTS=${RUN_FUZZ_TESTS:-false}
50 51 # Randomize test order.
52 # See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/rt_param_reference/random.html
53 export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1}
54 # See man 7 debconf
55 export DEBIAN_FRONTEND=noninteractive
56 export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-500M}
57 export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
58 export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
59 # The cache dir.
60 # This folder exists only on the ci guest, and on the ci host as a volume.
61 export CCACHE_DIR="${CCACHE_DIR:-$BASE_SCRATCH_DIR/ccache}"
62 # Folder where the build result is put (bin and lib).
63 export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out}
64 # The folder for previous release binaries.
65 # This folder exists only on the ci guest, and on the ci host as a volume.
66 export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/prev_releases}
67 export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential pkgconf curl ca-certificates ccache python3 rsync git procps bison e2fsprogs cmake icnsutils librsvg2-bin imagemagick}
68 export GOAL=${GOAL:-install}
69 export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
70 export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"}
71 72 # The --platform argument used with `docker build` and `docker run`.
73 export CI_IMAGE_PLATFORM=${CI_IMAGE_PLATFORM:-"linux"} # Force linux, but use native arch by default
74