From fa6cbdc3c9ab42b7e55c666e83b4b8d5545bb745 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 11 Aug 2019 11:57:21 -0400 Subject: [PATCH] ci: Use ./ci/ on non-travis host --- .cirrus.yml | 24 ++++++++++++++++++++++++ ci/test/03_before_install.sh | 1 - ci/test/04_install.sh | 27 ++++++++++++++++++--------- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ce17a223b..1e6e6937d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -27,3 +27,27 @@ task: - gmake check ${MAKEJOBS} VERBOSE=1 functional_test_script: - ./test/functional/test_runner.py --jobs 9 --ci --extended --exclude feature_dbcrash --combinedlogslen=1000 --quiet --failfast +task: + name: "x86_64 Linux [GOAL: install] [bionic] [Using ./ci/ system]" + container: + image: ubuntu:18.04 + cpu: 8 + memory: 8G + timeout_in: 60m + env: + MAKEJOBS: "-j9" + RUN_CI_ON_HOST: "1" + CCACHE_SIZE: "200M" + CCACHE_DIR: "/tmp/ccache_dir" + ccache_cache: + folder: "/tmp/ccache_dir" + depends_built_cache: + folder: "/tmp/cirrus-ci-build/depends/built" + depends_sdk_cache: + folder: "/tmp/cirrus-ci-build/depends/sdk-sources" + install_script: + - apt-get update + - apt-get -y install git bash ccache + - ccache --max-size=${CCACHE_SIZE} + ci_script: + - ./ci/test_run_all.sh diff --git a/ci/test/03_before_install.sh b/ci/test/03_before_install.sh index 3c9fcf3f9..5086114ba 100755 --- a/ci/test/03_before_install.sh +++ b/ci/test/03_before_install.sh @@ -6,7 +6,6 @@ export LC_ALL=C.UTF-8 -PATH=$(echo $PATH | tr ':' "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s|::|:|g") # Add llvm-symbolizer directory to PATH. Needed to get symbolized stack traces from the sanitizers. PATH=$PATH:/usr/lib/llvm-6.0/bin/ export PATH diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 2230f5c8e..3535746e8 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -6,13 +6,8 @@ export LC_ALL=C.UTF-8 -free -m -h -echo "Number of CPUs (nproc): $(nproc)" - ccache echo "Creating ccache dir if it didn't already exist" -${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG" - if [ ! -d ${DIR_QA_ASSETS} ]; then git clone https://github.com/bitcoin-core/qa-assets ${DIR_QA_ASSETS} fi @@ -29,11 +24,25 @@ if [[ $HOST = *-mingw32 ]]; then elif [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764) DOCKER_ADMIN="--cap-add SYS_PTRACE" fi -DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$BASE_BUILD_DIR,dst=$BASE_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $BASE_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) -DOCKER_EXEC () { - docker exec $DOCKER_ID bash -c "cd $PWD && $*" -} +if [ -z "$RUN_CI_ON_HOST" ]; then + echo "Creating $DOCKER_NAME_TAG container to run in" + ${CI_RETRY_EXE} docker pull "$DOCKER_NAME_TAG" + + DOCKER_ID=$(docker run $DOCKER_ADMIN -idt --mount type=bind,src=$BASE_BUILD_DIR,dst=$BASE_BUILD_DIR --mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR -w $BASE_BUILD_DIR --env-file /tmp/env $DOCKER_NAME_TAG) + + DOCKER_EXEC () { + docker exec $DOCKER_ID bash -c "cd $PWD && $*" + } +else + echo "Running on host system without docker wrapper" + DOCKER_EXEC () { + bash -c "cd $PWD && $*" + } +fi + +DOCKER_EXEC free -m -h +DOCKER_EXEC echo "Number of CPUs \(nproc\): $(nproc)" ${CI_RETRY_EXE} DOCKER_EXEC apt-get update ${CI_RETRY_EXE} DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES $DOCKER_PACKAGES