diff --git a/.github/actions/install_nimble/action.yml b/.github/actions/install_nimble/action.yml deleted file mode 100644 index 291c131..0000000 --- a/.github/actions/install_nimble/action.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Install Nimble -description: install nimble -inputs: - nimble_version: - description: "install nimble" - # TODO: make sure to change to tagged release when available - default: "latest" - os: - description: "operating system" - default: "linux" - cpu: - description: "cpu architecture" - default: "amd64" -runs: - using: "composite" - steps: - - uses: actions/checkout@v3 - - name: Build Nimble - shell: bash - run: | - set -x - mkdir -p .nimble - cd .nimble - if [[ '${{ inputs.cpu }}' == 'amd64' ]]; then - CPU=x64 - elif [[ '${{ inputs.cpu }}' == 'i386' ]]; then - CPU=x32 - else - CPU=${{ inputs.cpu }} - fi - - if [[ '${{ inputs.os }}' == 'macos' ]]; then - OS=macosx - else - OS='${{ inputs.os }}' - fi - URL=https://github.com/nim-lang/nimble/releases/download/${{ inputs.nimble_version }}/nimble-"$OS"_"$CPU".tar.gz - curl -o nimble.tar.gz -L -s -S "$URL" - tar -xvf nimble.tar.gz - - name: Derive environment variables - shell: bash - run: echo '${{ github.workspace }}/.nimble/' >> $GITHUB_PATH diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 062653b..a25711f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,134 +1,22 @@ name: CI -on: - push: - branches: - - master - pull_request: - workflow_dispatch: + +on: [push, pull_request] jobs: - build: - timeout-minutes: 90 + test: + runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: - target: - - os: linux - cpu: amd64 - tests: all - - os: macos - cpu: amd64 - tests: all - - os: windows - cpu: amd64 - tests: part1 - - os: windows - cpu: amd64 - tests: part2 - branch: [version-1-6] - include: - - target: - os: linux - builder: ubuntu-20.04 - shell: bash - - target: - os: macos - builder: macos-12 - shell: bash - - target: - os: windows - builder: windows-latest - 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' }} + nim: [1.6.18] + os: [ubuntu-latest, macOS-latest, windows-latest] steps: - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - - 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 - - ## Restore nimble deps - - name: Restore nimble dependencies from cache - id: nimble_deps - uses: actions/cache@v3 - with: - path: | - ~/.nimble - ${{ github.workspace }}/.nimble - key: ${{ matrix.builder }}-${{ matrix.target.cpu }}-dotnimble-${{ hashFiles('nimble.lock') }} - - - name: Setup Nimble - uses: "./.github/actions/install_nimble" - with: - os: ${{ matrix.target.os }} - cpu: ${{ matrix.target.cpu }} - - - name: Setup Env - run: | - nimble -v - - - name: Setup Deps - run: | - nimble install -d - nimble setup - - - name: Run tests - if: runner.os != 'Windows' - run: | - nimble test -y - - - name: Run windows tests part1 - if: runner.os == 'Windows' && matrix.target.tests == 'part1' - run: | - if [[ "${{ matrix.target.os }}" == "windows" ]]; then - # https://github.com/status-im/nimbus-eth2/issues/3121 - export NIMFLAGS="-d:nimRawSetjmp" - fi - - nimble testPart1 -y - - - name: Run windows tests part2 - if: runner.os == 'Windows' && matrix.target.tests == 'part2' - run: | - if [[ "${{ matrix.target.os }}" == "windows" ]]; then - export NIMFLAGS="-d:nimRawSetjmp" - fi - - nimble testPart2 -y + - name: Checkout + uses: actions/checkout@v4 + - name: Install Nim + uses: iffy/install-nim@v5 + with: + version: ${{ matrix.nim }} + - name: Build + run: nimble install -y + - name: Test + run: nimble test -y \ No newline at end of file diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index b509985..0000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Generate and upload code coverage - -on: - #On push to common branches, this computes the "bases stats" for PRs - push: - branches: - - master - pull_request: - workflow_dispatch: - -jobs: - All_Tests: - name: All tests - runs-on: ubuntu-20.04 - strategy: - matrix: - nim-options: [ - "" - ] - test-program: [ - "test" - ] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Environment setup - run: | - sudo apt-get update - sudo apt-get install -y lcov build-essential git curl - mkdir coverage - - - name: Restore nimble dependencies from cache - id: nimble_deps - uses: actions/cache@v3 - with: - path: | - ~/.nimble - key: ubuntu-20.04-amd64-${{ hashFiles('nimble.lock') }} - - - name: Setup Nimble - uses: "./.github/actions/install_nimble" - with: - os: linux - cpu: x64 - - - name: Setup Env - run: | - nimble -v - - - name: Setup Deps - run: | - nimble install -d - nimble setup - - - name: Run tests - run: | - nimble -y --verbose coverage - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - directory: ./coverage/ - fail_ci_if_error: true - files: ./coverage/coverage.f.info - flags: unittests - name: codecov-umbrella - verbose: true diff --git a/atlas.lock b/atlas.lock deleted file mode 100644 index c97210b..0000000 --- a/atlas.lock +++ /dev/null @@ -1,230 +0,0 @@ -{ - "items": { - "zlib": { - "dir": "$deps/nim-zlib", - "url": "https://github.com/status-im/nim-zlib", - "commit": "a2f44bb7f65571a894227ff6fde9298a104e03a5", - "version": "0.1.0" - }, - "stew": { - "dir": "$deps/nim-stew", - "url": "https://github.com/status-im/nim-stew", - "commit": "2c2544aec13536304438be045bfdd22452741466", - "version": "0.1.0" - }, - "httputils": { - "dir": "$deps/nim-http-utils", - "url": "https://github.com/status-im/nim-http-utils", - "commit": "77a59297ad635d91a6352ef48ee09c6bde0c5d86", - "version": "0.3.0" - }, - "chronos": { - "dir": "$deps/nim-chronos", - "url": "https://github.com/status-im/nim-chronos", - "commit": "e15dc3b41fea95348b58f32244962c1c6df310a7", - "version": "3.2.0" - }, - "upraises": { - "dir": "$deps/upraises", - "url": "https://github.com/markspanbroek/upraises", - "commit": "bc2628989b63854d980e92dadbd58f83e34b6f25", - "version": "0.1.0" - }, - "sqlite3_abi": { - "dir": "$deps/nim-sqlite3-abi", - "url": "https://github.com/arnetheduck/nim-sqlite3-abi", - "commit": "362e1bd9f689ad9f5380d9d27f0705b3d4dfc7d3", - "version": "3.40.1.1" - }, - "questionable": { - "dir": "$deps/questionable", - "url": "https://github.com/codex-storage/questionable", - "commit": "1f0afff48bf80ab1149a0957f9743f345bc14b71", - "version": "0.10.12" - }, - "websock": { - "dir": "$deps/nim-websock", - "url": "https://github.com/status-im/nim-websock", - "commit": "f8ed9b40a5ff27ad02a3c237c4905b0924e3f982", - "version": "0.1.0" - }, - "secp256k1": { - "dir": "$deps/nim-secp256k1", - "url": "https://github.com/status-im/nim-secp256k1", - "commit": "7246d91c667f4cc3759fdd50339caa45a2ecd8be", - "version": "0.6.0.3.2" - }, - "bearssl": { - "dir": "$deps/nim-bearssl", - "url": "https://github.com/status-im/nim-bearssl", - "commit": "d55d3a86d7ec3ad11b244e17b3bad490bfbd076d", - "version": "0.2.1" - }, - "dnsclient": { - "dir": "$deps/dnsclient.nim", - "url": "https://github.com/ba0f3/dnsclient.nim", - "commit": "23214235d4784d24aceed99bbfe153379ea557c8", - "version": "0.3.4" - }, - "nimcrypto": { - "dir": "$deps/nimcrypto", - "url": "https://github.com/status-im/nimcrypto", - "commit": "24e006df85927f64916e60511620583b11403178", - "version": "0.5.4" - }, - "results": { - "dir": "$deps/nim-results", - "url": "https://github.com/arnetheduck/nim-results", - "commit": "113d433f48894ee8e7da3e340c8fe19ad7b9db4d", - "version": "0.4.0" - }, - "json_serialization": { - "dir": "$deps/nim-json-serialization", - "url": "https://github.com/status-im/nim-json-serialization", - "commit": "3f1ce24ee116daedbc9c8be525e63ec03e185a28", - "version": "0.2.2" - }, - "testutils": { - "dir": "$deps/nim-testutils", - "url": "https://github.com/status-im/nim-testutils", - "commit": "b56a5953e37fc5117bd6ea6dfa18418c5e112815", - "version": "0.5.0" - }, - "unittest2": { - "dir": "$deps/nim-unittest2", - "url": "https://github.com/status-im/nim-unittest2", - "commit": "262b697f38d6b6f1e7462d3b3ab81d79b894e336", - "version": "0.2.1" - }, - "npeg": { - "dir": "$deps/npeg", - "url": "https://github.com/zevv/npeg", - "commit": "b9051a64376d277912ec7616bbb21688754160c7", - "version": "1.2.1" - }, - "serialization": { - "dir": "$deps/nim-serialization", - "url": "https://github.com/status-im/nim-serialization", - "commit": "4d541ec43454809904fc4c3c0a7436410ad597d2", - "version": "0.2.2" - }, - "faststreams": { - "dir": "$deps/nim-faststreams", - "url": "https://github.com/status-im/nim-faststreams", - "commit": "720fc5e5c8e428d9d0af618e1e27c44b42350309", - "version": "0.3.0" - }, - "datastore": { - "dir": "$deps/nim-datastore", - "url": "https://github.com/codex-storage/nim-datastore", - "commit": "cadf38db576a2cf6145188f285f042e56aad7c91", - "version": "0.0.1" - }, - "asynctest": { - "dir": "$deps/asynctest", - "url": "https://github.com/markspanbroek/asynctest", - "commit": "c9423b198f1a7fad128396ffaaa92077a1dda869", - "version": "0.4.3" - }, - "stint": { - "dir": "$deps/nim-stint", - "url": "https://github.com/status-im/nim-stint", - "commit": "711cda4456c32d3ba3c6c4524135b3453dffeb9c", - "version": "2.0.0" - }, - "metrics": { - "dir": "$deps/nim-metrics", - "url": "https://github.com/status-im/nim-metrics", - "commit": "51f1227d0fd04ce84b1ef784b11280cb7875348c", - "version": "0.0.1" - }, - "libp2p": { - "dir": "$deps/nim-libp2p", - "url": "https://github.com/status-im/nim-libp2p", - "commit": "e3c967ad1939fb33b8e13759037d193734acd202", - "version": "1.1.0" - }, - "chronicles": { - "dir": "$deps/nim-chronicles", - "url": "https://github.com/status-im/nim-chronicles", - "commit": "ccbb7566d1a06bfc1ec42dd8da74a47f1d3b3f4b", - "version": "0.10.3" - }, - "protobuf_serialization": { - "dir": "$deps/nim-protobuf-serialization", - "url": "https://github.com/status-im/nim-protobuf-serialization", - "commit": "5a31137a82c2b6a989c9ed979bb636c7a49f570e", - "version": "0.3.0" - } - }, - "nimcfg": [ - "############# begin Atlas config section ##########", - "--noNimblePath", - "--path:\"vendor/nim-unittest2\"", - "--path:\"vendor/nim-secp256k1\"", - "--path:\"vendor/nim-protobuf-serialization\"", - "--path:\"vendor/nimcrypto\"", - "--path:\"vendor/nim-bearssl\"", - "--path:\"vendor/nim-chronicles\"", - "--path:\"vendor/nim-chronos\"", - "--path:\"vendor/nim-libp2p\"", - "--path:\"vendor/nim-metrics\"", - "--path:\"vendor/nim-stew\"", - "--path:\"vendor/nim-stint\"", - "--path:\"vendor/asynctest\"", - "--path:\"vendor/nim-datastore\"", - "--path:\"vendor/questionable\"", - "--path:\"vendor/nim-faststreams\"", - "--path:\"vendor/nim-serialization\"", - "--path:\"vendor/npeg/src\"", - "--path:\"vendor/nim-testutils\"", - "--path:\"vendor/nim-json-serialization\"", - "--path:\"vendor/nim-results\"", - "--path:\"vendor/nim-http-utils\"", - "--path:\"vendor/dnsclient.nim/src\"", - "--path:\"vendor/nim-websock\"", - "--path:\"vendor/nim-sqlite3-abi\"", - "--path:\"vendor/upraises\"", - "--path:\"vendor/nim-zlib\"", - "############# end Atlas config section ##########", - "" - ], - "nimbleFile": { - "filename": "codexdht.nimble", - "content": [ - "# Package", - "", - "version = \"0.4.0\"", - "author = \"Status Research & Development GmbH\"", - "description = \"DHT based on Eth discv5 implementation\"", - "license = \"MIT\"", - "skipDirs = @[\"tests\"]", - "installFiles = @[\"build.nims\"]", - "", - "# Dependencies", - "requires \"nim >= 1.6.18\"", - "requires \"unittest2 <= 0.0.9\"", - "requires \"secp256k1#2acbbdcc0e63002a013fff49f015708522875832\" # >= 0.5.2 & < 0.6.0", - "requires \"protobuf_serialization\" # >= 0.2.0 & < 0.3.0", - "requires \"nimcrypto >= 0.5.4\"", - "requires \"bearssl#head\"", - "requires \"chronicles >= 0.10.2 & < 0.11.0\"", - "requires \"chronos#e15dc3b41fea95348b58f32244962c1c6df310a7\" # Change to >= 4.0.0 & < 5.0.0 when available", - "requires \"libp2p#unstable\"", - "requires \"metrics\"", - "requires \"stew#head\"", - "requires \"stint\"", - "requires \"asynctest >= 0.4.3 & < 0.5.0\"", - "requires \"https://github.com/codex-storage/nim-datastore#head\"", - "requires \"questionable\"", - "", - "include \"build.nims\"", - " " - ] - }, - "hostOS": "linux", - "hostCPU": "amd64", - "nimVersion": "1.6.18 a749a8b742bd0a4272c26a65517275db4720e58a", - "gccVersion": "11.4.0", - "clangVersion": "" -} \ No newline at end of file diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 429a94c..0000000 --- a/codecov.yml +++ /dev/null @@ -1,22 +0,0 @@ -coverage: - status: - project: - default: - # advanced settings - - # Prevents PR from being blocked with a reduction in coverage. - # Note, if we want to re-enable this, a `threshold` value can be used - # allow coverage to drop by x% while still posting a success status. - # `informational`: https://docs.codecov.com/docs/commit-status#informational - # `threshold`: https://docs.codecov.com/docs/commit-status#threshold - informational: true - patch: - default: - # advanced settings - - # Prevents PR from being blocked with a reduction in coverage. - # Note, if we want to re-enable this, a `threshold` value can be used - # allow coverage to drop by x% while still posting a success status. - # `informational`: https://docs.codecov.com/docs/commit-status#informational - # `threshold`: https://docs.codecov.com/docs/commit-status#threshold - informational: true diff --git a/codexdht.nimble b/codexdht.nimble index bee2094..6e3fe3e 100644 --- a/codexdht.nimble +++ b/codexdht.nimble @@ -5,24 +5,37 @@ author = "Status Research & Development GmbH" description = "DHT based on Eth discv5 implementation" license = "MIT" skipDirs = @["tests"] -installFiles = @["build.nims"] # Dependencies -requires "nim >= 1.6.18" -requires "unittest2 <= 0.0.9" requires "secp256k1#2acbbdcc0e63002a013fff49f015708522875832" # >= 0.5.2 & < 0.6.0 requires "protobuf_serialization" # >= 0.2.0 & < 0.3.0 requires "nimcrypto >= 0.5.4" -requires "bearssl#head" +requires "bearssl == 0.2.5" requires "chronicles >= 0.10.2 & < 0.11.0" -requires "chronos#e15dc3b41fea95348b58f32244962c1c6df310a7" # Change to >= 4.0.0 & < 5.0.0 when available -requires "libp2p#unstable" +requires "chronos#dc3847e4d6733dfc3811454c2a9c384b87343e26" +requires "libp2p == 1.5.0" requires "metrics" requires "stew#head" requires "stint" -requires "asynctest >= 0.4.3 & < 0.5.0" -requires "https://github.com/codex-storage/nim-datastore#head" +requires "https://github.com/codex-storage/nim-datastore >= 0.1.0 & < 0.2.0" requires "questionable" -include "build.nims" - \ No newline at end of file +task testAll, "Run all test suites": + exec "nimble install -d -y" + withDir "tests": + exec "nimble testAll" + +task test, "Run the test suite": + exec "nimble install -d -y" + withDir "tests": + exec "nimble test" + +task testPart1, "Run the test suite part 1": + exec "nimble install -d -y" + withDir "tests": + exec "nimble testPart1" + +task testPart2, "Run the test suite part 2": + exec "nimble install -d -y" + withDir "tests": + exec "nimble testPart2" diff --git a/config.nims b/config.nims index 15e1770..eacae8d 100644 --- a/config.nims +++ b/config.nims @@ -1,10 +1,2 @@ switch("define", "libp2p_pki_schemes=secp256k1") - -include "build.nims" - -# begin Nimble config (version 2) ---noNimblePath -when withDir(thisDir(), system.fileExists("nimble.paths")): - include "nimble.paths" -# end Nimble config diff --git a/nimble.lock b/nimble.lock deleted file mode 100644 index 1bc1879..0000000 --- a/nimble.lock +++ /dev/null @@ -1,347 +0,0 @@ -{ - "version": 2, - "packages": { - "nim": { - "version": "1.6.18", - "vcsRevision": "a749a8b742bd0a4272c26a65517275db4720e58a", - "url": "https://github.com/nim-lang/Nim.git", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "58115cfda490735d846a2116ab53e814bb5559d3" - } - }, - "asynctest": { - "version": "0.4.3", - "vcsRevision": "9f31323a5f38bf9d7402676f8171aceea45fa091", - "url": "https://github.com/markspanbroek/asynctest", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "55d18b230dd63a1bebefed235aceee6e986b9193" - } - }, - "results": { - "version": "0.4.0", - "vcsRevision": "113d433f48894ee8e7da3e340c8fe19ad7b9db4d", - "url": "https://github.com/arnetheduck/nim-results", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "bb03f4dd49b66ba6973257ae1fc121756704b0b1" - } - }, - "unittest2": { - "version": "0.0.9", - "vcsRevision": "299bc9a5741f1cd34e5014187e66d904b2f00b37", - "url": "https://github.com/status-im/nim-unittest2", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "2f316e59b1c61a6a51d0c1bfa8b4fea24a7c60ea" - } - }, - "stew": { - "version": "0.1.0", - "vcsRevision": "2c2544aec13536304438be045bfdd22452741466", - "url": "https://github.com/status-im/nim-stew", - "downloadMethod": "git", - "dependencies": [ - "results", - "unittest2" - ], - "checksums": { - "sha1": "0d3c4f15a4cff934ec30e5b2d5fe590922839a4e" - } - }, - "faststreams": { - "version": "0.3.0", - "vcsRevision": "720fc5e5c8e428d9d0af618e1e27c44b42350309", - "url": "https://github.com/status-im/nim-faststreams", - "downloadMethod": "git", - "dependencies": [ - "stew", - "unittest2" - ], - "checksums": { - "sha1": "ab178ba25970b95d953434b5d86b4d60396ccb64" - } - }, - "serialization": { - "version": "0.2.2", - "vcsRevision": "4d541ec43454809904fc4c3c0a7436410ad597d2", - "url": "https://github.com/status-im/nim-serialization", - "downloadMethod": "git", - "dependencies": [ - "faststreams", - "unittest2", - "stew" - ], - "checksums": { - "sha1": "1dcdb29f17d0aff295e7e57edf530b1e16fb6c59" - } - }, - "bearssl": { - "version": "0.2.1", - "vcsRevision": "d55d3a86d7ec3ad11b244e17b3bad490bfbd076d", - "url": "https://github.com/status-im/nim-bearssl", - "downloadMethod": "git", - "dependencies": [ - "unittest2" - ], - "checksums": { - "sha1": "5327c983483c4dd465347c6b8a974239c7c6c612" - } - }, - "httputils": { - "version": "0.3.0", - "vcsRevision": "77a59297ad635d91a6352ef48ee09c6bde0c5d86", - "url": "https://github.com/status-im/nim-http-utils", - "downloadMethod": "git", - "dependencies": [ - "stew", - "unittest2" - ], - "checksums": { - "sha1": "f53480dd7ed0ac9b3ca7972f8b5e0f1862ce99ac" - } - }, - "chronos": { - "version": "3.2.0", - "vcsRevision": "c41599a6d6d8b11c729032bf8913e06f4171e0fb", - "url": "https://github.com/status-im/nim-chronos", - "downloadMethod": "git", - "dependencies": [ - "results", - "stew", - "bearssl", - "httputils", - "unittest2" - ], - "checksums": { - "sha1": "41227a7f20f19cbc6f343c9cae86861f81b7a7d0" - } - }, - "questionable": { - "version": "0.10.12", - "vcsRevision": "2dd6b6b220f9f14a1231f6cafdf24f012bcc8414", - "url": "https://github.com/markspanbroek/questionable", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "3860fae4394990982d878182f3d3931b8fcb5a10" - } - }, - "sqlite3_abi": { - "version": "3.40.1.1", - "vcsRevision": "362e1bd9f689ad9f5380d9d27f0705b3d4dfc7d3", - "url": "https://github.com/arnetheduck/nim-sqlite3-abi", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "8e91db8156a82383d9c48f53b33e48f4e93077b1" - } - }, - "upraises": { - "version": "0.1.0", - "vcsRevision": "d9f268db1021959fe0f2c7a5e49fba741f9932a0", - "url": "https://github.com/markspanbroek/upraises", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "176234f808b44a0be763df706ed634d6e8df17bb" - } - }, - "datastore": { - "version": "0.0.1", - "vcsRevision": "cadf38db576a2cf6145188f285f042e56aad7c91", - "url": "https://github.com/codex-storage/nim-datastore", - "downloadMethod": "git", - "dependencies": [ - "asynctest", - "chronos", - "questionable", - "sqlite3_abi", - "stew", - "unittest2", - "upraises" - ], - "checksums": { - "sha1": "5b5bc0576f7d0565bb624a4ae7ad2717805b6849" - } - }, - "testutils": { - "version": "0.5.0", - "vcsRevision": "dfc4c1b39f9ded9baf6365014de2b4bfb4dafc34", - "url": "https://github.com/status-im/nim-testutils", - "downloadMethod": "git", - "dependencies": [ - "unittest2" - ], - "checksums": { - "sha1": "756d0757c4dd06a068f9d38c7f238576ba5ee897" - } - }, - "json_serialization": { - "version": "0.2.2", - "vcsRevision": "3f1ce24ee116daedbc9c8be525e63ec03e185a28", - "url": "https://github.com/status-im/nim-json-serialization", - "downloadMethod": "git", - "dependencies": [ - "serialization", - "stew" - ], - "checksums": { - "sha1": "da0d38b775f222703784b273225fe89267430482" - } - }, - "chronicles": { - "version": "0.10.3", - "vcsRevision": "32ac8679680ea699f7dbc046e8e0131cac97d41a", - "url": "https://github.com/status-im/nim-chronicles", - "downloadMethod": "git", - "dependencies": [ - "testutils", - "json_serialization" - ], - "checksums": { - "sha1": "79f09526d4d9b9196dd2f6a75310d71a890c4f88" - } - }, - "nimcrypto": { - "version": "0.6.0", - "vcsRevision": "a079df92424968d46a6ac258299ce9380aa153f2", - "url": "https://github.com/cheatfate/nimcrypto", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "be9a4654dd5839b97f39d5060d98f18ba868623c" - } - }, - "zlib": { - "version": "0.1.0", - "vcsRevision": "a2f44bb7f65571a894227ff6fde9298a104e03a5", - "url": "https://github.com/status-im/nim-zlib", - "downloadMethod": "git", - "dependencies": [ - "stew" - ], - "checksums": { - "sha1": "edbf76ebdecb63d302d1883fe4b23b2eb0608cb7" - } - }, - "websock": { - "version": "0.1.0", - "vcsRevision": "f8ed9b40a5ff27ad02a3c237c4905b0924e3f982", - "url": "https://github.com/status-im/nim-websock", - "downloadMethod": "git", - "dependencies": [ - "chronos", - "httputils", - "chronicles", - "stew", - "nimcrypto", - "bearssl", - "zlib" - ], - "checksums": { - "sha1": "94f836ae589056b2deb04bdfdcd614fff80adaf5" - } - }, - "secp256k1": { - "version": "0.6.0.3.1", - "vcsRevision": "2acbbdcc0e63002a013fff49f015708522875832", - "url": "https://github.com/status-im/nim-secp256k1", - "downloadMethod": "git", - "dependencies": [ - "stew", - "nimcrypto" - ], - "checksums": { - "sha1": "146818431dec16ededb951f42fc36832949bcc8f" - } - }, - "dnsclient": { - "version": "0.3.4", - "vcsRevision": "23214235d4784d24aceed99bbfe153379ea557c8", - "url": "https://github.com/ba0f3/dnsclient.nim", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "65262c7e533ff49d6aca5539da4bc6c6ce132f40" - } - }, - "npeg": { - "version": "1.2.0", - "vcsRevision": "22449099d92d8bbd535fcd950287274c8d11daed", - "url": "https://github.com/zevv/npeg", - "downloadMethod": "git", - "dependencies": [], - "checksums": { - "sha1": "bfe84b7b89a4f92e9ca6d9be8256bdda032e556b" - } - }, - "stint": { - "version": "2.0.0", - "vcsRevision": "711cda4456c32d3ba3c6c4524135b3453dffeb9c", - "url": "https://github.com/status-im/nim-stint", - "downloadMethod": "git", - "dependencies": [ - "stew" - ], - "checksums": { - "sha1": "432d8fa883c807932fc78ecd33fc944637e2d328" - } - }, - "metrics": { - "version": "0.0.1", - "vcsRevision": "51f1227d0fd04ce84b1ef784b11280cb7875348c", - "url": "https://github.com/status-im/nim-metrics", - "downloadMethod": "git", - "dependencies": [ - "chronos" - ], - "checksums": { - "sha1": "948aaca1763c838a7752251bab9a8bcfda66acfe" - } - }, - "protobuf_serialization": { - "version": "0.3.0", - "vcsRevision": "5a31137a82c2b6a989c9ed979bb636c7a49f570e", - "url": "https://github.com/status-im/nim-protobuf-serialization", - "downloadMethod": "git", - "dependencies": [ - "stew", - "faststreams", - "serialization", - "npeg", - "unittest2" - ], - "checksums": { - "sha1": "ed8270a5f874af35c5e9c04b50020c8a27ba61f5" - } - }, - "libp2p": { - "version": "1.1.0", - "vcsRevision": "e3c967ad1939fb33b8e13759037d193734acd202", - "url": "https://github.com/status-im/nim-libp2p", - "downloadMethod": "git", - "dependencies": [ - "nimcrypto", - "dnsclient", - "bearssl", - "chronicles", - "chronos", - "metrics", - "secp256k1", - "stew", - "websock", - "unittest2" - ], - "checksums": { - "sha1": "fbc9aef1a5d8e9cc79fed0328266eacc0339de47" - } - } - }, - "tasks": {} -} diff --git a/build.nims b/tests/build.nims similarity index 75% rename from build.nims rename to tests/build.nims index 5801ada..d871f6e 100644 --- a/build.nims +++ b/tests/build.nims @@ -1,23 +1,32 @@ import std / [os, strutils, sequtils] task testAll, "Run DHT tests": - exec "nim c -r tests/testAll.nim" - rmFile "./tests/testAll" + exec "nim c -r test.nim" + rmFile "./test" + +task compileParallelTests, "Compile parallel tests": + exec "nim c --hints:off --verbosity:0 dht/test_providers.nim" + exec "nim c --hints:off --verbosity:0 dht/test_providermngr.nim" + exec "nim c --hints:off --verbosity:0 discv5/test_discoveryv5.nim" + exec "nim c --hints:off --verbosity:0 discv5/test_discoveryv5_encoding.nim" task test, "Run DHT tests": # compile with trace logging to make sure it doesn't crash - exec "nim c -d:testsAll -d:chronicles_enabled=on -d:chronicles_log_level=TRACE tests/testAll.nim" - rmFile "./tests/testAll" - exec "nim c -r -d:testsAll --verbosity:0 tests/testAllParallel.nim" - rmFile "./tests/testAllParallel" + exec "nim c -d:testsAll -d:chronicles_enabled=on -d:chronicles_log_level=TRACE test.nim" + rmFile "./test" + compileParallelTestsTask() + exec "nim c -r -d:testsAll --verbosity:0 testAllParallel.nim" + rmFile "./testAllParallel" task testPart1, "Run DHT tests A": - exec "nim c -r -d:testsPart1 tests/testAllParallel.nim" - rmFile "./tests/testAllParallel" + compileParallelTestsTask() + exec "nim c -r -d:testsPart1 testAllParallel.nim" + rmFile "./testAllParallel" task testPart2, "Run DHT tests B": - exec "nim c -r -d:testsPart2 tests/testAllParallel.nim" - rmFile "./tests/testAllParallel" + compileParallelTestsTask() + exec "nim c -r -d:testsPart2 testAllParallel.nim" + rmFile "./testAllParallel" task coverage, "generates code coverage report": var (output, exitCode) = gorgeEx("which lcov") @@ -50,7 +59,7 @@ task coverage, "generates code coverage report": if f.endswith(".nim"): nimSrcs.add " " & f.absolutePath.quoteShell() echo "======== Running Tests ======== " - exec("nim c -r tests/coverage.nim") + exec("nim c -r coverage.nim") exec("rm nimcache/*.c") rmDir("coverage"); mkDir("coverage") echo " ======== Running LCOV ======== " diff --git a/tests/coverage.nim b/tests/coverage.nim deleted file mode 100644 index e9146c9..0000000 --- a/tests/coverage.nim +++ /dev/null @@ -1,2 +0,0 @@ - -include ./testAll diff --git a/tests/coverage.nims b/tests/coverage.nims deleted file mode 100644 index f14fce4..0000000 --- a/tests/coverage.nims +++ /dev/null @@ -1,15 +0,0 @@ -switch("define", "testsAll") - -switch("debugger", "native") -switch("lineDir", "on") -switch("define", "debug") -# switch("opt", "none") -switch("verbosity", "0") -switch("hints", "off") -switch("warnings", "off") -switch("define", "chronicles_log_level=INFO") -switch("nimcache", "nimcache") -switch("passC", "-fprofile-arcs") -switch("passC", "-ftest-coverage") -switch("passL", "-fprofile-arcs") -switch("passL", "-ftest-coverage") diff --git a/tests/dht/test_providermngr.nim b/tests/dht/test_providermngr.nim index 6577c44..c68d862 100644 --- a/tests/dht/test_providermngr.nim +++ b/tests/dht/test_providermngr.nim @@ -2,7 +2,7 @@ import std/sequtils import pkg/chronos -import pkg/asynctest +import pkg/asynctest/chronos/unittest import pkg/datastore from pkg/libp2p import PeerId diff --git a/tests/dht/test_providers.nim b/tests/dht/test_providers.nim index de2b884..8be7c50 100644 --- a/tests/dht/test_providers.nim +++ b/tests/dht/test_providers.nim @@ -11,7 +11,7 @@ import std/[options, sequtils], - asynctest, + asynctest/chronos/unittest2, bearssl/rand, chronicles, chronos, diff --git a/tests/discv5/test_discoveryv5.nim b/tests/discv5/test_discoveryv5.nim index 771f975..3276a10 100644 --- a/tests/discv5/test_discoveryv5.nim +++ b/tests/discv5/test_discoveryv5.nim @@ -2,7 +2,7 @@ import std/tables, - chronos, chronicles, stint, asynctest, stew/shims/net, + chronos, chronicles, stint, asynctest/chronos/unittest, stew/shims/net, stew/byteutils, bearssl/rand, libp2p/crypto/crypto, codexdht/discv5/[transport, spr, node, routing_table, encoding, sessions, nodes_verification], diff --git a/tests/discv5/test_discoveryv5_encoding.nim b/tests/discv5/test_discoveryv5_encoding.nim index 4c50d84..56acd2d 100644 --- a/tests/discv5/test_discoveryv5_encoding.nim +++ b/tests/discv5/test_discoveryv5_encoding.nim @@ -2,7 +2,7 @@ import std/[options, sequtils, tables], - asynctest/unittest2, + asynctest/chronos/unittest2, bearssl/rand, chronos, libp2p/crypto/secp, diff --git a/tests/testAll.nim b/tests/test.nim similarity index 100% rename from tests/testAll.nim rename to tests/test.nim diff --git a/tests/test.nimble b/tests/test.nimble new file mode 100644 index 0000000..c959dd1 --- /dev/null +++ b/tests/test.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.4.0" +author = "Status Research & Development GmbH" +description = "Tests for Codex DHT" +license = "MIT" +installFiles = @["build.nims"] + +# Dependencies +requires "asynctest >= 0.5.2 & < 0.6.0" +requires "unittest2 <= 0.0.9" + +include "build.nims" diff --git a/tests/testAllParallel.nim b/tests/testAllParallel.nim index f29c975..cbeeedb 100644 --- a/tests/testAllParallel.nim +++ b/tests/testAllParallel.nim @@ -8,13 +8,13 @@ var cmds: seq[string] when defined(testsPart1) or defined(testsAll): cmds.add [ - "nim c -r --hints:off --verbosity:0 tests/dht/test_providers.nim", - "nim c -r --hints:off --verbosity:0 tests/dht/test_providermngr.nim", + "nim c -r --hints:off --verbosity:0 dht/test_providers.nim", + "nim c -r --hints:off --verbosity:0 dht/test_providermngr.nim", ] when defined(testsPart2) or defined(testsAll): cmds.add [ - "nim c -r --hints:off --verbosity:0 tests/discv5/test_discoveryv5.nim", - "nim c -r --hints:off --verbosity:0 tests/discv5/test_discoveryv5_encoding.nim", + "nim c -r --hints:off --verbosity:0 discv5/test_discoveryv5.nim", + "nim c -r --hints:off --verbosity:0 discv5/test_discoveryv5_encoding.nim", ] echo "Running Test Commands: ", cmds diff --git a/vendor/atlas.workspace b/vendor/atlas.workspace deleted file mode 100644 index 812bfb2..0000000 --- a/vendor/atlas.workspace +++ /dev/null @@ -1,3 +0,0 @@ -deps="" -resolver="MaxVer" -overrides="urls.rules" diff --git a/vendor/urls.rules b/vendor/urls.rules deleted file mode 100644 index 7636ff3..0000000 --- a/vendor/urls.rules +++ /dev/null @@ -1,8 +0,0 @@ -https://github.com/status-im/nim-libp2p-dht.git -> https://github.com/codex-storage/nim-codex-dht.git -https://github.com/markspanbroek/questionable -> https://github.com/codex-storage/questionable -https://github.com/status-im/questionable -> https://github.com/codex-storage/questionable -https://github.com/status-im/asynctest -> https://github.com/codex-storage/asynctest -https://github.com/status-im/nim-datastore -> https://github.com/codex-storage/nim-datastore -https://github.com/cheatfate/nimcrypto -> https://github.com/status-im/nimcrypto -protobufserialization -> protobuf_serialization -protobufserialization -> https://github.com/status-im/nim-protobuf-serialization