From b6a227f189cf6b3b06e9ce8e5a8a5a22aa63c06f Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Tue, 11 Jul 2023 15:19:45 -0700 Subject: [PATCH] import nimbus build tools --- .github/workflows/ci-nimbus.yml | 165 ++++++++++++++++++++++++++++++++ .gitignore | 3 + Makefile | 75 +++++++++++++++ atlas.lock | 139 +++++++++++++++++++++++++++ libp2pdht.nim => codexdht.nim | 0 codexdht.nimble | 65 +++++++++++++ config.nims | 26 ++++- env.sh | 7 ++ libp2pdht.nimble | 63 ------------ vendor/atlas.workspace | 2 + 10 files changed, 478 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/ci-nimbus.yml create mode 100644 Makefile create mode 100644 atlas.lock rename libp2pdht.nim => codexdht.nim (100%) create mode 100644 codexdht.nimble create mode 100755 env.sh delete mode 100644 libp2pdht.nimble create mode 100644 vendor/atlas.workspace diff --git a/.github/workflows/ci-nimbus.yml b/.github/workflows/ci-nimbus.yml new file mode 100644 index 0000000..06db9d4 --- /dev/null +++ b/.github/workflows/ci-nimbus.yml @@ -0,0 +1,165 @@ +name: CI +on: + push: + # branches: + # - main + pull_request: + workflow_dispatch: + +jobs: + build: + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + target: + - os: linux + cpu: amd64 + # - os: linux + # cpu: i386 + - os: macos + cpu: amd64 + - os: windows + cpu: amd64 + #- os: windows + #cpu: i386 + branch: [version-1-6] + include: + - target: + os: linux + builder: ubuntu-20.04 + shell: bash + - target: + os: macos + builder: macos-10.15 + shell: bash + - target: + os: windows + builder: windows-2019 + shell: msys2 {0} + + defaults: + run: + shell: ${{ matrix.shell }} + + name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})' + runs-on: ${{ matrix.builder }} + continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }} + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + + - name: Install build dependencies (Linux i386) + if: runner.os == 'Linux' && matrix.target.cpu == 'i386' + run: | + sudo dpkg --add-architecture i386 + sudo apt-get update -qq + sudo DEBIAN_FRONTEND='noninteractive' apt-get install \ + --no-install-recommends -yq gcc-multilib g++-multilib \ + libssl-dev:i386 + mkdir -p external/bin + cat << EOF > external/bin/gcc + #!/bin/bash + exec $(which gcc) -m32 "\$@" + EOF + cat << EOF > external/bin/g++ + #!/bin/bash + exec $(which g++) -m32 "\$@" + EOF + chmod 755 external/bin/gcc external/bin/g++ + echo '${{ github.workspace }}/external/bin' >> $GITHUB_PATH + + - name: MSYS2 (Windows i386) + if: runner.os == 'Windows' && matrix.target.cpu == 'i386' + uses: msys2/setup-msys2@v2 + with: + path-type: inherit + msystem: MINGW32 + install: >- + base-devel + git + mingw-w64-i686-toolchain + + - name: MSYS2 (Windows amd64) + if: runner.os == 'Windows' && matrix.target.cpu == 'amd64' + uses: msys2/setup-msys2@v2 + with: + path-type: inherit + install: >- + base-devel + git + mingw-w64-x86_64-toolchain + + - name: Restore Nim DLLs dependencies (Windows) from cache + if: runner.os == 'Windows' + id: windows-dlls-cache + uses: actions/cache@v2 + with: + path: external/dlls + key: 'dlls' + + - name: Install DLL dependencies (Windows) + if: > + steps.windows-dlls-cache.outputs.cache-hit != 'true' && + runner.os == 'Windows' + run: | + mkdir external + curl -L "https://nim-lang.org/download/windeps.zip" -o external/windeps.zip + 7z x external/windeps.zip -oexternal/dlls + + - name: Path to cached dependencies (Windows) + if: > + runner.os == 'Windows' + run: | + echo '${{ github.workspace }}'"/external/dlls" >> $GITHUB_PATH + + - name: Derive environment variables + run: | + if [[ '${{ matrix.target.cpu }}' == 'amd64' ]]; then + PLATFORM=x64 + else + PLATFORM=x86 + fi + echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV + + ncpu= + MAKE_CMD="make" + case '${{ runner.os }}' in + 'Linux') + ncpu=$(nproc) + ;; + 'macOS') + ncpu=$(sysctl -n hw.ncpu) + ;; + 'Windows') + ncpu=$NUMBER_OF_PROCESSORS + MAKE_CMD="mingw32-make" + ;; + esac + [[ -z "$ncpu" || $ncpu -le 0 ]] && ncpu=1 + echo "ncpu=$ncpu" >> $GITHUB_ENV + echo "MAKE_CMD=${MAKE_CMD}" >> $GITHUB_ENV + + - name: Restore Nim toolchain binaries from cache + id: nim-cache + uses: actions/cache@v3 + with: + path: NimBinaries + key: ${{ matrix.target.os }}-${{ matrix.target.cpu }}-nim-${{ matrix.branch }}-cache-${{ env.cache_nonce }}-${{ github.run_id }} + restore-keys: ${{ matrix.target.os }}-${{ matrix.target.cpu }}-nim-${{ matrix.branch }}-cache-${{ env.cache_nonce }} + + # - name: Set NIM_COMMIT + # shell: ${{ matrix.shell }} {0} + # run: echo "NIM_COMMIT=${{ matrix.branch }}" >> ${GITHUB_ENV} + + - name: Run tests + run: | + if [[ "${{ matrix.target.os }}" == "windows" ]]; then + # https://github.com/status-im/nimbus-eth2/issues/3121 + export NIMFLAGS="-d:nimRawSetjmp" + fi + export NIM_COMMIT=${{ matrix.branch }} + make -j${ncpu} CI_CACHE=NimBinaries ARCH_OVERRIDE=${PLATFORM} QUICK_AND_DIRTY_COMPILER=1 update + make test -j${ncpu} diff --git a/.gitignore b/.gitignore index e36a278..e5a54f0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ nimcache tests/testAll nimble.develop nimble.paths +nim.cfg +nimbus-build-system.paths +vendor/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4cb31ba --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +# Copyright (c) 2020 Status Research & Development GmbH. Licensed under +# either of: +# - Apache License, version 2.0 +# - MIT license +# at your option. This file may not be copied, modified, or distributed except +# according to those terms. + +SHELL := bash # the shell used internally by Make + +# used inside the included makefiles +BUILD_SYSTEM_DIR := vendor/nimbus-build-system + +# -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics +# -d:chronicles_colors:none - Necessary to disable colors in logs for Docker +DOCKER_IMAGE_NIM_PARAMS ?= -d:chronicles_colors:none -d:insecure + +LINK_PCRE := 0 + +# we don't want an error here, so we can handle things later, in the ".DEFAULT" target +-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk + +.PHONY: \ + all \ + clean \ + coverage \ + deps \ + libbacktrace \ + test \ + update + +ifeq ($(NIM_PARAMS),) +# "variables.mk" was not included, so we update the submodules. +GIT_SUBMODULE_UPDATE := git submodule update --init --recursive +.DEFAULT: + +@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \ + $(GIT_SUBMODULE_UPDATE); \ + echo +# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself: +# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles +# +# After restarting, it will execute its original goal, so we don't have to start a child Make here +# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great? + +else # "variables.mk" was included. Business as usual until the end of this file. + +# default target, because it's the first one that doesn't start with '.' + +# Builds the codex binary +all: | build deps + echo -e $(BUILD_MSG) "$@" && \ + $(ENV_SCRIPT) nim codex $(NIM_PARAMS) codexdht.nims + +# must be included after the default target +-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk + +deps: | deps-common nat-libs codexdht.nims + +#- deletes and recreates "codexdht.nims" which on Windows is a copy instead of a proper symlink +update: | update-common codexdht.nims + rm -rf codexdht.nims && \ + $(MAKE) codexdht.nims $(HANDLE_OUTPUT) + +# Builds and run a part of the test suite +test: | build deps + echo -e $(BUILD_MSG) "$@" && \ + $(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codexdht.nims + +# symlink +codexdht.nims: + ln -s codexdht.nimble $@ + +# usual cleaning +clean: | clean-common + +endif # "variables.mk" was not included diff --git a/atlas.lock b/atlas.lock new file mode 100644 index 0000000..04169bc --- /dev/null +++ b/atlas.lock @@ -0,0 +1,139 @@ +{ + "items": { + "nim-zlib": { + "dir": "vendor/nim-zlib", + "url": "https://github.com/status-im/nim-zlib", + "commit": "f34ca261efd90f118dc1647beefd2f7a69b05d93" + }, + "nim-stew": { + "dir": "vendor/nim-stew", + "url": "https://github.com/status-im/nim-stew.git", + "commit": "e18f5a62af2ade7a1fd1d39635d4e04d944def08" + }, + "nim-http-utils": { + "dir": "vendor/nim-http-utils", + "url": "https://github.com/status-im/nim-http-utils.git", + "commit": "3b491a40c60aad9e8d3407443f46f62511e63b18" + }, + "nim-chronos": { + "dir": "vendor/nim-chronos", + "url": "https://github.com/status-im/nim-chronos.git", + "commit": "6525f4ce1d1a7eba146e5f1a53f6f105077ae686" + }, + "upraises": { + "dir": "vendor/upraises", + "url": "https://github.com/markspanbroek/upraises.git", + "commit": "bc2628989b63854d980e92dadbd58f83e34b6f25" + }, + "nim-sqlite3-abi": { + "dir": "vendor/nim-sqlite3-abi", + "url": "https://github.com/arnetheduck/nim-sqlite3-abi.git", + "commit": "362e1bd9f689ad9f5380d9d27f0705b3d4dfc7d3" + }, + "questionable": { + "dir": "vendor/questionable", + "url": "https://github.com/status-im/questionable.git", + "commit": "0d7ce8efdedaf184680cb7268721fca0af947a74" + }, + "nim-websock": { + "dir": "vendor/nim-websock", + "url": "https://github.com/status-im/nim-websock.git", + "commit": "2c3ae3137f3c9cb48134285bd4a47186fa51f0e8" + }, + "nim-secp256k1": { + "dir": "vendor/nim-secp256k1", + "url": "https://github.com/status-im/nim-secp256k1.git", + "commit": "5340cf188168d6afcafc8023770d880f067c0b2f" + }, + "nim-bearssl": { + "dir": "vendor/nim-bearssl", + "url": "https://github.com/status-im/nim-bearssl.git", + "commit": "f4c4233de453cb7eac0ce3f3ffad6496295f83ab" + }, + "dnsclient.nim": { + "dir": "vendor/dnsclient.nim", + "url": "https://github.com/ba0f3/dnsclient.nim", + "commit": "23214235d4784d24aceed99bbfe153379ea557c8" + }, + "nimcrypto": { + "dir": "vendor/nimcrypto", + "url": "https://github.com/status-im/nimcrypto.git", + "commit": "a5742a9a214ac33f91615f3862c7b099aec43b00" + }, + "nim-json-serialization": { + "dir": "vendor/nim-json-serialization", + "url": "https://github.com/status-im/nim-json-serialization.git", + "commit": "e5b18fb710c3d0167ec79f3b892f5a7a1bc6d1a4" + }, + "nim-testutils": { + "dir": "vendor/nim-testutils", + "url": "https://github.com/status-im/nim-testutils", + "commit": "b56a5953e37fc5117bd6ea6dfa18418c5e112815" + }, + "nim-unittest2": { + "dir": "vendor/nim-unittest2", + "url": "https://github.com/status-im/nim-unittest2.git", + "commit": "b178f47527074964f76c395ad0dfc81cf118f379" + }, + "npeg": { + "dir": "vendor/npeg", + "url": "https://github.com/zevv/npeg", + "commit": "b15a10e388b91b898c581dbbcb6a718d46b27d2f" + }, + "nim-serialization": { + "dir": "vendor/nim-serialization", + "url": "https://github.com/status-im/nim-serialization.git", + "commit": "493d18b8292fc03aa4f835fd825dea1183f97466" + }, + "nim-faststreams": { + "dir": "vendor/nim-faststreams", + "url": "https://github.com/status-im/nim-faststreams.git", + "commit": "1b561a9e71b6bdad1c1cdff753418906037e9d09" + }, + "nim-datastore": { + "dir": "vendor/nim-datastore", + "url": "https://github.com/codex-storage/nim-datastore.git", + "commit": "0cde8aeb67c59fd0ac95496dc6b5e1168d6632aa" + }, + "asynctest": { + "dir": "vendor/asynctest", + "url": "https://github.com/markspanbroek/asynctest", + "commit": "a236a5f0f3031573ac2cb082b63dbf6e170e06e7" + }, + "nim-stint": { + "dir": "vendor/nim-stint", + "url": "https://github.com/status-im/nim-stint.git", + "commit": "036c71d06a6b22f8f967ba9d54afd2189c3872ca" + }, + "nim-metrics": { + "dir": "vendor/nim-metrics", + "url": "https://github.com/status-im/nim-metrics.git", + "commit": "743f81d4f6c6ebf0ac02389f2392ff8b4235bee5" + }, + "nim-libp2p": { + "dir": "vendor/nim-libp2p", + "url": "https://github.com/status-im/nim-libp2p.git", + "commit": "a3e9d1ed80c048cd5abc839cbe0863cefcedc702" + }, + "nim-chronicles": { + "dir": "vendor/nim-chronicles", + "url": "https://github.com/status-im/nim-chronicles.git", + "commit": "7631f7b2ee03398cb1512a79923264e8f9410af6" + }, + "nim-protobuf-serialization": { + "dir": "vendor/nim-protobuf-serialization", + "url": "https://github.com/status-im/nim-protobuf-serialization", + "commit": "28214b3e40c755a9886d2ec8f261ec48fbb6bec6" + } + }, + "nimcfg": "############# begin Atlas config section ##########\n--noNimblePath\n--path:\"vendor/nim-secp256k1\"\n--path:\"vendor/nim-protobuf-serialization\"\n--path:\"vendor/nimcrypto\"\n--path:\"vendor/nim-bearssl\"\n--path:\"vendor/nim-chronicles\"\n--path:\"vendor/nim-chronos\"\n--path:\"vendor/nim-libp2p\"\n--path:\"vendor/nim-metrics\"\n--path:\"vendor/nim-stew\"\n--path:\"vendor/nim-stint\"\n--path:\"vendor/asynctest\"\n--path:\"vendor/nim-datastore\"\n--path:\"vendor/questionable\"\n--path:\"vendor/nim-faststreams\"\n--path:\"vendor/nim-serialization\"\n--path:\"vendor/npeg/src\"\n--path:\"vendor/nim-unittest2\"\n--path:\"vendor/nim-testutils\"\n--path:\"vendor/nim-json-serialization\"\n--path:\"vendor/nim-http-utils\"\n--path:\"vendor/dnsclient.nim/src\"\n--path:\"vendor/nim-websock\"\n--path:\"vendor/nim-sqlite3-abi\"\n--path:\"vendor/upraises\"\n--path:\"vendor/nim-zlib\"\n############# end Atlas config section ##########\n", + "nimbleFile": { + "filename": "nim-codex-dht.nimble", + "content": "# Package\n\nversion = \"0.0.1\"\nauthor = \"Status Research & Development GmbH\"\ndescription = \"DHT based on the libp2p Kademlia spec\"\nlicense = \"MIT\"\nskipDirs = @[\"tests\"]\n\n\n# Dependencies\nrequires \"nim >= 1.2.0\"\nrequires \"secp256k1#b3f38e2795e805743b299dc5d96d332db375b520\" # >= 0.5.2 & < 0.6.0\nrequires \"protobuf_serialization#27b400fdf3bd8ce7120ca66fc1de39d3f1a5804a\" # >= 0.2.0 & < 0.3.0\nrequires \"nimcrypto == 0.5.4\"\nrequires \"bearssl#head\"\nrequires \"chronicles >= 0.10.2 & < 0.11.0\"\nrequires \"chronos#1394c9e04957928afc1db33d2e0965cfb677a1e0\" # >= 3.0.11 & < 3.1.0\nrequires \"libp2p#unstable\"\nrequires \"metrics\"\nrequires \"stew#head\"\nrequires \"stint\"\nrequires \"asynctest >= 0.3.1 & < 0.4.0\"\nrequires \"https://github.com/status-im/nim-datastore#head\"\nrequires \"questionable\"\n\ntask testAll, \"Run DHT tests\":\n exec \"nim c -r tests/testAll.nim\"\n\n# task coverage, \"generates code coverage report\":\n# var (output, exitCode) = gorgeEx(\"which lcov\")\n# if exitCode != 0:\n# echo \"\"\n# echo \" ************************** ⛔️ ERROR ⛔️ **************************\"\n# echo \" ** **\"\n# echo \" ** ERROR: lcov not found, it must be installed to run code **\"\n# echo \" ** coverage locally **\"\n# echo \" ** **\"\n# echo \" *****************************************************************\"\n# echo \"\"\n# quit 1\n\n# (output, exitCode) = gorgeEx(\"gcov --version\")\n# if output.contains(\"Apple LLVM\"):\n# echo \"\"\n# echo \" ************************* ⚠️ WARNING ⚠️ *************************\"\n# echo \" ** **\"\n# echo \" ** WARNING: Using Apple's llvm-cov in place of gcov, which **\"\n# echo \" ** emulates an old version of gcov (4.2.0) and therefore **\"\n# echo \" ** coverage results will differ than those on CI (which **\"\n# echo \" ** uses a much newer version of gcov). **\"\n# echo \" ** **\"\n# echo \" *****************************************************************\"\n# echo \"\"\n\n# exec(\"nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage\")\n# exec(\"cd nimcache; rm *.c; cd ..\")\n# mkDir(\"coverage\")\n# exec(\"lcov --capture --directory nimcache --output-file coverage/coverage.info\")\n# exec(\"$(which bash) -c 'shopt -s globstar; ls $(pwd)/libp2pdht/{*,**/*}.nim'\")\n# exec(\"$(which bash) -c 'shopt -s globstar; lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info'\")\n# echo \"Generating HTML coverage report\"\n# exec(\"genhtml coverage/coverage.f.info --output-directory coverage/report\")\n# echo \"Opening HTML coverage report in browser...\"\n# exec(\"open coverage/report/index.html\")\n\n" + }, + "hostOS": "macosx", + "hostCPU": "arm64", + "nimVersion": "1.6.14", + "gccVersion": "", + "clangVersion": "" +} \ No newline at end of file diff --git a/libp2pdht.nim b/codexdht.nim similarity index 100% rename from libp2pdht.nim rename to codexdht.nim diff --git a/codexdht.nimble b/codexdht.nimble new file mode 100644 index 0000000..75023d4 --- /dev/null +++ b/codexdht.nimble @@ -0,0 +1,65 @@ +# Package + +version = "0.2.0" +author = "Status Research & Development GmbH" +description = "DHT based on the libp2p Kademlia spec" +license = "MIT" +skipDirs = @["tests"] + + +# Dependencies +requires "nim >= 1.2.0" +requires "secp256k1#b3f38e2795e805743b299dc5d96d332db375b520" # >= 0.5.2 & < 0.6.0 +requires "protobuf_serialization#27b400fdf3bd8ce7120ca66fc1de39d3f1a5804a" # >= 0.2.0 & < 0.3.0 +requires "nimcrypto == 0.5.4" +requires "bearssl#head" +requires "chronicles >= 0.10.2 & < 0.11.0" +requires "chronos#1394c9e04957928afc1db33d2e0965cfb677a1e0" # >= 3.0.11 & < 3.1.0 +requires "libp2p#unstable" +requires "metrics" +requires "stew#head" +requires "stint" +requires "asynctest >= 0.3.1 & < 0.4.0" +requires "https://github.com/status-im/nim-datastore#head" +requires "questionable" + +task testAll, "Run DHT tests": + exec "nim c -r tests/testAll.nim" + +# task coverage, "generates code coverage report": +# var (output, exitCode) = gorgeEx("which lcov") +# if exitCode != 0: +# echo "" +# echo " ************************** ⛔️ ERROR ⛔️ **************************" +# echo " ** **" +# echo " ** ERROR: lcov not found, it must be installed to run code **" +# echo " ** coverage locally **" +# echo " ** **" +# echo " *****************************************************************" +# echo "" +# quit 1 + +# (output, exitCode) = gorgeEx("gcov --version") +# if output.contains("Apple LLVM"): +# echo "" +# echo " ************************* ⚠️ WARNING ⚠️ *************************" +# echo " ** **" +# echo " ** WARNING: Using Apple's llvm-cov in place of gcov, which **" +# echo " ** emulates an old version of gcov (4.2.0) and therefore **" +# echo " ** coverage results will differ than those on CI (which **" +# echo " ** uses a much newer version of gcov). **" +# echo " ** **" +# echo " *****************************************************************" +# echo "" + +# exec("nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage") +# exec("cd nimcache; rm *.c; cd ..") +# mkDir("coverage") +# exec("lcov --capture --directory nimcache --output-file coverage/coverage.info") +# exec("$(which bash) -c 'shopt -s globstar; ls $(pwd)/libp2pdht/{*,**/*}.nim'") +# exec("$(which bash) -c 'shopt -s globstar; lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info'") +# echo "Generating HTML coverage report" +# exec("genhtml coverage/coverage.f.info --output-directory coverage/report") +# echo "Opening HTML coverage report in browser..." +# exec("open coverage/report/index.html") + diff --git a/config.nims b/config.nims index 068054d..4d5fef5 100644 --- a/config.nims +++ b/config.nims @@ -1,7 +1,25 @@ +import std/os + +const currentDir = currentSourcePath()[0 .. ^(len("config.nims") + 1)] + switch("define", "libp2p_pki_schemes=secp256k1") -# begin Nimble config (version 2) ---noNimblePath -when withDir(thisDir(), system.fileExists("nimble.paths")): +task testAll, "Run DHT tests": + exec "nim c -r tests/testAll.nim" + +task test, "Run DHT tests": + testAllTask() + +when getEnv("NIMBUS_BUILD_SYSTEM") == "yes" and + # BEWARE + # In Nim 1.6, config files are evaluated with a working directory + # matching where the Nim command was invocated. This means that we + # must do all file existance checks with full absolute paths: + system.fileExists(currentDir & "nimbus-build-system.paths"): + echo "Using Nimbus Paths" + include "nimbus-build-system.paths" +elif fileExists("nimble.paths"): + echo "Using Nimble Paths" + # begin Nimble config (version 1) include "nimble.paths" -# end Nimble config + # end Nimble config diff --git a/env.sh b/env.sh new file mode 100755 index 0000000..697a426 --- /dev/null +++ b/env.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file +# and we fall back to a Zsh-specific special var to also support Zsh. +REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})" +ABS_PATH="$(cd ${REL_PATH}; pwd)" +source ${ABS_PATH}/vendor/nimbus-build-system/scripts/env.sh diff --git a/libp2pdht.nimble b/libp2pdht.nimble deleted file mode 100644 index 29712ca..0000000 --- a/libp2pdht.nimble +++ /dev/null @@ -1,63 +0,0 @@ -# Package - -version = "0.1.0" -author = "Status Research & Development GmbH" -description = "DHT based on the libp2p Kademlia spec" -license = "MIT" -skipDirs = @["tests"] - - -# TODO: fix versions after tagging the version in the corresponding package -# Dependencies -requires "nim >= 1.2.0" -requires "secp256k1#b3f38e2795e805743b299dc5d96d332db375b520" # >= 0.5.2 & < 0.6.0 -requires "protobuf_serialization#27b400fdf3bd8ce7120ca66fc1de39d3f1a5804a" # >= 0.2.0 & < 0.3.0 -requires "nimcrypto == 0.5.4" -requires "bearssl#head" -requires "chronicles >= 0.10.2 & < 0.11.0" -requires "chronos#1394c9e04957928afc1db33d2e0965cfb677a1e0" # >= 3.0.11 & < 3.1.0 -requires "libp2p#unstable" -requires "metrics" -requires "stew#head" -requires "stint" -requires "asynctest >= 0.3.1 & < 0.4.0" -requires "https://github.com/status-im/nim-datastore#head" -requires "questionable" - -task coverage, "generates code coverage report": - var (output, exitCode) = gorgeEx("which lcov") - if exitCode != 0: - echo "" - echo " ************************** ⛔️ ERROR ⛔️ **************************" - echo " ** **" - echo " ** ERROR: lcov not found, it must be installed to run code **" - echo " ** coverage locally **" - echo " ** **" - echo " *****************************************************************" - echo "" - quit 1 - - (output, exitCode) = gorgeEx("gcov --version") - if output.contains("Apple LLVM"): - echo "" - echo " ************************* ⚠️ WARNING ⚠️ *************************" - echo " ** **" - echo " ** WARNING: Using Apple's llvm-cov in place of gcov, which **" - echo " ** emulates an old version of gcov (4.2.0) and therefore **" - echo " ** coverage results will differ than those on CI (which **" - echo " ** uses a much newer version of gcov). **" - echo " ** **" - echo " *****************************************************************" - echo "" - - exec("nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage") - exec("cd nimcache; rm *.c; cd ..") - mkDir("coverage") - exec("lcov --capture --directory nimcache --output-file coverage/coverage.info") - exec("$(which bash) -c 'shopt -s globstar; ls $(pwd)/libp2pdht/{*,**/*}.nim'") - exec("$(which bash) -c 'shopt -s globstar; lcov --extract coverage/coverage.info $(pwd)/libp2pdht/{*,**/*}.nim --output-file coverage/coverage.f.info'") - echo "Generating HTML coverage report" - exec("genhtml coverage/coverage.f.info --output-directory coverage/report") - echo "Opening HTML coverage report in browser..." - exec("open coverage/report/index.html") - diff --git a/vendor/atlas.workspace b/vendor/atlas.workspace new file mode 100644 index 0000000..79173a1 --- /dev/null +++ b/vendor/atlas.workspace @@ -0,0 +1,2 @@ +deps="" +resolver="MaxVer"