Skip to content

Commit 1705f19

Browse files
author
MarcoFalke
committed
Merge #17549: ci: misc cleanups
fad88e6 ci: Remove use of cd (MarcoFalke) fa2941b ci: Remove unmaintained extended_lint (MarcoFalke) fa04187 scripted-diff: Use ci DEPENDS_DIR, remove BASE_BUILD_DIR (MarcoFalke) fa0656d ci: Add DEPENDS_DIR variable, Add documentation for folders (MarcoFalke) faeeca8 scripted-diff: Move various folders to ci scratch dir (MarcoFalke) Pull request description: Some minor cleanups: * Remove unused and unmaintained extended_lint to avoid ci bottlenecks and waste of CPU * Move all folders that hold temporary ci files to the ci scratch dir (except for the build dirs) * Add some documentation to folders and remove the `BASE_BUILD_DIR` alias for the root directory * Fixes #17178 by removing `cd` Top commit has no ACKs. Tree-SHA512: f6eb9d47ab98c08af59a79c2a4bf62fc331f0f6f3174909a28f2c2f48b0234423da5aee876225d2e188619b71b008d882a20d29a7aca68248039ea5080be5af5
2 parents 69ca6cd + fad88e6 commit 1705f19

File tree

8 files changed

+35
-78
lines changed

8 files changed

+35
-78
lines changed

.travis.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ before_cache:
4343
stages:
4444
- lint
4545
- test
46-
- extended-lint
4746
env:
4847
global:
4948
- CI_RETRY_EXE="travis_retry"
@@ -82,19 +81,6 @@ jobs:
8281
script:
8382
- set -o errexit; source ./ci/lint/06_script.sh
8483

85-
- stage: extended-lint
86-
name: 'extended lint [runtime >= 60 seconds]'
87-
env:
88-
cache: false
89-
language: python
90-
python: '3.5'
91-
install:
92-
- set -o errexit; source ./ci/extended_lint/04_install.sh
93-
before_script:
94-
- set -o errexit; source ./ci/lint/05_before_script.sh
95-
script:
96-
- set -o errexit; source ./ci/extended_lint/06_script.sh
97-
9884
- stage: test
9985
name: 'ARM [GOAL: install] [bionic] [unit tests, functional tests]'
10086
arch: arm64

ci/extended_lint/04_install.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

ci/extended_lint/06_script.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/test/00_setup_env.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ if [ -n "${FILE_ENV}" ]; then
1313
source "${FILE_ENV}"
1414
fi
1515

16+
# The root dir.
17+
# The ci system copies this folder.
18+
# This is where the build is done (depends and dist).
1619
BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
1720
export BASE_ROOT_DIR
1821

1922
echo "Fallback to default values in env (if not yet set)"
2023
# The number of parallel jobs to pass down to make and test_runner.py
2124
export MAKEJOBS=${MAKEJOBS:--j4}
2225
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
26+
# This folder only exists on the ci host.
2327
export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch/}
2428
# What host to compile for. See also ./depends/README.md
2529
# Tests that need cross-compilation export the appropriate HOST.
@@ -37,15 +41,18 @@ export BOOST_TEST_RANDOM=${BOOST_TEST_RANDOM:-1}
3741
export CCACHE_SIZE=${CCACHE_SIZE:-100M}
3842
export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
3943
export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
44+
# The cache dir.
45+
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
4046
export CCACHE_DIR=${CCACHE_DIR:-$BASE_SCRATCH_DIR/.ccache}
41-
# Folder where the build is done (depends and dist). Can not be changed and is equal to the root of the git repo
42-
export BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_ROOT_DIR}
43-
# Folder where the build is done (bin and lib). Can not be changed.
44-
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_BUILD_DIR/out/$HOST}
47+
# The depends dir.
48+
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
49+
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
50+
# Folder where the build is done (bin and lib).
51+
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out/$HOST}
4552
export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
4653
export WINEDEBUG=${WINEDEBUG:-fixme-all}
4754
export DOCKER_PACKAGES=${DOCKER_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git}
4855
export GOAL=${GOAL:-install}
49-
export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_BUILD_DIR}/qa-assets}
56+
export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets}
5057
export PATH=${BASE_ROOT_DIR}/ci/retry:$PATH
5158
export CI_RETRY_EXE=${CI_RETRY_EXE:retry}

ci/test/04_install.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,37 @@ mkdir -p "${BASE_SCRATCH_DIR}"
3434
mkdir -p "${CCACHE_DIR}"
3535

3636
export ASAN_OPTIONS="detect_stack_use_after_return=1"
37-
export LSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/lsan"
38-
export TSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_BUILD_DIR}/sanitizer-output/tsan"
39-
export UBSAN_OPTIONS="suppressions=${BASE_BUILD_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1"
37+
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
38+
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
39+
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1"
4040
env | grep -E '^(BITCOIN_CONFIG|CCACHE_|WINEDEBUG|LC_ALL|BOOST_TEST_RANDOM|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS)' | tee /tmp/env
4141
if [[ $HOST = *-mingw32 ]]; then
4242
DOCKER_ADMIN="--cap-add SYS_ADMIN"
4343
elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)
4444
DOCKER_ADMIN="--cap-add SYS_PTRACE"
4545
fi
4646

47+
export P_CI_DIR="$PWD"
48+
4749
if [ -z "$RUN_CI_ON_HOST" ]; then
4850
echo "Creating $DOCKER_NAME_TAG container to run in"
4951
${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG"
5052

5153
DOCKER_ID=$(docker run $DOCKER_ADMIN -idt \
52-
--mount type=bind,src=$BASE_BUILD_DIR,dst=/ro_base,readonly \
54+
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
5355
--mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR \
54-
--mount type=bind,src=$BASE_BUILD_DIR/depends,dst=$BASE_BUILD_DIR/depends \
55-
-w $BASE_BUILD_DIR \
56+
--mount type=bind,src=$DEPENDS_DIR,dst=$DEPENDS_DIR \
57+
-w $BASE_ROOT_DIR \
5658
--env-file /tmp/env \
5759
$DOCKER_NAME_TAG)
5860

5961
DOCKER_EXEC () {
60-
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*"
62+
docker exec $DOCKER_ID bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
6163
}
6264
else
6365
echo "Running on host system without docker wrapper"
6466
DOCKER_EXEC () {
65-
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $PWD && $*"
67+
bash -c "export PATH=$BASE_SCRATCH_DIR/bins/:\$PATH && cd $P_CI_DIR && $*"
6668
}
6769
fi
6870

@@ -90,11 +92,11 @@ if [ ! -d ${DIR_QA_ASSETS} ]; then
9092
fi
9193
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_seed_corpus/
9294

93-
DOCKER_EXEC mkdir -p "${BASE_BUILD_DIR}/sanitizer-output/"
95+
DOCKER_EXEC mkdir -p "${BASE_SCRATCH_DIR}/sanitizer-output/"
9496

9597
if [ -z "$RUN_CI_ON_HOST" ]; then
96-
echo "Create $BASE_BUILD_DIR"
97-
DOCKER_EXEC rsync -a /ro_base/ $BASE_BUILD_DIR
98+
echo "Create $BASE_ROOT_DIR"
99+
DOCKER_EXEC rsync -a /ro_base/ $BASE_ROOT_DIR
98100
fi
99101

100102
if [ "$USE_BUSY_BOX" = "true" ]; then

ci/test/05_before_script.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ else
1313
DOCKER_EXEC echo \> \$HOME/.bitcoin
1414
fi
1515

16-
DOCKER_EXEC mkdir -p depends/SDKs depends/sdk-sources
16+
DOCKER_EXEC mkdir -p ${DEPENDS_DIR}/SDKs ${DEPENDS_DIR}/sdk-sources
1717

18-
if [ -n "$OSX_SDK" ] && [ ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
19-
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
18+
if [ -n "$OSX_SDK" ] && [ ! -f ${DEPENDS_DIR}/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
19+
curl --location --fail $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -o ${DEPENDS_DIR}/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
2020
fi
21-
if [ -n "$OSX_SDK" ] && [ -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
22-
DOCKER_EXEC tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
21+
if [ -n "$OSX_SDK" ] && [ -f ${DEPENDS_DIR}/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then
22+
DOCKER_EXEC tar -C ${DEPENDS_DIR}/SDKs -xf ${DEPENDS_DIR}/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz
2323
fi
2424
if [[ $HOST = *-mingw32 ]]; then
2525
DOCKER_EXEC update-alternatives --set $HOST-g++ \$\(which $HOST-g++-posix\)

ci/test/06_script_a.sh

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
export LC_ALL=C.UTF-8
88

9-
BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$BASE_BUILD_DIR/depends/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib"
9+
BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib"
1010
if [ -z "$NO_DEPENDS" ]; then
1111
DOCKER_EXEC ccache --max-size=$CCACHE_SIZE
1212
fi
@@ -19,14 +19,8 @@ else
1919
fi
2020
END_FOLD
2121

22-
# Create folder on host and docker, so that `cd` works
23-
mkdir -p build
2422
DOCKER_EXEC mkdir -p build
25-
26-
# Temporarily disable errexit, because Travis macOS fails without error message
27-
set +o errexit
28-
cd build || (echo "could not enter build directory"; exit 1)
29-
set -o errexit
23+
export P_CI_DIR="$P_CI_DIR/build"
3024

3125
BEGIN_FOLD configure
3226
DOCKER_EXEC ../configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
@@ -38,21 +32,15 @@ mkdir -p "bitcoin-$HOST"
3832
DOCKER_EXEC make distdir VERSION=$HOST
3933
END_FOLD
4034

41-
set +o errexit
42-
cd "bitcoin-$HOST" || (echo "could not enter distdir bitcoin-$HOST"; exit 1)
43-
set -o errexit
35+
export P_CI_DIR="$P_CI_DIR/bitcoin-$HOST"
4436

4537
BEGIN_FOLD configure
4638
DOCKER_EXEC ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (DOCKER_EXEC cat config.log) && false)
4739
END_FOLD
4840

4941
set -o errtrace
50-
trap 'DOCKER_EXEC "cat ${BASE_BUILD_DIR}/sanitizer-output/* 2> /dev/null"' ERR
42+
trap 'DOCKER_EXEC "cat ${BASE_SCRATCH_DIR}/sanitizer-output/* 2> /dev/null"' ERR
5143

5244
BEGIN_FOLD build
5345
DOCKER_EXEC make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && DOCKER_EXEC make $GOAL V=1 ; false )
5446
END_FOLD
55-
56-
set +o errexit
57-
cd ${BASE_BUILD_DIR} || (echo "could not enter travis build dir $BASE_BUILD_DIR"; exit 1)
58-
set -o errexit

ci/test/06_script_b.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66

77
export LC_ALL=C.UTF-8
88

9-
# Temporarily disable errexit, because Travis macOS fails without error message
10-
set +o errexit
11-
cd "build/bitcoin-$HOST" || (echo "could not enter distdir build/bitcoin-$HOST"; exit 1)
12-
set -o errexit
13-
149
if [ -n "$QEMU_USER_CMD" ]; then
1510
BEGIN_FOLD wrap-qemu
1611
echo "Prepare to run functional tests for HOST=$HOST"
@@ -33,7 +28,7 @@ fi
3328
if [ "$RUN_UNIT_TESTS" = "true" ]; then
3429
BEGIN_FOLD unit-tests
3530
bash -c "${CI_WAIT}" & # Print dots in case the unit tests take a long time to run
36-
DOCKER_EXEC LD_LIBRARY_PATH=$BASE_BUILD_DIR/depends/$HOST/lib make $MAKEJOBS check VERBOSE=1
31+
DOCKER_EXEC LD_LIBRARY_PATH=$DEPENDS_DIR/$HOST/lib make $MAKEJOBS check VERBOSE=1
3732
END_FOLD
3833
fi
3934

0 commit comments

Comments
 (0)