diff --git a/CMakeLists.txt b/CMakeLists.txt index 373361c76..b9696df35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,135 +1,137 @@ # Copyright (c) 2017 The Bitcoin developers cmake_minimum_required(VERSION 3.16) set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_SOURCE_DIR}/cmake/modules/OverrideInitFlags.cmake" ) project(bitcoin-abc VERSION 0.27.9 DESCRIPTION "Bitcoin ABC is a full node implementation of the eCash protocol." HOMEPAGE_URL "https://www.bitcoinabc.org" ) add_custom_target(print-version COMMENT "Print the current ${PROJECT_NAME} version" COMMAND "${CMAKE_COMMAND}" -E echo "${PROJECT_VERSION}" ) # Package information set(PACKAGE_NAME "Bitcoin ABC") set(PACKAGE_BUGREPORT "https://github.com/Bitcoin-ABC/bitcoin-abc/issues") # Copyright set(COPYRIGHT_YEAR 2023) set(COPYRIGHT_HOLDERS "The %s developers") set(COPYRIGHT_HOLDERS_SUBSTITUTION Bitcoin) string(REPLACE "%s" ${COPYRIGHT_HOLDERS_SUBSTITUTION} COPYRIGHT_HOLDERS_FINAL ${COPYRIGHT_HOLDERS}) # Add path for custom modules list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) # Make contrib script accessible. set(CONTRIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/contrib) # Default to RelWithDebInfo configuration if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Select the configuration for the build" FORCE) set(__NO_USER_CMAKE_BUILD_TYPE ON CACHE BOOL "True if the user didn't set a build type on the command line") endif() # Find the python interpreter. This is required for several targets. find_package(Python 3.6 COMPONENTS Interpreter REQUIRED) # Add the magic targets `check-*` add_custom_target(check-all) add_custom_target(check) add_custom_target(check-extended) add_custom_target(check-upgrade-activated) add_custom_target(check-upgrade-activated-extended) # Add the global install targets add_custom_target(install-all) add_custom_target(install-debug) add_custom_target(install-all-debug) include(PackageHelper) exclude_git_ignored_files_from_source_package() # Ignore hidden files and directories (starting with a '.') set_property(GLOBAL APPEND PROPERTY SOURCE_PACKAGE_IGNORE_FILES "/\\\\.") # If the build is out-of-tree, then the build directory can be ignored. if(NOT CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) set_property(GLOBAL APPEND PROPERTY SOURCE_PACKAGE_IGNORE_FILES "${CMAKE_BINARY_DIR}/" ) endif() exclude_from_source_package( # Subdirectories "arcanist/" "depends/" # Files "[^.]+[.]md$" ) option(ENABLE_COVERAGE "Enable coverage" OFF) option(ENABLE_BRANCH_COVERAGE "Enable branch coverage" OFF) if(ENABLE_COVERAGE) include(Coverage) enable_coverage(${ENABLE_BRANCH_COVERAGE}) include(AddCompilerFlags) # If no build type is manually defined, override the optimization level. # Otherwise, alert the user than the coverage result might be useless. if(__NO_USER_CMAKE_BUILD_TYPE) set_c_optimization_level(0) # Setting -Og instead of -O0 is a workaround for the GCC bug 90380: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90380 # # This bug is fixed upstream, but is not widely distributed yet. # Fixed in GCC versions: # - GCC 7.x: versions <= 7.2 are unaffected # - GCC 8.x: versions >= 8.3.1 # - GCC 9.x: versions >= 9.1.1 # - GCC 10.x: all versions set_cxx_optimization_level(g) else() message(WARNING "It is advised to not enforce CMAKE_BUILD_TYPE to get the best coverage results") endif() exclude_from_coverage( "depends" "src/bench" "src/crypto/ctaes" "src/leveldb" "src/univalue" ) add_custom_target_coverage(check) add_custom_target_coverage(check-all) add_custom_target_coverage(check-extended) add_custom_target_coverage(check-upgrade-activated) add_custom_target_coverage(check-upgrade-activated-extended) endif() add_subdirectory(src) option(BUILD_BITCOIN_CHRONIK "Activate the Chronik indexer" OFF) if(BUILD_BITCOIN_CHRONIK) add_subdirectory(chronik) endif() add_subdirectory(test) +add_subdirectory(electrum) + add_subdirectory(contrib) add_subdirectory(doc) include(PackageOptions.cmake) diff --git a/contrib/teamcity/build-configurations.yml b/contrib/teamcity/build-configurations.yml index 7fa10a4e7..d0ba35f8a 100644 --- a/contrib/teamcity/build-configurations.yml +++ b/contrib/teamcity/build-configurations.yml @@ -1,690 +1,696 @@ --- # Templates can be referenced in builds to avoid duplication templates: gitian_builds: script: | "${TOPLEVEL}/contrib/teamcity/gitian.sh" timeout: 9000 artifacts: gitian-results: '' check+secp256k1: targets: - - all - install - install-secp256k1 - - check - check-secp256k1 - check-functional diff-node: runOnDiffRegex: - cmake/ - src/ - test/ - CMakeLists.txt secp256k1: runOnDiffRegex: - src/secp256k1/ Werror: true targets: - - secp256k1 - install-secp256k1 - - check-secp256k1 ibd: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log ibd-no-assumevalid-checkpoint: targets: - - bitcoind post_build: | "${TOPLEVEL}/contrib/teamcity/ibd.sh" -disablewallet -assumevalid=0 -checkpoints=0 -debug=net timeout: 28800 artifacts: ibd/debug.log: log/debug.log # This template expect the following environment variables to be set: # - JS_PROJECT_ROOT: the root directory for the js project being tested, # relative to the repository top level (no trailing /). js-mocha: artifacts: coverage.tar.gz: coverage.tar.gz script: | # Convert hyphen separated words to space separated capitalized words project_to_suite() { HYPHEN_SEPARATED=$1 WORD_SEPARATED=($(echo "${HYPHEN_SEPARATED//-/ }")) echo "${WORD_SEPARATED[@]^}" } PROJECT_NAME="$(basename ${JS_PROJECT_ROOT})" TEST_SUITE_NAME="$(project_to_suite ${PROJECT_NAME})" pushd "${TOPLEVEL}/${JS_PROJECT_ROOT}" MOCHA_JUNIT_DIR="test_results" MOCHA_JUNIT_PATH="${MOCHA_JUNIT_DIR}/${PROJECT_NAME}-junit.xml" rm -rf "${MOCHA_JUNIT_DIR}" && mkdir -p "${MOCHA_JUNIT_DIR}" npm ci # Make sure the report is available even if the tests fail move_junit_report() { mv "${MOCHA_JUNIT_PATH}" "${BUILD_DIR}/" } trap "move_junit_report" EXIT nyc \ --reporter=text \ --reporter=lcov \ --reporter=teamcity \ npm test -- \ --reporter mocha-junit-reporter \ --reporter-options mochaFile="${MOCHA_JUNIT_PATH}" \ --reporter-options testsuitesTitle="${TEST_SUITE_NAME} Unit Tests" \ --reporter-options rootSuiteTitle="${TEST_SUITE_NAME}" # Generate a summary report lcov \ --rc lcov_branch_coverage=1 \ --summary coverage/lcov.info \ > coverage/lcov-report/coverage-summary.txt 2>&1 pushd coverage/lcov-report tar -czf ../coverage.tar.gz -- * popd mv coverage/coverage.tar.gz "${BUILD_DIR}/" rm -rf coverage # The build descriptions. # If a script is defined, then this will be the only step to run. # Otherwise a list of targets can be specified, grouped by parallel runs. # Example: # targets: # - - build11 # - build12 # - - build21 # - build22 # Will run: # ninja build11 build12 # ninja build21 build22 builds: build-asan: Werror: true clang: true fail_fast: true cmake_flags: - '-DCMAKE_CXX_FLAGS=-DARENA_DEBUG' - '-DCRYPTO_USE_ASM=OFF' - '-DENABLE_SANITIZERS=address' templates: - check+secp256k1 timeout: 2400 env: ASAN_OPTIONS: log_path=stdout LSAN_OPTIONS: log_path=stdout build-bench: runOnDiffRegex: - src/bench/ Werror: true targets: - - all - install-bitcoin-bench - - bench-bitcoin timeout: 1200 artifacts: src/bench/BitcoinABC_Bench.csv: bench/BitcoinABC_Bench.csv src/bench/BitcoinABC_Bench.json: bench/BitcoinABC_Bench.json post_build: | "${TOPLEVEL}/contrib/teamcity/nanobench_json_to_teamcity_messages.py" \ "Bitcoin ABC Benchmark" \ "${BUILD_DIR}/src/bench/BitcoinABC_Bench.json" build-chronik: runOnDiffRegex: - chronik/ cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - check-crates - - all - install - - check - check-functional build-clang: Werror: true clang: true targets: - - all - install - install-secp256k1 - - check - check-secp256k1 templates: - diff-node timeout: 1200 build-clang-tidy: clang: true cmake_flags: - '-DENABLE_CLANG_TIDY=ON' targets: - - all - - check templates: - diff-node timeout: 1800 build-coverage: gcc: true cmake_flags: - '-DENABLE_COVERAGE=ON' - '-DENABLE_BRANCH_COVERAGE=ON' targets: - - coverage-check-extended post_build: | "${TOPLEVEL}/contrib/teamcity/upload-coverage.sh" check-extended timeout: 4800 artifacts: coverage.tar.gz: coverage.tar.gz build-debug: Werror: true cmake_flags: - '-DCMAKE_BUILD_TYPE=Debug' templates: - check+secp256k1 - diff-node timeout: 1200 build-diff: Werror: true targets: - - all - install - install-secp256k1 - - check-all - check-upgrade-activated templates: - diff-node timeout: 1200 build-docs: targets: - - doc-rpc - doc-doxygen post_build: | xvfb-run -a -e /dev/stderr ninja install-manpages-html timeout: 600 artifacts: doc/*: doc build-fuzzer: runOnDiffRegex: - src/test/fuzz/ - test/fuzz/ clang: true Werror: true cmake_flags: - '-DENABLE_SANITIZERS=fuzzer' targets: - - bitcoin-fuzzers build-ibd: templates: - ibd build-ibd-no-assumevalid-checkpoint: templates: - ibd-no-assumevalid-checkpoint build-linux32: cross_build: static_depends: linux32 toolchain: Linux32 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux64: cross_build: static_depends: linux64 toolchain: Linux64 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' templates: - check+secp256k1 timeout: 3600 build-linux-aarch64: cross_build: static_depends: linux-aarch64 toolchain: LinuxAArch64 emulator: qemu-aarch64-static cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/aarch64-linux-gnu build-linux-arm: cross_build: static_depends: linux-arm toolchain: LinuxARM emulator: qemu-arm-static cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' # The ZMQ functional test will fail with qemu (due to a qemu limitation), # so disable it to avoid the failure. # Extracted from stderr: # Unknown host QEMU_IFLA type: 50 # Unknown host QEMU_IFLA type: 51 # Unknown QEMU_IFLA_BRPORT type 33 - "-DBUILD_BITCOIN_ZMQ=OFF" # This is an horrible hack to workaround a qemu bug: # https://bugs.launchpad.net/qemu/+bug/1748612 # Qemu emits a message for unsupported features called by the guest. # Because the output filtering is not working at all, it causes the # qemu stderr to end up in the node stderr and fail the functional # tests. # Disabling the unsupported feature (here bypassing the config # detection) fixes the issue. # FIXME: get rid of the hack, either by using a better qemu version # or by filtering stderr at the framework level. - "-DHAVE_DECL_GETIFADDRS=OFF" templates: - check+secp256k1 timeout: 3600 env: QEMU_LD_PREFIX: /usr/arm-linux-gnueabihf build-make-generator: generator: name: 'Unix Makefiles' command: make flags: - '-k' templates: - check+secp256k1 timeout: 1200 build-master: Werror: true targets: - - all - install - install-secp256k1 - - check-extended - check-upgrade-activated-extended timeout: 4800 build-native-osx: templates: - check+secp256k1 timeout: 3600 build-osx: cross_build: static_depends: osx toolchain: OSX # Uncomment to build Chronik once the cxx crate is working for OSX # cmake_flags: # - '-DBUILD_BITCOIN_CHRONIK=ON' targets: - - all - install - install-secp256k1 - install-tests post_build: | export PYTHONPATH="${TOPLEVEL}/depends/x86_64-apple-darwin/native/lib/python3/dist-packages:${PYTHONPATH:-}" ninja osx-dmg timeout: 3600 artifacts: Bitcoin-ABC.dmg: Bitcoin-ABC.dmg build-secp256k1: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' templates: - secp256k1 timeout: 600 build-secp256k1-java: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_JNI=ON' - '-DUSE_JEMALLOC=OFF' templates: - secp256k1 timeout: 600 build-secp256k1-bench: runOnDiffRegex: - src/secp256k1/ cmake_flags: - '-DSECP256K1_ENABLE_MODULE_ECDH=ON' - '-DSECP256K1_ENABLE_MODULE_MULTISET=ON' targets: - - install-secp256k1-bench - - bench-secp256k1 timeout: 1200 build-tsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=thread' targets: - - all - install - - check - check-functional timeout: 2400 env: TSAN_OPTIONS: log_path=stdout build-ubsan: Werror: true clang: true fail_fast: true cmake_flags: - '-DENABLE_SANITIZERS=undefined' templates: - check+secp256k1 timeout: 2400 env: UBSAN_OPTIONS: log_path=stdout build-win64: cross_build: static_depends: win64 toolchain: Win64 cmake_flags: - '-DBUILD_BITCOIN_CHRONIK=ON' - "-DBUILD_BITCOIN_SEEDER=OFF" - "-DCPACK_STRIP_FILES=ON" - "-DUSE_JEMALLOC=OFF" targets: - - all - install - install-secp256k1 # install-tests is broken on debian bullseye because the leveldb tests # do not export any symbol and trigger a mingw linker bug: # https://sourceware.org/bugzilla/show_bug.cgi?id=26588 # We still install most test suites so we can use the artifacts and run # them on the native platform. #- install-tests - install-test-suite-bitcoin - install-test-suite-bitcoin-qt - install-test-suite-avalanche - install-test-suite-pow - - package post_build: | wine "${ARTIFACT_DIR}/bin/test_bitcoin.exe" --run_test=\!radix_tests,rcu_tests timeout: 3600 artifacts: bitcoin-abc-*-x86_64-w64-mingw32.exe: bitcoin-abc-x86_64-w64-mingw32.exe build-without-bip70: Werror: true cmake_flags: - '-DENABLE_BIP70=OFF' targets: - - all - install - - check - check-functional timeout: 1800 build-without-cli: Werror: true cmake_flags: - '-DBUILD_BITCOIN_CLI=OFF' targets: - - all - install - - check-functional timeout: 1200 build-without-qt: Werror: true cmake_flags: - '-DBUILD_BITCOIN_QT=OFF' targets: - - all - install - - check timeout: 1200 build-without-wallet: Werror: true cmake_flags: - '-DBUILD_BITCOIN_WALLET=OFF' targets: - - all - install - - check - check-functional templates: - diff-node timeout: 1200 build-without-zmq: Werror: true cmake_flags: - '-DBUILD_BITCOIN_ZMQ=OFF' targets: - - all - install - - check - check-functional timeout: 1800 check-buildbot: runOnDiffRegex: - contrib/buildbot/ targets: - - check-buildbot timeout: 600 check-seeds: targets: - - bitcoind - bitcoin-cli post_build: | # Run on different ports to avoid a race where the rpc port used in the first run # may not be closed in time for the second to start. SEEDS_DIR="${TOPLEVEL}"/contrib/seeds RPC_PORT=18832 "${SEEDS_DIR}"/check-seeds.sh main 80 RPC_PORT=18833 "${SEEDS_DIR}"/check-seeds.sh test 70 timeout: 600 check-source-control-tools: cmake_flags: - '-DENABLE_SOURCE_CONTROL_TOOLS_TESTS=ON' targets: - - check-source-control-tools timeout: 600 gitian-linux: templates: - gitian_builds env: OS_NAME: linux gitian-osx: templates: - gitian_builds env: OS_NAME: osx gitian-win: templates: - gitian_builds env: OS_NAME: win lint-circular-dependencies: runOnDiffRegex: - src/ - test/lint/ script: | "${TOPLEVEL}/test/lint/lint-circular-dependencies.sh" cashtab-tests: runOnDiffRegex: - cashtab/ artifacts: coverage.tar.gz: coverage.tar.gz env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab.xml" script: | pushd "${TOPLEVEL}/cashtab" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test --coverage -- \ --reporters=default \ --reporters=jest-junit \ --coverageReporters=text \ --coverageReporters=lcov \ --coverageReporters=teamcity # Generate a summary report lcov \ --rc lcov_branch_coverage=1 \ --summary coverage/lcov.info \ > coverage/lcov-report/coverage-summary.txt 2>&1 pushd coverage/lcov-report tar -czf ../coverage.tar.gz -- * popd mv coverage/coverage.tar.gz "${BUILD_DIR}/" cashtab-components-tests: runOnDiffRegex: - modules/cashtab-components/ env: # Any string will work, CI just needs to be defined CI: 'teamcity' JEST_SUITE_NAME: "Cashtab Components Test suites" JEST_JUNIT_SUITE_NAME: "CashTab Components Unit Tests" JEST_JUNIT_OUTPUT_DIR: "test/junit" JEST_JUNIT_OUTPUT_NAME: "cashtab-components.xml" script: | pushd "${TOPLEVEL}/modules/cashtab-components" npm ci npm run build # Make sure the report is available even if the tests fail move_junit_report() { mv test "${BUILD_DIR}/" } trap "move_junit_report" EXIT npm run test -- \ --reporters=default \ --reporters=jest-junit alias-server-tests: runOnDiffRegex: - apps/alias-server/ env: JS_PROJECT_ROOT: apps/alias-server templates: - js-mocha ecash-herald-tests: runOnDiffRegex: - apps/ecash-herald/ env: JS_PROJECT_ROOT: apps/ecash-herald templates: - js-mocha app-dev-examples: runOnDiffRegex: - apps/examples/ env: JS_PROJECT_ROOT: apps/examples templates: - js-mocha ecashaddrjs-tests: runOnDiffRegex: - modules/ecashaddrjs/ env: JS_PROJECT_ROOT: modules/ecashaddrjs templates: - js-mocha ecash-script-tests: runOnDiffRegex: - modules/ecash-script/ env: JS_PROJECT_ROOT: modules/ecash-script templates: - js-mocha + electrum-tests: + runOnDiffRegex: + - electrum/ + targets: + - - check-electrum + preview-e.cash: docker: context: web/e.cash port: 3000 preview-explorer: docker: context: web/explorer port: 3035 preview-cashtab: docker: context: cashtab diff --git a/contrib/utils/install-dependencies-bullseye.sh b/contrib/utils/install-dependencies-bullseye.sh index a6cf6ce63..bc8865890 100755 --- a/contrib/utils/install-dependencies-bullseye.sh +++ b/contrib/utils/install-dependencies-bullseye.sh @@ -1,183 +1,187 @@ #!/usr/bin/env bash export LC_ALL=C.UTF-8 set -euxo pipefail dpkg --add-architecture i386 PACKAGES=( arcanist automake autotools-dev binutils bison bsdmainutils build-essential ccache cmake curl default-jdk devscripts doxygen dput g++-9 g++-9-aarch64-linux-gnu g++-9-arm-linux-gnueabihf g++-9-multilib g++-mingw-w64 gcc-9 gcc-9-aarch64-linux-gnu gcc-9-arm-linux-gnueabihf gcc-9-multilib gettext-base git golang gnupg graphviz gperf help2man jq lcov less lib32stdc++-10-dev libboost-dev libbz2-dev libc6-dev:i386 libcap-dev libdb++-dev libdb-dev libevent-dev libjemalloc-dev libminiupnpc-dev libnatpmp-dev libprotobuf-dev libqrencode-dev libqt5core5a libqt5dbus5 libqt5gui5 libsqlite3-dev libssl-dev libtinfo5 libtool libzmq3-dev lld make ninja-build nsis pandoc php-codesniffer pkg-config protobuf-compiler python3 python3-pip python3-setuptools python3-yaml python3-zmq qemu-user-static qttools5-dev qttools5-dev-tools shellcheck software-properties-common tar wget wine xorriso xvfb yamllint ) function join_by() { local IFS="$1" shift echo "$*" } apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${PACKAGES[@]}") # Install llvm and clang apt-key add "$(dirname "$0")"/llvm.pub add-apt-repository "deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-12 main" apt-get update LLVM_PACKAGES=( clang-12 clang-format-12 clang-tidy-12 clang-tools-12 ) DEBIAN_FRONTEND=noninteractive apt-get install -y $(join_by ' ' "${LLVM_PACKAGES[@]}") # Make sure our specific llvm and clang versions have highest priority update-alternatives --install /usr/bin/clang clang "$(command -v clang-12)" 100 update-alternatives --install /usr/bin/clang++ clang++ "$(command -v clang++-12)" 100 update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer "$(command -v llvm-symbolizer-12)" 100 # Use gcc-9/g++-9 by default so it uses libstdc++-9. This prevents from pulling # the new pthread_cond_clockwait symbol from GLIBC_30 and ensure we are testing # under the same condition our release it built. update-alternatives --install /usr/bin/gcc gcc "$(command -v gcc-9)" 100 update-alternatives --install /usr/bin/g++ g++ "$(command -v g++-9)" 100 update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc "$(command -v aarch64-linux-gnu-gcc-9)" 100 update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ "$(command -v aarch64-linux-gnu-g++-9)" 100 update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc "$(command -v arm-linux-gnueabihf-gcc-9)" 100 update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ "$(command -v arm-linux-gnueabihf-g++-9)" 100 # Use the mingw posix variant update-alternatives --set x86_64-w64-mingw32-g++ $(command -v x86_64-w64-mingw32-g++-posix) update-alternatives --set x86_64-w64-mingw32-gcc $(command -v x86_64-w64-mingw32-gcc-posix) # Python library for merging nested structures pip3 install deepmerge # For running Python test suites pip3 install pytest # For en/-decoding protobuf messages # This version is compatible with Debian's "protobuf-compiler" package pip3 install "protobuf<=3.20" # For security-check.py and symbol-check.py pip3 install "lief>=0.11.5" # For Chronik WebSocket endpoint pip3 install websocket-client # Required python linters pip3 install black==23.3.0 isort==5.6.4 mypy==0.910 flynt==0.78 flake8==6.0.0 echo "export PATH=\"$(python3 -m site --user-base)/bin:\$PATH\"" >> ~/.bashrc # shellcheck source=/dev/null source ~/.bashrc # Install npm v8.x and nodejs v16.x curl -sL https://deb.nodesource.com/setup_16.x | bash - apt-get install -y nodejs # Install nyc for mocha unit test reporting npm i -g nyc # Install Rust stable 1.67.1 and nightly from the 2023-02-17 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.67.1 RUST_HOME="${HOME}/.cargo/bin" RUST_NIGHTLY_DATE=2023-02-17 "${RUST_HOME}/rustup" install nightly-${RUST_NIGHTLY_DATE} "${RUST_HOME}/rustup" component add rustfmt --toolchain nightly-${RUST_NIGHTLY_DATE} # Name the nightly toolchain "abc-nightly" "${RUST_HOME}/rustup" toolchain link abc-nightly "$(${RUST_HOME}/rustc +nightly-${RUST_NIGHTLY_DATE} --print sysroot)" # Install required compile platform targets on stable "${RUST_HOME}/rustup" target add "i686-unknown-linux-gnu" \ "x86_64-unknown-linux-gnu" \ "aarch64-unknown-linux-gnu" \ "arm-unknown-linux-gnueabihf" \ "x86_64-apple-darwin" \ "x86_64-pc-windows-gnu" # Install corrosion from Github wget https://api.github.com/repos/corrosion-rs/corrosion/tarball/v0.3.0 -O corrosion.tar.gz echo "3b9a48737264add649983df26c83f3285ce17e20d86194c7756689a0d8470267 corrosion.tar.gz" | sha256sum -c tar xzf corrosion.tar.gz CORROSION_SRC_FOLDER=corrosion-rs-corrosion-b764a9f CORROSION_BUILD_FOLDER=${CORROSION_SRC_FOLDER}-build cmake -S${CORROSION_SRC_FOLDER} -B${CORROSION_BUILD_FOLDER} -DCMAKE_BUILD_TYPE=Release cmake --build ${CORROSION_BUILD_FOLDER} --config Release cmake --install ${CORROSION_BUILD_FOLDER} --config Release + +# Install Electrum ABC test dependencies +here=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") +pip3 install -r ${here}/../../electrum/contrib/requirements/requirements.txt diff --git a/electrum/CMakeLists.txt b/electrum/CMakeLists.txt new file mode 100644 index 000000000..37874e9d5 --- /dev/null +++ b/electrum/CMakeLists.txt @@ -0,0 +1,11 @@ +include(MakeLink) +make_link(test_runner.py) + +add_custom_target(check-electrum + COMMENT "Run Electrum ABC unit tests..." + COMMAND "${Python_EXECUTABLE}" ./test_runner.py + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/test_runner.py +) + +add_dependencies(check-all check-electrum) +add_dependencies(check-extended check-electrum)