From fa908a41f3b86622e4635b3478467e19fa67b571 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 28 Mar 2021 13:17:52 +0200 Subject: [PATCH 1/5] ci: Set DEPENDS_DIR when setting BASE_ROOT_DIR The depends dir can not be overwritten by a FILE_ENV file. Also, a FILE_ENV file might depend on the DEPENDS_DIR value. Thus, set it before reading FILE_ENV. This commit does not change behavior, but is required for later commits. Can be reviewed with --color-moved=dimmed-zebra --- ci/test/00_setup_env.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index 87cf8538f62..e6aec723bc6 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -11,6 +11,9 @@ export LC_ALL=C.UTF-8 # This is where the depends build is done. BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd ) export BASE_ROOT_DIR +# 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} echo "Setting specific values in env" if [ -n "${FILE_ENV}" ]; then @@ -56,9 +59,6 @@ export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1} # The cache dir. # This folder exists on the ci host and ci guest. Changes are propagated back and forth. export CCACHE_DIR=${CCACHE_DIR:-$BASE_SCRATCH_DIR/.ccache} -# 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} # Folder where the build result is put (bin and lib). export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out/$HOST} # Folder where the build is done (dist and out-of-tree build). From fac577d42330e57c17540cabdb8be43c90b715d9 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 28 Mar 2021 14:04:50 +0200 Subject: [PATCH 2/5] ci: Build depends only once for Android build Depends is currently built twice for the Android build. For example, the same task building it twice: * https://cirrus-ci.com/task/6673185279049728?logs=ci#L3418 (aarch64-linux-android) * https://cirrus-ci.com/task/6673185279049728?logs=ci#L3422 (x86_64-pc-linux-gnu, 4 lines later) --- ci/test/00_setup_env_android.sh | 12 ++++++++++-- ci/test/05_before_script.sh | 5 ----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ci/test/00_setup_env_android.sh b/ci/test/00_setup_env_android.sh index 8b872faec5c..f4239b4ef3c 100644 --- a/ci/test/00_setup_env_android.sh +++ b/ci/test/00_setup_env_android.sh @@ -6,12 +6,20 @@ export LC_ALL=C.UTF-8 -export CONTAINER_NAME=ci_android +export HOST=aarch64-linux-android export PACKAGES="clang llvm unzip openjdk-8-jdk gradle" +export CONTAINER_NAME=ci_android +export DOCKER_NAME_TAG="ubuntu:bionic" + +export RUN_UNIT_TESTS=false +export RUN_FUNCTIONAL_TESTS=false export ANDROID_API_LEVEL=28 export ANDROID_BUILD_TOOLS_VERSION=28.0.3 export ANDROID_NDK_VERSION=21.1.6352462 export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip +export ANDROID_HOME="${DEPENDS_DIR}/SDKs/android" +export ANDROID_NDK_HOME="${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}" +export DEP_OPTS="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/" -export BITCOIN_CONFIG="--disable-ccache" \ No newline at end of file +export BITCOIN_CONFIG="--disable-ccache" diff --git a/ci/test/05_before_script.sh b/ci/test/05_before_script.sh index 3bfeb2d67fe..8dd489d7f8f 100755 --- a/ci/test/05_before_script.sh +++ b/ci/test/05_before_script.sh @@ -24,16 +24,11 @@ fi if [ -n "$ANDROID_TOOLS_URL" ]; then ANDROID_TOOLS_PATH=$DEPENDS_DIR/sdk-sources/android-tools.zip - ANDROID_HOME="$DEPENDS_DIR"/SDKs/android - ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION} DOCKER_EXEC curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH" DOCKER_EXEC mkdir -p "${ANDROID_HOME}/cmdline-tools" DOCKER_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "${ANDROID_HOME}/cmdline-tools" DOCKER_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\"" - - MAKE_COMMAND="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} make $MAKEJOBS -C depends HOST=aarch64-linux-android ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin/ $DEP_OPTS" - DOCKER_EXEC "$MAKE_COMMAND" HOST=aarch64-linux-android fi if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then From fa97a17ac332d2270f80497d5660665e88ea621c Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 28 Mar 2021 13:50:18 +0200 Subject: [PATCH 3/5] ci: Bump Android cross-build to Ubuntu Focal This does not change behavior, but bumping to Focal now means it doesn't have to be done later when Bionic is no longer used and EOL. --- .cirrus.yml | 4 ++-- ci/test/00_setup_env_android.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index e881e587bff..ae49843db18 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -182,9 +182,9 @@ task: FILE_ENV: "./ci/test/00_setup_env_mac_host.sh" task: - name: 'ARM64 Android APK [bionic]' + name: 'ARM64 Android APK [focal]' << : *GLOBAL_TASK_TEMPLATE container: - image: ubuntu:bionic + image: ubuntu:focal env: FILE_ENV: "./ci/test/00_setup_env_android.sh" diff --git a/ci/test/00_setup_env_android.sh b/ci/test/00_setup_env_android.sh index f4239b4ef3c..f78a84eeac4 100644 --- a/ci/test/00_setup_env_android.sh +++ b/ci/test/00_setup_env_android.sh @@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8 export HOST=aarch64-linux-android export PACKAGES="clang llvm unzip openjdk-8-jdk gradle" export CONTAINER_NAME=ci_android -export DOCKER_NAME_TAG="ubuntu:bionic" +export DOCKER_NAME_TAG="ubuntu:focal" export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false From ffff4e7373f7c1260e6a8347b4ea1a99db4fff76 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 28 Mar 2021 18:43:56 +0200 Subject: [PATCH 4/5] cirrus: Only cache releases when needed This does not change behavior, but removes unneeded and empty cache instructions for tasks that don't need them. --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index ae49843db18..0b6d17e8c8d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -35,8 +35,6 @@ global_task_template: &GLOBAL_TASK_TEMPLATE folder: "/tmp/cirrus-ci-build/depends/built" depends_sdk_cache: folder: "/tmp/cirrus-ci-build/depends/sdk-sources" - depends_releases_cache: - folder: "/tmp/cirrus-ci-build/releases" ci_script: - ./ci/test_run_all.sh @@ -103,6 +101,8 @@ task: # For faster CI feedback, immediately schedule a task that compiles most modules << : *CREDITS_TEMPLATE << : *GLOBAL_TASK_TEMPLATE + depends_releases_cache: + folder: "/tmp/cirrus-ci-build/releases" container: image: ubuntu:bionic env: From fa52d7d3adc99c0e716628058b4fd083034d27e0 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 28 Mar 2021 18:33:21 +0200 Subject: [PATCH 5/5] cirrus: Add missing depends_sources_cache to Android task This cache entry is required for completeness. The file src/Makefile.qt.include needs it in this line: QT_BASE_PATH = $(shell find ../depends/sources/ -maxdepth 1 -type f -regex ".*qtbase.*\.tar.xz") This cache entry is tied to the depends_built_cache cache entry. Either both are present and cached, or neither of them is. Otherwise, the build will fail. --- .cirrus.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 0b6d17e8c8d..b3d58461e0a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -183,6 +183,8 @@ task: task: name: 'ARM64 Android APK [focal]' + depends_sources_cache: + folder: "/tmp/cirrus-ci-build/depends/sources" << : *GLOBAL_TASK_TEMPLATE container: image: ubuntu:focal